2

I have used 10.10 and now for testing purposes installed 10.04 to a separate partition. 10.10 is currently on a single partition, while for 10.04 I decided to separate /boot to a third partition. Now my questions:

  • How can I move and merge 10.10's /boot on the new /boot partition
  • What do I have to modify to rearrange the (automatic) entries?
  • How can I have the entries contain the distribution name to reduce confusion?
  • How can I make sure the grub configuration stays identical when either distribution updates?
0

1 Answer 1

1

This is how to move the boot of your 10.10 to the separate partition:

Having /boot on its own partition is useful if you use many linux 
distributions, especially on different hard disks. Besides, if your 
root filesystem gets corrupted, you’ll still be able to boot if your /boot 
is separate.
Let’s get started.. first of all we need to create a new ext3 partition 
which will be our new /boot. In order to decide how big it should be, let’s 
see how much space our current /boot is taking up. A value of 100Mb should 
suffice for most needs (unless you’re a kernel hacker with lots of images 
in /boot):

$ du -h /boot

Once we have an idea about the size, go ahead and create the partition. You 
can use GParted… or if you prefer the command line, use mkfs:
# mkfs -t ext3 /dev/hda#
Now let’s assume that the partition you just created is /dev/hdaX (replace X 
with the actual digit). We’ll proceed as follows (prepend sudo before each 
command, or relogin as root):
1. # mkdir /mnt/newboot
2. # mount /dev/hdaX /mnt/newboot
3. # cp -dpR /boot/* /mnt/newboot/
4. # mv /boot /oldboot
5. # mkdir /boot
6. # nano -w /etc/fstab
and modify the /boot line to:
/dev/hdaX /boot ext3 ro 0 0
Note that we want /boot to be mounted read-only after the OS boot process. 
You can also delete the whole entry altogether to prevent /boot from being 
mounted.
7. # umount /mnt/newboot
8. # mount /dev/hdaX /boot
9. # nano -w /boot/grub/menu.lst
Now change the entries corresponding to your old root partition to /dev/hdaX. 
In grub’s terms, that translates to (hd0,X-1) if it’s the first hard drive. 
For eg, /dev/hda8 is (hd0,7). Note that you also need to change /boot/xxx.x 
entries to /xxx.x since the /boot partition is itself the root partition in 
grub’s eyes. For eg, /boot/grub becomes /grub. Finally, install grub onto the 
MBR. Issue:
10. # grub-install /dev/hda
(Replace /dev/hda with the /dev/… entry of the hard disk where you want to 
install Grub to).
All done! Now reboot.
P.S: Any time you want to write to /boot, do a:
$ sudo mount -o remount,rw /boot

Reference: http://tekguru.wordpress.com/2007/09/04/howto-moving-boot-to-its-own-partition/

And this is how to edit the automatic entries:

Creating the Custom Menu

The user can either edit the default /etc/grub.d/40_custom file or create a 
new one. The easiest way to create the content of a custom menu is to copy a 
working entry from /boot/grub/grub.cfg. Once copied, the contents of 
40_custom can be tailored to the user's desires.

According to the default sample custom file (/etc/grub.d/40_custom) the 
first two lines of any custom file in /etc/grub.d should be:
#!/bin/sh
exec tail -n +3 $0
The user can copy existing menuentries from the /boot/grub/grub.cfg file (...)

General menuentry Construction Rules:

The first line must start with menuentry and end with {
The area between the quotation symbols is what will appear on the GRUB 2 menu. 
Edit as desired.
The last line of the menuentry must be }
Do not leave empty spaces at the end of lines
The set root= line should point to the GRUB 2 /boot location ( (hdX,Y) )
The root reference in in the linux line should point to the system partition.
If GRUB 2 cannot find the referenced kernel, try replacing the UUID with the 
device name (example: /dev/sda6 ).
A sample entry copied from the grub.cfg and altered by the user might look 
like this:
menuentry "My Default Karmic" {
set root=(hd0,1)
search --no-floppy --fs-uuid --set cb201140-52f8-4449-9a95-749b27b58ce8
linux /boot/vmlinuz-2.6.31-11-generic root=UUID=cb201140-52f8-4449-9a95-749b27b58ce8 ro quiet splash
initrd /boot/initrd.img-2.6.31-11-generic
}

Reference: https://help.ubuntu.com/community/Grub2

3
  • I'm glad to help ;-)
    – desgua
    Apr 3, 2011 at 13:36
  • @desgua - Is this possible to do if the two versions of linux have different bit-widths, i.e., 32-bit on one partitions and 64-bit on the other? askubuntu.com/questions/97641/…
    – Huckle
    Jan 25, 2012 at 18:54
  • Unfortunately I don't know. But I will try to check it and post an answer if I find.
    – desgua
    Jan 25, 2012 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .