Ubuntu - disk management behaviour
g.lip at gmx.com
Fri Jul 22 05:25:26 UTC 2011
On Fri, 22 Jul 2011 12:58:34 +0800, Daniele Guerrieri
<d.guerrieri at gmail.com> wrote:
> yes, my bad
> in fact i was confused, but also an usb live key needs to be bootable
> when the drive letter changes (once sda, another time sdb), probably
> in the boot loader installed onto usb key there's uuid too;
> But if i look in grub.cfg i see:
> . set root='(/dev/sdb, msdos1)'
> . search --no-floppy --fs-uuid --set=root
> Why does set root before searching with uuid?
Good question! To help with this, let me start by saying you can remove
this line "set root='(/dev/sdb, msdos1)'" and it will boot okay. In fact
you can even use the wrong partition number, say in this example,
'(/dev/sdb, msdos2)' or '(/dev/sdb, msdos3)' and it will still boot okay
*as long* as the "search --no-floppy --fs-uuid --set=root xxxxxxx" line is
below it. So if your bios gives it the wrong (/dev/sdx, msdosy), it will
still boot okay. I hope this explains why you will still boot okay with
grub2 as long as the search line uses uuid or label.
By the way I uses my own grub (grub2) and it never contains the "set
root='(/dev/sdx, msdosy)" line.
>> Yes, that's how it is, but that is due to the bios rather than grub and
>> that's why the grub2 >menu entries always use uuid so the boot is
>> always correct (unless you manually modify it >to /dev/sdxy and
>> (hdx,y), which you shouldn't). But if want to manually modify, use uuid
>> or >label.
> Ok, The uuid does not change if external changes occur, isn't it?
> For example, if i had boot partition on sda7, then i decided to remove
> sda2 (should i do it from a "live" usb system or may i do it from the
> "installed" system itself? i think it's better not to reorder
> partitions while running, or at least partprobe won't return 0, am i
> correct?), and subsequently i fixed partition order, the boot
> partition would become sda6; in this case, the uuid will remain the
> same so that i wouldn't have boot issues?
Doing the above (removing sda2) will not change the uuid for sda7, so it
will boot alright. Furthermore, (but I don't think that's relevent for
this discussion of grub/booting), sda7 will remain sda7 (not sda6) even if
you remove sda2, you'll just have a missing sda2! UUID will not change
even with resizing the partition (though I think it not wise as the first
sector may be corrupted and it takes a long time); UUID only changes with
deleting/creating a new partition.
Hope this helps.
Regards - Goh Lip
> Thank you both for the answers!
I used to have an open mind,
but my brains kept falling out.
More information about the ubuntu-users