Skip to content

sinezty/linux-disk-mount-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Linux Disk Mount Helper

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.

License Platform Bash

🚀 Key Features

  • 🔍 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, and btrfs with clear use-case recommendations.
  • 📂 Auto-Mount: Safely adds entries to /etc/fstab with nofail (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/fstab and /etc/samba/smb.conf before editing.
    • Configures UFW firewall automatically.
    • Fixes permission issues so you can actually write files from Windows.

📦 Installation

You can run the script directly without cloning, or download it to keep it handy.

Option 1: Quick Run (Recommended)

wget -O disk-share.sh https://raw.githubusercontent.com/sinezty/linux-disk-mount-helper/main/disk_share.sh
sudo bash disk-share.sh

Option 2: Clone & Run

git clone https://github.com/sinezty/linux-disk-mount-helper.git
cd linux-disk-mount-helper
sudo bash disk_share.sh

📖 Usage Guide

  1. Run the script with sudo:
    sudo bash disk_share.sh
  2. 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!
  3. 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.
  4. Mount Point: Give your drive a name (e.g., movies, backup). It will be mounted at /mnt/your-name.
  5. Samba Share: Answer Y to enable Windows sharing. The script handles the config, users, and permissions.

❓ FAQ

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.

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

📝 License

Distributed under the MIT License. See LICENSE for more information.


Created by sinezty (BarışY)

About

Interactive bash script to detect, partition, format, and share Linux disks with Windows (Samba + wsdd). Supports Ubuntu/Debian/RPi.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages