Skip to main content

🧷 Mounting an External USB Hard Drive on Debian

🧷 Mounting an External USB Hard Drive on Debian

πŸ“‹ Overview

This guide outlines how to properly identify, mount, and persistently configure an external USB hard drive on a Debian-based system. It is particularly useful for setups involving backup containers like urbackup or media/file storage solutions.


πŸ” Step 1: Identify the USB Drive

lsblk

Look for a device (e.g., /dev/sdb1) with the expected size and no mount point.

sudo blkid /dev/sdb1

This confirms the filesystem type and gets the UUID (used for persistent mounting).


πŸ’Ύ Step 2: Install Required NTFS Support

If the drive is formatted as NTFS (common for Windows drives), install the NTFS driver:

sudo apt update
sudo apt install ntfs-3g

Note: Do not install fuse on Debian 12 (Bookworm); it conflicts with fuse3.


πŸ“ Step 3: Create a Mount Point

sudo mkdir -p /mnt/usbbackup

πŸ“ Step 4: Configure /etc/fstab

Edit the fstab file to auto-mount the drive at boot:

sudo nano /etc/fstab

Add this line (replace UUID with yours from blkid):

UUID=5E74F4D874F4B43D  /mnt/usbbackup  ntfs-3g  defaults,noatime,nofail,uid=1001,gid=1001,umask=0022,allow_other  0  2

Option

Description

ntfs-3g

NTFS filesystem driver with write support

noatime

Improves performance by disabling access-time updates

nofail

Allows boot to continue if the drive is missing

uid/gid

Sets ownership for consistent Docker access

umask=0022

Applies

rwxr-xr-x

permissions

allow_other

Permits non-root users to access the mount


πŸ§ͺ Step 5: Mount and Verify

sudo systemctl daemon-reexec
sudo mount -a

Check if it mounted successfully:

df -h | grep usbbackup

Confirm correct permissions:

ls -ld /mnt/usbbackup

βœ… Example Output

/dev/sdb1 on /mnt/usbbackup type fuseblk (rw,nosuid,nodev,noatime,allow_other,blksize=4096)

πŸ› οΈ Troubleshooting

  • Wrong filesystem type?
    Make sure you used ntfs-3g and not ext4 in your fstab line.
  • "Bad superblock" or mount error?
    Use dmesg | tail -30 to check for detailed kernel messages.
  • Permissions issue in Docker?
    Ensure the Docker container’s UID/GID matches the mount options.

  • To mount an ext4 drive, change ntfs-3g to ext4 and remove uid/gid/umask options.
  • To temporarily mount a USB without fstab:
    sudo mount -t ntfs-3g /dev/sdb1 /mnt/usbbackup