uuid.jpgHave a burning urge to discover the UUID’s of your disk partitions? Run Ubuntu or some other Debian based distro like maybe Debian? Well have I got the article for you friend! Here it is, two easy steps to discovering your UUID – and the best part? For two steps I’ll give you two different ways to get that pesky UUID on your screen.

But first, what exactly is a UUID? From Wikipedia we see that a UUID is a Universally Unique Identifier. “The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. Thus, anyone can create a UUID and use it to identify something with reasonable confidence that the identifier will never be unintentionally used by anyone for anything else.”

For a little more trivia: A UUID is a 16-byte (128-bit) number. The number of theoretically possible UUIDs is therefore 216*8 = 2128 = 25616 or about 3.4 × 1038. This means that 1 trillion UUIDs would have to be created every nanosecond for 10 billion years to exhaust the number of UUIDs. That’s a lot of UUIDs.

These unique ID’s are used by Ubuntu to identify your various partitions for the system. So if you do a quick
cat /etc/fstab
You should see at least one, probably two and possibly more UUID’s in there. One for your primary partition and one for your swap partition, plus more if you have any removable devices, other drives or other partitions around. It will look something like UUID=1c9e4ae2-0ddc-4e3c-8758-4cdd6c90407a.

So how do you discover just what partition belongs to which UUID? Open up a terminal session (Applications -> Accessories -> Terminal) and type the following:
On my system, the output is as follows:
/dev/sda1: UUID=”1c9e4ae2-0ddc-4e3c-8758-4cdd6c90407a” SEC_TYPE=”ext2″ TYPE=”ext3″
/dev/sda5: UUID=”a647ea33-74ee-4123-84bf-7edc32e2e39b” TYPE=”swap”

So sda1 (my primary partition) and sda5 (my swap partition) are identified.

Or, your could type:
ls -l /dev/disk/by-uuid
and see something like this:
lrwxrwxrwx 1 root root 10 2008-01-02 08:26 1c9e4ae2-0ddc-4e3c-8758-4cdd6c90407a -> ../../sda1
lrwxrwxrwx 1 root root 10 2008-01-02 08:26 a647ea33-74ee-4123-84bf-7edc32e2e39b -> ../../sda5

There you can get the UUID and also see who owns the partitions, when they were last touched, their permissions and finally, what they’re called (sda1 and sda5 in this case).

If you’re trying to pin down which UUID is associated with a particular thing, such as your root partition, you can cat /etc/fstab and look for the UUID associated with the mount point “/“.