If you are like me and like to play around with different distros, while not loosing your work, you probably have a setup with several partitions. In my setup, I have Windows Vista (hey it came with the machine, not my choice!), Ubuntu 8.04.1 32 bit and Ubuntu 8.10 64-bit. I noticed that every time you install a new distro, or version of Ubuntu, the grub installation (i.e. stage2 and menu.lst) move to the last installed distro. Problems arise when you start deleting partitions that you don't use anymore. Keeping track of which menu.lst to update is quite a chore. There must be a simple solution to this. And there is, install grub on its own partition and update only the files on that partition. Mind you, this is not a bootable partition, nor does it contain images of kernels,etc.
Thanks to an excellent guide I took the big step. And it worked! Basically what you do is create a new partition and install only the grub files on it. Here's a summary of the procedure:
1. Create a new partition (using gparted, fdisk, etc)
Let's assume this partition is called /dev/sda3
2. Mount the partition on your system, for example under mnt
$> mount /dev/sda3 /mnt
3. Create a new directory called /boot on the new partition
$> cd /mnt
$> mkdir /boot
4. Copy all files from your /boot/grub to the newly created directory (with -r)
$> cp -R /boot/grub /mnt/boot
5. Use the grub tool to update the grub installation files
$> grub
grub> find /boot/grub/stage1
(hd0,2)
(hd0,5)
(hd0,6)
grub> root (hd0,2)
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,2)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.
grub> quit
In the above example you see that grub has found 3 (three) different installations of grub configuration files. Partition 3 (three) or /dev/sda3 is our target, therefore we have to use hd(0,2), because grub starts counting from 0, instead of 1.
6. Done.
Make sure you do a trial run of all operating systems to make sure they boot.
code::dive 2024 interview video posted
5 days ago
No comments:
Post a Comment