2010-09-21

Using UUID in fstab on Ubuntu

Unfortunately for me, I have four internal hard drives and a DVD drive on a motherboard that only has four SATA connections.  So from time to time, I do a musical chairs game moving wires around.

Then I started up Ubuntu and it complained it couldn't mount one of my drives.  I checked it and it was a good running drive, so what's wrong?  It turns out I had an fstab entry for a /dev/sdb1 for one of my drives that was using ext3, but after swapping some wires around, /dev/sdb1 mapped to my other drive that was using ext4.  Or maybe it was the other way around.

Anyway, I noticed my primary boot and swap volumes were listed in fstab using UUIDs, so I figured it would be helpful to list my other drives using UUID as well so that they won't be sensitive to the wire swapping that happens from time to time.

How to find out the UUID of the drives?  A quick ls -l /dev/disk/by-uuid/ works, or else try sudo blkid.

More info here: How to find your UUID’s for devices in Ubuntu (and other Debian based distros)

Funny thing, someone else did the exact opposite years ago, switching UUIDs back to /dev/paths.  Maybe UUIDs back then were problematic, but I'm glad Ubuntu stuck with it because it's sure convenient for me nowadays.

No comments: