What is the reasoning behind using UUIDs in /etc/fstab
instead of device names (like /dev/sbd2
)?
Device names &/or partition numbers seem substantially cleaner from an administrative viewpoint.
What is the reasoning behind using UUIDs in /etc/fstab
instead of device names (like /dev/sbd2
)?
Device names &/or partition numbers seem substantially cleaner from an administrative viewpoint.
Because device names aren't guaranteed to be the same across a reboot.
There are some systems out there where the order in which devices get enumerated is not constant across reboots (most often, this involves very big storage arrays or USB connected devices). On such a system, /dev/sda
on one boot might end up being /dev/sdb
on another boot, and /dev/sdz
on a third boot. I used to have a ThinkPad laptop that would enumerate USB connected storage devices before the built-in SATA hard drive, so it would fail to boot if I used device names and plugged in a flash drive while powering the system on.
Aside from that though, you might do someihing inside the case, and plug the disk drives back in in the wrong order (most people don't physically label their drives).
In either case, you need to identify your devices in some other way. The obvious choice for this is to look at filesystem labels, but those have their own issues, most notably that they're easy to guess and therefore it's easy to cause issues with a system using them by simply plugging in a flash drive with a correctly guessed filesystem label.
As a result, UUID's are what has been standardized on, since they are hard to guess, and still provide the relative uniqueness that filesystem labels do.
Note that this is the same kind of problem that has resulted in a movement away from usage of the eth*
and wlan*
naming for network cards, as those names can change around depending on the order the cards are plugged in.