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?
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?
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
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,
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).