In linux, hard drive dev assignments can get changed between reboots – especially with external/removable drives. This means using /dev/sdX or /dev/hdX is not the best way to mount a drive that needs to be mounted every time at boot.
The best way to do it is to use the UUID (Universal Unique Identifier). To use it, execute the following command as root:
You will get something like this:
/dev/sda1: UUID="9l2Lpu-Bm6b-xQ5A-BFxt-z3A3-a3aN-rbFdTd" TYPE="xfs" /dev/sdb1: UUID="70773df7-ed30-45a6-8cd8-8944dde9a98c" TYPE="ext4" /dev/sdc1: UUID="8b5b431e-91bd-4fc1-9e31-9eb66eadb2e7" TYPE="xfs"
We need /dev/sdc1, which is an external USB drive we use for backups, to always be mounted as /mnt/backup. So we first edit the /etc/fstab and add the following line:
UUID=8b5b431e-91bd-4fc1-9e31-9eb66eadb2e7 /mnt/backup xfs defaults 0 0
If we add or remove removable drives to the system and /dev/sdc1 gets changed to say /dev/sdf1, it wont matter, because the UUID is unique.
Last Updated on