LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Moving /boot to separate partition and using 'grub' to boot (https://www.linuxquestions.org/questions/linux-general-1/moving-boot-to-separate-partition-and-using-grub-to-boot-505593/)

eldiener 11-28-2006 11:25 AM

Moving /boot to separate partition and using 'grub' to boot
 
On a Linux OS ( Mepis 6.0 ) my /boot is not on a separate partition from the / partition. I have formatted a separate partition for it. I want to setup 'grub' ( I am knowledgable of how 'grub' refers to hard disk partitions' ) to boot directly into the new partition, not the MBR. What is the sequence of moving it to a separate partition ?

My understanding of the sequence is:

a) mount the separate partition
b) copy all the files and directories under the current /boot to the separate partition
c) run grub shell
1) specify correct 'root' command ( is this supposed to be the current /boot partition or the new /boot partition ? )
2) specify correct 'setup' command
3) exit grub shell
d) edit /etc/fstab and add an entry for /boot
e) edit the new /boot/grub/menu.lst and change the root command to point to the new partition.

Any help getting this sequence exactly right would be appreciated.

psisquare 11-28-2006 02:28 PM

Let me see.. I'm not exactly an expert on this, but using "info grub", I guess that

between b) and c) you have to "ln -s . /mountpoint/of/new/partition" (so that the new partition contains the file /boot/grub/stage1) and

in c.1) you have to specify the new /boot partition and

in e) you should leave root pointing to your / partition (not 100% sure of that, but you should double-check)

Also, stupid as that may sound, if you edit menu.lst in e), don't forget to mount /boot before. It' just one of those things one easily forgets. :)

eldiener 11-28-2006 03:51 PM

Corrected sequence
 
Quote:

Originally Posted by psisquare
Let me see.. I'm not exactly an expert on this, but using "info grub", I guess that

between b) and c) you have to "ln -s . /mountpoint/of/new/partition" (so that the new partition contains the file /boot/grub/stage1) and

I do not understand what that link command is supposed to do. You are telling me to create a symbolic link from the new partition mount to the current directory. How does this make the new partition contain '/boot/grub/stage1' ? Are you assuming that the current directory is the old /boot directory ?

Quote:

Originally Posted by psisquare
in c.1) you have to specify the new /boot partition and

in e) you should leave root pointing to your / partition (not 100% sure of that, but you should double-check)

I have never been able to determine exactly what 'root' in grub actually means, but I believe it means the partition in which grub is installed. Perhaps someone else knows for sure.

Quote:

Originally Posted by psisquare
Also, stupid as that may sound, if you edit menu.lst in e), don't forget to mount /boot before. It' just one of those things one easily forgets. :)

I think you mean that my new partition must be mounted and that I must modify the menu.lst in the new partition and not in the old /boot area. I think it is irrelevant whether or not the new partition is mounted as /boot or something else as long as I am changing the correct menu.lst.

bigrigdriver 11-28-2006 04:16 PM

'root' will not change, only the location of the boot image and initrd will change (the new /boot partition).

Here is an example for /boot/grub/menu.lst:

title Linux
kernel (hd0,6)/vmlinuz root=/dev/hda4 vga=0x31a selinux=0 splash=verbose
initrd (hd0,6)/initrd

Notice that kernel and initrd are directed to one partition (new /boot in this example), and root=/dev/hda4 is the location (partition) of the root of the filesystem. Be careful to get the names correct for vmlinuz and initrd.

Edit /boot/grub/menu.lst to show the new location for /boot, then edit fstab to show the new partition.

psisquare 11-28-2006 08:01 PM

Quote:

Originally Posted by eldiener
You are telling me to create a symbolic link from the new partition mount to the current directory.

Sorry, the correct command should be "ln -s . /mountpoint/of/new/partition/boot" (forgot the last /boot).

In either case, you are not creating a link to the current working directory, because soft links are always taken relative to their parent directory (here: /mountpoint/of/new/partition). The effect will be that your new partition contains the link "boot" pointing to the root directory of that same partition.
Because grub accesses the partition directly (instead of via Linux's virtual file system), this link will make sure it sees the "/boot/grub/*" files (imagine the new boot partition to be mounted as / if that helps you). Without the link, grub would only see "/grub/*", because it doesn't know that the partition will be mounted to /boot.

Quote:

Originally Posted by eldiener
I think it is irrelevant whether or not the new partition is mounted as /boot or something else as long as I am changing the correct menu.lst.

Yes, of course you are right.


All times are GMT -5. The time now is 07:02 AM.