Am Freitag, den 02.07.2010, 13:38 +0200 schrieb splotz90:
> Am 01.07.2010 22:29, schrieb Andrew Benton:
> > Which partition will grub choose?
> I have found some additional information about that:
> 
> http://www.linuxquestions.org/questions/linux-software-2/how-does-grub2-find-the-grub-cfg-file-794560/
> 
> The "grub-setup" command seems to add an information where to find the 
> grub.cfg right after the MBR.
> 
> 
> Sebastian
I did some testing in a virtual machine (if someone is interested in
it):

Here are my partitions:

/dev/sda1 --> Ubuntu 10.04 (with /boot on it)
/dev/sda2 --> swap
/dev/sda3 --> empty ext4 partition

First I've mounted /dev/sda3 over /boot and installed the GRUB files on
it:

mount /dev/sda3 /boot
grub-install --grub-setup=/bin/true /dev/sda

After that I've mounted /dev/sda3 under /media and copied the existing
grub.cfg:

umount /dev/sda3
mount /dev/sda3 /media/sda3
cp /boot/grub/grub.cfg /media/sda3/grub

I removed the Memtest menu entry's from the grub.cfg on /dev/sda3 (now,
there is a difference between both files).

Finally:

grub-setup -r \(hd0,3\) /dev/sda

But after a reboot:

error: file not found
grub rescue >

So I reinstalled GRUB with help of the Ubuntu CD. After rebooting my
system I tried this:

mount /dev/sda3 /boot
grub-setup -r \(hd0,3\) /dev/sda

And I got grub.cfg from /dev/sda3! :-)

So I think that grub-setup writes the following information to a place
right after the MBR:

- on which partition grub.cfg can be found
- in which folder grub.cfg can be found (/grub or /boot/grub)

If I want my old grub.cfg from /dev/sda1, I just need to reinstall GRUB
with:

grub-setup -r \(hd0,1\) /dev/sda

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to