Grub 2 and moved sytem (rant and question)

Tom H tomh0665 at gmail.com
Fri Nov 19 07:12:05 UTC 2010


On Fri, Nov 19, 2010 at 12:41 AM, Thierry de Coulon <tcoulon at decoulon.ch> wrote:
> On Friday 19 November 2010 04:41:17 am Tom H wrote:


>>> Now to the question: does anyone know how to do with grub 2 if you move
>>> your system to another partition?
>>
>> 1. You could've found out the UUIDs of "/" and "/boot" with blkid or
>> tune2fs, run "tune2fs -U <uuid> ..." to change the UUID(s) of the new
>> filesystem(s) to the old UUIDs, and run "tune2fs -U random ..." on the
>> old filesystem(s).
>
> Hmm... but then the old system would no more boot, right? I'd prefer not to
> loose the ability to boot in the old system before I checked the copy is
> really working.

Yes; I forgot to add that you'd have to update your old install's
fstab and grub.cfg to reflect the new UUIDs. You'd have had the same
booting problem without editing "/etc/fstab".

Whether using UUIDs or "/dev" devices, there's more work to be done
than just copying a system to a new disk in order to duplicate an
install. There's more work to be done when using UUIDs but you won't
end up with the problem of having neither install being bootable if
you choose the wrong sdX for the two installs.



>> 2. You could've booted into your old install, chrooted your new
>> install, and run "update-grub".
>
> Probably, I just have no idea how to do that. Besides, why would update-grub
> have worked in the copied install but it did not in the old one (I mean, I
> was booting from mbr in the system on sda6, if update-grub did not make it
> possible to boot on sda1, would it have chaged something to run the same
> command on the same system copied on sda1? It's probably there that I don't
> understand things yet).
>
>> This isn't a grub2 problem! Had you been running 9.04 and done the the
>> same "cp" you'd have had the same issue with UUIDs.
>
> Absolutely. What is a grub 2 problem is that I don't know how and where to
> change it. You are both rght and wrong, I would not have had "the same"
> issue. As soon as I replaced grub 2 with grun legacy, my problem was gone: I
> replaced the UUIDs in menu.lst and that was it.
>
> So if the UUIDs are not a grub 2 problem, it's made to a problem by the way
> grub 2 is configured.
>
> Mark pointed me to the idea of doing what's supposed _not_ to be done, editing
> the grub.conf file, which probably would let me boot the new system. But it's
> not clear to me how to make the change permanent, would update-grub from new
> system automaticaly correct the grub settings or would I have to manually add
> the new UUIDs to the manual config?

LOL. I am right and not wrong. You would've had the same issue. If
installing grub1 fixed your problem, then re-installing grub2 would've
done the same.

update-grub works if you're booted into the install whose menu.lst or
grub.cfg you want to update.

Whether you're using grub1 or grub2, you should be able to update
menu.lst or grub.cfg with a grub-install invocation using a
"--root-directory=..." option. I prefer chrooting.




More information about the ubuntu-users mailing list