Auto-mounting of NTFS USB HDD on Linux on system boot
2025-02-07
In this article we will configure automatic mounting of NTFS USB HDD on Linux on boot time and semi-automatic mounting via fstab and executing mount -a in case HDD was plugged in after system completed booting. Please mention that mountpoint will have read & write permissions.
Create a persistent mount point:
sudo mkdir -p /mnt/usb_hdd
Connect your USB HDD to computer.
Then find out disk UUID and copy it:
sudo blkid
Add this line to /etc/fstab. Don't forget to paste correct UUID there. This is a boot-safe mounting rule for the case when your HDD is not connected on the system boot:
UUID=1234567ABCDEF123 /mnt/usb_hdd ntfs-3g defaults,uid=1000,gid=1000,umask=000,dmask=000,fmask=111,auto,nofail,x-systemd.automount 0 2
Try automounting:
sudo mount -a
Check that your HDD is readable and writable.
ls -alh /mnt/usb_hdd # list files and folders if any exist on your HDD
touch /mnt/usb_hdd/test_file # testing file creation
rm /mnt/usb_hdd/test_file # removing test file
Unmount USB HDD
sudo umount /mnt/usb_hdd
Additionally you can poweroff USB HDD, but this is not required (don't forget to substitute correct device instead of sda)
udisksctl power-off -b /dev/sda
Eject USB cable. Enjoy!