The many paths to disk UUIDs

I was searching for the best way to find a partition UUID. It turns out, there are lots of ways to do it, some of which are now obsolete.

My requirements were that I wanted something usable from normal users and available on major distros by default. This rules out blkid that is now regarded as the “golden standard” (and looks like a good and useful tool to me). But it’s not available on Fedora by default and it requires root privileges.

So I spent a few hours searching and trying various methods. Seems like vol_id, blkid predecessor, is now vanished from major distros, so it was not an option.

I didn’t want to use the symlinks in /dev/disk/by-uuid/ because it required a lot of searching around to find which device they are pointing to (the link points to the real block device, but often you mount a symlink, like it happens with LVM). This is the most portable and available solution.

Then I found this page that documents another method: using udevadm you can find a whole lot of informations about each partition. It’s available on both Debian/Ubuntu and Fedora and it doesn’t require root privileges. So, my current cmdline is:

user$ udevadm info -q all -n <partition>

E: ID_FS_UUID=c5cfd7d2-440d-48a9-abfd-b3871fa8876d



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.