Tested on Ubuntu 18.04.
First of all, try with the command blkid
(man: locate/print block device attributes) to show the UUID of the disk you want to mount. For example:
blkid /dev/nvme0n1
If the above command does not work, open Disks, gparted or another similar utility and search for the identifier. For example, my external disk has UUID equal to 02011f1a-bcaf-4054-af7c-e4a757c710c3
. To verify it is referred to the correct dev name, run the command:
blkid -U 02011f1a-bcaf-4054-af7c-e4a757c710c3
This should return the same name of the device (eg. /dev/nvme0n1
).
Where do you want to mount the disk? Be sure to create the destination directory and properly assign the ownership and permissions.
For example, my username is marco
and I want to mount my external disk to /media/marco/SSD500GB
.
MNTPATH=/media/marco/SSD500GB
sudo mkdir $MNTPATH
sudo chmod 755 $MNTPATH
sudo chown marco:marco $MNTPATH
Let UUID
, MNTPATH
and FS
be three variables containing the unique id of the disk, the mount point and its file system. For example:
UUID=02011f1a-bcaf-4054-af7c-e4a757c710c3
MNTPATH=/media/marco/SSD500GB
FS=ext4
Update the file system table (need sudo permissions):
echo "UUID=$UUID $MNTPATH $FS defaults 0 0" >> /etc/fstab
Reboot the system to validate the procedure.