Recent versions of Linux use a unique identifier for hard drives in order to make sure they get mounted to the same location all the time. If you’ve looked into your /etc/fstab file for auto mounting drives, then you’re probably already familiar with the long character strings that are used for UUID’s.
The question is, how do I find out the UUID for each drive on my computer? Well, there’s more than one way to do this, but the simplest is probably the blkid command.
[term]blkid[/term]
This will list all of the drives on your system. If you’re only interested in finding the UUID of a particular drive partition, then just enter that partition device after the command. For example, to find the UUID of partition 3 on drive “a” enter:
[term]blkid /dev/sda3[/term]
Edit: Based on Stefan’s comment below, your system may behave differently. You may have to invoke the command like this:
[term]blkid -u filesystem /dev/sda3[/term]
This can be useful if you’ve added a drive to your system, or you’ve modified the partitions on an existing drive and you want to make appropriate changes to the /etc/fstab file.
Pingback: Destillat #26 | duetsch.info - Open Source, Wet-, Web-, Software
Pingback: Links 28/3/2010: Sabayon 5.2 and GIMP Fun | Boycott Novell
Thanks, I did not know this command. I usually just used “ls -l /dev/disk/by-uuid/”.
Even though “blkid” works fine, “blkid [device]” does not work (it just does not output anything). Any hints?
Yeah, I just learned the command myself. I’ve used the same ls command in the past.
It’s funny. I wrote this post on my netbook running Ubuntu Jaunty and it worked fine. Now on my Karmic desktop I have the same issue. Even blkid did nothing at first until I invoked it with sudo. Maybe the default behavior in Jaunty is different. Try something like:
[term]blkid -u filesystem /dev/sda3[/term]
Take a look at
[term]blkid -h[/term]
for usage options.
As a point of interest, here’s the version info from blkid -v from Ubuntu Jaunty
[term]blkid 1.0.0 (12-Feb-2003)[/term]
and from Karmic
[term]blkid from util-linux-ng 2.16 (libblkid 2.16.0, 10-Feb-2009)[/term]
This would likely explain the difference in behavior.
Pingback: fsdaily.com