Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Exactly what part of the disk is a UUID stored on? MBR? Somewhere within the partition? Is it a calculated value, or randomly generated and recorded?

share|improve this question

2 Answers 2

up vote 10 down vote accepted

The UUID is stored in the superblock (of which there are many copies in case one gets damaged). The value itself is generated using libuuid, which is part of the e2fsprogs suite. There are many libraries for generating UUIDs; RFC4122 is a good place to start as it describes the more commonly used technique and includes reference code.

Here's a couple of links that may help - they are specific to ext2, but other variants should also have a similar place where they store the uuid:

http://www.nongnu.org/ext2-doc/ext2.html#S-UUID

http://linux.die.net/man/3/libuuid

share|improve this answer

There are many ways to get the UUID of a partition, but by far the simplest way is to look in the /dev/disk/by-uuid/ folder. By example,

[pobega@greedo]$ **ls -l /dev/disk/by-uuid/**
lrwxrwxrwx 1 root root 10 2009-08-26 17:13 02ce3c1b-8893-402a-9e12-c01ac752ac3b -> ../../sda2
lrwxrwxrwx 1 root root 10 2009-08-26 17:13 2dcd156b-7ec6-4bf5-b1a2-dd4f5fb5082a -> ../../sdb3
[...]

Each file is a symlink to the partition that it is the UUID of (I apologize if that sentence is tough to comprehend, but it's a tough concept to put into words).

share|improve this answer
    
I'm not interested in the UUID, but how those UUID to device mappings are built, so that I can restore Ubuntu from a full disk backup and expect it to boot. –  jldugger Aug 27 '09 at 4:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.