NOTE: this tip may be specific to Ubuntu, as far as the command goes…

*It turns out that this might be an Ubuntu-specific command. Its changed over time, as its now:

blkid

One thing that I’ve noticed is that many distros are starting to change their partition references in /etc/fstab to a UUID from the more familiar (but no friendlier) reference to the volume in /dev (such as /dev/hdc3, for example).  This might be a sign of things to come, since any distro based on the 2.6 Linux kernel has pretty much dropped the /dev for udev (hot plugging for cold plugging, etc).  After looking into things, its good for situations where drives are being moved or removed now and then (as in when you plug in your USB hard drive).

However, if you’re a constant alpha/beta tester at heart, like I am, you are probably using a main Linux partition or drive to work from and have either a spare drive or partition that you frequently blow away and replace what’s on it with the latest fun toy, as I do.  I don’t know how many distros are doing this with the UUID so far, but I suspect that Fedora does and I know that Ubuntu and Mandriva are now doing it.  So, what happens if you are tired of what you’ve been testing and you want to install something new? As soon as you format the drive, the UUID will change.  How do you reference the drive in your /etc/fstab, so that you can either find it when you want to mount it, or when you want to boot from the new distro? The first “U” is for “unique”, and they are! Here’s what’s currently in my /boot/grub/menu.lst for the Mandrake alpha 2 that I’m playing with: root=UUID=b414e306-0582-4572-926d-a8c113bf34bb.

That’s not exactly the stuff of memorization, and, in a few hours, it’ll be different, as I’m going to hose it and reinstall it with a totally different configuration (I wanna try KDE 4!!!).  So, how do I get the new volume ID to put in /etc/fstab and /boot/grub/menu.lst? With Ubuntu, you have a command called vol_id that you can run as root to determine various things about the volumes that are accessible to your computer.

The command is vol_id. So, the command to find a volume ID is:

sudo vol_id -u device

where device is the /dev entry for the partition you want to know about.  for example,

sudo vol_id -u /dev/hdc3

would yield the long scary output that you need to enter into your files.

I hope that this helps all you distro hoppers out there as much as it has me.

TopOfBlogs