[sf-lug] UUID seems unique for each partition

Jason Turner jturner at nonzerosums.org
Tue Jan 16 15:08:27 PST 2007


On Jan 16, 2007, at 7:49 AM, Evan Klitzke wrote:

> On Tue, 2007-01-16 at 07:12 -0800, jim stockford wrote:
>>     i ran dumpe2fs /dev/hda{1,2,3,4,5} and got unique
>> UUIDs for partitions 1,2, and 5 and for 3 (swap) i got
>> "no magic number..." and for 4 (the extended partition)
>> i got "...too short...." And the UUID for 1,2,5 was really
>> different--no obvious pattern (e.g. part of the number
>> would be the same or some incrementation...).
>>     it surprises me no end that each partition has its own
>> UUID, as i was sure the manufacturer provided this for
>> each device. if i make more partitions, something is
>> going on (with fdisk?) that creates a new UUID, yes?
>
> Jim,
>
> The UUID for a partition is generated when you create a filesystem on
> that device. So if you were to run mke2fs on one of the partitions
> again, the UUID would change. For this reason, I am not a really  
> big fan
> of using UUIDs to mount volumes. In the past I have resized partitions
> and consequently had the UUID of that partition change, and thus  
> had to
> boot off a live CD to fix the /etc/fstab entry.
>
> IMHO, it is better to use labels than UUIDs. All you have to do  
> then is
> keep the label the same if you change the partition layout. It is also
> useful if you have a lot of partitions, and forget which ones are
> supposed to be mounted where (as I do sometimes), in which case using
> descriptive labels can be very helpful.
>
> -- 
> Evan Klitzke

Hmmm, disk labels!  Perhaps that would work for me too, though I'm  
not clear on how a label gets mapped(physically) to a partition?   
Good info though.

A little background on why this topic came up...  and why I currently  
use disk UUID in my menu.lst and fstab.  I recently installed Ubuntu  
6.06 onto my IBM Thinkpad A31p laptop.  All went well until I tried  
using Ubuntu while the laptop was in my docking station.  A host of  
problems began there.  The most serious one(Ubuntu would not boot) is  
what led me to this thread and the UUID "fix", http:// 
ubuntuforums.org/showthread.php?p=1257154.

Long story short -- when out of my dock, my Ubuntu(well Kubuntu now  
but I digress) boot partition is on /dev/hda2.  That's right, I'm  
dual booting the machine with Windows(boo, hiss, still necessary).   
Anyways, when IN dock, udev and it's magic say the boot partition is  
now on /dev/hde2.  By replacing the /dev/hd*2 boot entry with UUID,  
I'm able to use a single entry in menu.lst and fstab that works,  
whether in our out of dock.  I'm skipping all kinds of info that can  
be found in the above thread if you're still curious.

BTW, Fedora Core 5 didn't have this problem(and I think now it may  
have been using disk labels) but I forget.  Anyone with an FC5 LIVE  
CD could check this.  Ubuntu 6.10 supposedly does things a bit  
differently too, so if anyone running it could tell us...

I had a few more questions around my fstab entries too(swap device / 
UUID entry, Windows partition entry, SSHFS entry...) but I'll save  
that for our next mtg or another thread.  It's been a steady stream  
of lessons getting this to work.  And it sounds like I have much more  
to learn.  Fun!

--
jt






More information about the sf-lug mailing list