A powerful, interactive bash script to simplify disk management on Linux servers. Designed for Ubuntu, Debian, Raspberry Pi, and DietPi.
This tool bridges the gap between Linux servers and Windows clients, making it effortless to add new storage and share it across your local network.
- 🔍 Auto-Discovery: Automatically detects unmounted partitions and RAW disks.
- 🛠️ One-Click Partitioning: Detects new raw disks and offers to initialize (GPT) and partition them automatically.
- 💾 Format Options: Supports
ext4,ntfs,exfat,xfs, andbtrfswith clear use-case recommendations. - 📂 Auto-Mount: Safely adds entries to
/etc/fstabwithnofail(prevents boot hangs if disk is missing). - 🪟 Windows Friendly:
- Installs and configures Samba for network sharing.
- Installs wsdd so your Linux machine appears in Windows Network Explorer.
- Offers NTFS support (
ntfs-3g) for physical drive portability.
- 🛡️ Secure & Safe:
- Creates backups of
/etc/fstaband/etc/samba/smb.confbefore editing. - Configures UFW firewall automatically.
- Fixes permission issues so you can actually write files from Windows.
- Creates backups of
You can run the script directly without cloning, or download it to keep it handy.
wget -O disk-share.sh https://raw.githubusercontent.com/sinezty/linux-disk-mount-helper/main/disk_share.sh
sudo bash disk-share.shgit clone https://github.com/sinezty/linux-disk-mount-helper.git
cd linux-disk-mount-helper
sudo bash disk_share.sh- Run the script with sudo:
sudo bash disk_share.sh
- Select a Disk: The script lists all available unmounted disks. Enter the number corresponding to your drive.
- Note: If you select a RAW DISK, the script will ask to initialize it. This will erase all data!
- Choose Filesystem:
- ext4: Best for permanent network storage (NAS).
- ntfs: Best if you plan to unplug the USB drive and use it on a Windows PC.
- Mount Point: Give your drive a name (e.g.,
movies,backup). It will be mounted at/mnt/your-name. - Samba Share: Answer
Yto enable Windows sharing. The script handles the config, users, and permissions.
Q: Why can't I see my server in Windows Network?
A: This script installs wsdd to fix exactly this issue. If it still doesn't appear, try accessing it directly via \\YOUR-SERVER-IP in the Run dialog (Win+R).
Q: Will this erase my data? A: Only if you choose to Format or Partition a disk. Mounting an existing partition is safe and non-destructive.
Q: Can I use this on a Raspberry Pi? A: Yes! It is fully tested on Raspberry Pi OS and DietPi.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
Distributed under the MIT License. See LICENSE for more information.
Created by sinezty (BarışY)