RSS

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

Wed, Jan 2, 2008

ArsGeek, Linux, Ubuntu, howto

Talk about it in our Forums

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:

blkid

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 “/“.

Technorati Tags: , , ,

Click the icon, share the link:
  • Digg
  • del.icio.us
  • MisterWong
  • Furl
  • Reddit
  • Technorati
  • BlinkList
  • feedmelinks
  • PopCurrent
  • Blogosphere News
  • Facebook
  • Fark
  • Mixx
  • Slashdot

This post was written by:

arsgeek - who has written 1980 posts on ArsGeek.


Contact the author

6 Comments For This Post

  1. Pilo Says:

    I had to run ’sudo blkid’ to get results, thanks for the info.

  2. Lex V. Ross Says:

    After resizing my swap partition with GParted on Ubuntu 8.10 I had to format it to reflect the new size. Then I found out after reboot that no swap was activated because UUID had changed. I used partition name /dev/sda* in /etc/fstab to correct the problem and was wondering on how to find out the correct UUID to make it the proper way. This article came up first on Google and was of great help. Keep up the good work!

  3. fd Says:

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

    A: blkid

    how hard was that?

  4. bad_dog Says:

    short and sweet great thanks.

  5. spart Says:

    another way to find uuid is the command:

    sudo vol_id -u /dev/hda1

    replace hda1 with the partition for which you wish to find the UUID
    :)

  6. Ian Park Says:

    Great stuff - the only small wrinkle was that I had to use sudo blkid as mentioned above. I upgraded a 2-disk RAID0 array to a 4-disk RAID5 array, and this article was the last link in the chain, to let me put the new UUID into /etc/fstab.

4 Trackbacks For This Post

  1. Ubuntu tip: how to find uuid for your devices « Robinbajaj’s Weblog Says:

    [...] , I need to find the UUID for my devices while running Ubuntu 7.10 linux on my box. I found this  article very useful [...]

  2. XtremePro Software » Blog Archive » Ubuntu tip: how to find uuid for your devices Says:

    [...] , I need to find the UUID for my devices while running Ubuntu 7.10 linux on my box. I found this  article very useful ! Posted under Linux (Ubuntu) by robinbajaj on [...]

  3. Server con Ubuntu 8.10 Intrepid Ibex « farrebyc’s block notes Says:

    [...] ArsGeek: How to find your UUID’s for devices in Ubuntu (and other Debian based distros) [...]

  4. Dual boot with Ubuntu on flash drive? - Remote Exploit Forums Says:

    [...] Could anybody please give me a walkthrough? [SOLVED] How do you find UUID? - Ubuntu Forums How to find your UUID’s for devices in Ubuntu (and other Debian based distros)*|*ArsGeek https://help.ubuntu.com/community/UsingUUID BTW when there is a tutorial posted, then great. But [...]

Leave a Reply