This page looks best with JavaScript enabled

UUID Correspondence (Universally Unique Identifier) partition

 ·  🎃 kr0m

The use of UUID has an advantage (and probably some more) in external storage devices such as USB hard drives. If we have two disks, each with its UUID and fstab configured by UUID, when we connect any of them, it will be mounted in the directory specified in fstab regardless of the connection order.

Now suppose we configure fstab by “device” with the entries:

/dev/sda1 /mnt/usb1 ext4 defaults 0 2
/dev/sdb1 /mnt/usb2 ext4 defaults 0 2

The first disk we connect will be /dev/sda1 and the second /dev/sdb1, so if we connect the usb2 disk, it will be the device /dev/sda1 and will be mounted in the /mnt/usb1 directory, which we do not want to happen!!!

If we want to see the UUID correspondence to the partition, it is as simple as running:

ls -l /dev/disk/by-uuid/

Personally, I have the system partitions configured by device and the external disks by UUID ;)

If you liked the article, you can treat me to a RedBull here