How to auto-mount hard drives in Ubuntu
List partitions and note the name and UUID of the partition you want to mount
sudo lsblk -o NAME,FSTYPE,UUID
Sample output:
NAME FSTYPE UUID
sda
├─sda1 vfat 7158-C80D
├─sda2 ext4 639f097b-6b4e-4c93-b91e-29e219e5ddce
└─sda3 LVM2_member mslNSe-6uVU-aw3U-Ea0a-joV6-LWuk-rBMmiP
└─ubuntu--vg-ubuntu--lv ext4 3abbffb9-14b2-4fbf-8dde-3e42229703a0
sdb
├─sdb1 vfat 67E3-17ED
└─sdb2 exfat 63A9-53A7
sdc
├─sdc1 vfat 67E3-17ED
└─sdc2 exfat 5FD2-E063
sdd
├─sdd1 vfat FC3B-1B14
├─sdd2
├─sdd3 ntfs 1AFA3FBEFA3F94CB
├─sdd4 ntfs E8F83347F8331374
└─sdd5 ntfs 0C7A2E077A2DEE60
Create a mount point
mkdir /mnt/myDisk
Edit fstab
:
sudo nano /etc/fstab
On the bottom, add a line like this for each partition you want to automount
UUID=<partition uuid> /mnt/myDisk auto nosuid,nodev,nofail,x-gvfs-show 0 0
Test the new config by this command
sudo mount -a
There should be no errors if the config is good. Reboot your machine.