LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Grub2, moving /boot to separate partition (http://www.linuxquestions.org/questions/linux-software-2/grub2-moving-boot-to-separate-partition-909761/)

qrange 10-24-2011 03:30 AM

Grub2, moving /boot to separate partition
 
I would like to move /boot from sda4 (where / is) to sda1.
how to do that with Grub2 on Debian Testing?
thanks.

Larry Webb 10-24-2011 05:08 AM

The easiest would be with a live cd and as root from terminal

mount partition sda1 with /mnt/sda1

and run command

grub-install --boot-directory=/mnt/sda1 /mnt/sda

qrange 10-24-2011 05:40 AM

thanks.
hm, but why would I need to do it from live CD?
can't it be done from sda4?

Larry Webb 10-24-2011 06:49 AM

Here is a good tutorial that I refer to that will explain both ways.

grub2

qrange 10-24-2011 01:01 PM

well I failed. forgot to modify /boot/grub/grub.cfg

I found an interesting tutorial here for old grub: http://tekguru.wordpress.com/2007/09...own-partition/

if I simply modify the grub.cfg like he did menu.lst , would it work?

Larry Webb 10-24-2011 02:25 PM

Yes but if you run update-grub it will change grub.cfg back plus any changes in distros that you have made. When I install grub2 to a separate partition I make my own grub.cfg and then disable os-prober. One easy way is to copy your grub.cfg from the installed linux distro and paste it in your new /boot/grub partition.

I chainload my partitions so I find it easier to build my own grub.cfg.

qrange 10-25-2011 01:23 AM

hm, could update-grub automagically find sda1 partition (that has only /boot on it) and add it to grub.cfg ?
I don't understand how the system knows where / is after the commands from /boot finish.

does single menu item in grub.cfg contain both locations of /boot and / ?

syg00 10-25-2011 02:28 AM

No, the code "knows" where it was installed from - based on the parameters passed to (or defaulted) the grub-install.
After doing the grub-install from the "old" configuration you need to update fstab for the new /boot, reboot or remount /boot to sda1, then (re-)run the update-grub. Things should then all be pointing in the correct direction(s).

qrange 10-25-2011 11:33 AM

it seems I used grub-install on wrong partition.
in the end, I followed chroot method and it works.

edit: funny thing is now I have /boot/boot/grub
perhaps that was the problem.


All times are GMT -5. The time now is 01:44 PM.