Using UUIDs in Fedora’s fstab file
As with my beloved FreeBSD, Fedora has a
/etc/fstab file that lists partitions to be automatically mounted on boot, but with one important difference: Fedora defaults to using a partition’s UUID and not its label.
I was all ready to pose a question in a newsgroup myself, but fortunately Bill Nottingham from this old thread from the Fedora 9 days put it simply:
UUIDs are unique. (In theory, anyway.) Labels aren’t.
Fair enough, I suppose you could have unintentionally labelled two of your drives the same thing. I never have because I like to use unique labels that match their mountpoints to keep things simple, but I suppose if Sarah Palin or Stephen Conroy ever installed Linux they’d probably try a stunt like that.
Anyway so it seemed if I wanted my brand new formatted drive to be mounted when Fedora booted, I needed to find out what the new drive’s partition UUID was instead of just using the label I’d just assigned to it.
How do I find out a partition’s UUID?
Good question. A cursory Google search returned this page from ServerFault which lists a dizzying array of options with plenty of justifications. blkid worked for me:
# blkid /dev/sda
> LABEL="moe" UUID="#-#-#-#-#" TYPE="ext4"
If this doesn't work, you may not have
$PATH. In that case, just run it from that folder, no worries.
Once you've got the UUID, you can finally add it to
/etc/fstab/along with the file system and mountpoint.
I still can't say I'm a fan, but I suppose that's the way things are going.