Using an external hard disk with your Linux machine is a simple way to expand storage, set up backups, or create a shared media drive. If you’re running a home server or want to make the disk accessible to other devices (Windows, Linux, macOS, or even smart TVs), combining Linux mounting with Samba file sharing is a reliable solution.
In this post, I’ll Walk you through the complete process of:
Mounting an external HDD on Linux (Debian-based system).
Setting up Samba to share the disk across your network.
Identify the External HDD
First, connect your external hard disk to the Linux machine. Then check the available disks:
lsblk
Look for your external HDD (e.g., /dev/sdb1).
Create a Mount Point
We need a directory where the HDD will be mounted. For example:
sudo mkdir -p /mnt/western_digital
'western_digital' is the name I have given to my external drive
Mount the HDD on Boot
To make sure the HDD mounts automatically after reboot:
Find its UUID:
sudo blkid
Example output:
/dev/sdb1: UUID="1234-ABCD" TYPE="ext4"
Edit /etc/fstab:
sudo nano /etc/fstab
Add a line (replace UUID accordingly):
For EXT4:
UUID=1234-ABCD /mnt/western_digital ext4 defaults 0 2
For NTFS:
UUID=1234-ABCD /mnt/western_digital ntfs-3g defaults 0 0
Save and run:
sudo mount -a
Install and Configure Samba
Now let’s set up Samba so that the external HDD can be shared across your local network.
Install Samba:
sudo apt update && sudo apt upgrade -y
sudo apt install samba samba-common-bin -y
Edit the Samba configuration file:
sudo nano /etc/samba/smb.conf
Add at the bottom:
[Western Digital]
path = /mnt/external_wd_hdd
writeable = yes
browseable = yes
public = yes
force user = yourusername
Restart Samba:
sudo systemctl restart smbd
Create a Samba user (replace yourusername with your Linux username):
sudo smbpasswd -a yourusername
Restart Samba again:
sudo systemctl restart smbd
Set proper permissions for the HDD:
sudo chmod -R 0777 /mnt/western_digital
sudo chown -R $USER:$USER /mnt/western_digital
Access the Drive from Other Devices
On Windows, open \\192.168.29.2\Western Digital in File Explorer.
On Linux, use:
smb://192.168.29.2/Western Digital
On macOS, go to Finder → Connect to Server → enter:
smb://192.168.29.2/Western Digital
With this setup, your external HDD is permanently mounted on Linux and shared via Samba across your home or office network. You can now use it for:
- Media storage (movies, music, photos)
- Backups from multiple machines
- Centralized file sharing for collaboration
This method effectively transforms any Linux machine + external HDD into a mini NAS (Network Attached Storage).