I'm running Ubuntu, and want to find out the
UUID of a particular partition. I know I can use
e2label /dev/sda1 to find out the partition label, but there doesn't seem to be a similar way to find the
Another command that might be available and also works quite well for this is 'blkid'. It's part of the e2fsprogs package. Examples of it's usage:
Look up data on /dev/sda1:
Show UUID data for all partitions:
Show UUID data for all partitions in easier to read format:
(Note: in newer releases,
Show just the UUID for /dev/sda1 and nothing else:
|show 1 more comment|
The recommended way to do this is to do
For more on using UUIDs, see this article (from ubuntu help, but should work for any linux distro using UUIDs).
As noted in comments to this question, vol_id may not be in your path. On ubuntu it is in /sbin so the above will work. For fedora it appears to need
If other distributions have vol_id in other places then post a comment and I'll add it to this answer.
You can use the following to get the UUID for a particular drive,
or you can use this to list all UUIDs for the attached media,
Assuming you want the UUID for sda1, you could try something like this:
Adjust sda1 accordingly. To get the UUIDs for all partitions, drop the greps and cuts, a la:
Sample output for sda1 on my desktop:
Edit: Please note that this solution, while more contrived than the udev->vol_id one, does not require root privileges, will work on any post-2005 or so kernel, and relies on tools present in any Linux distribution which are by default in the path for any user.