2
June
2009

Install GRUB in its own partition0

GRUB is one of the best software to support multiple operating systems on the same computer.

The advantage of allocating a partition exclusively for GRUB is that otherwise, you would overwrite the boot loader every time you re-install the operating GRUB is associated with. GRUB, a boot loader, is by itself independent from any operating systems. That means you don’t need to run Linux on your machine to use GRUB. But since GRUB most often comes with Linux distributions, it would be easier to install GRUB along with the Linux system and delete Linux if you don’t need it.

The following assumes an empty target hard drive and Ubuntu 9.04 CDROM.

  1. Boot up with Ubuntu 9.04 CDROM. Choose to Try Ubuntu without any change to your computer
  2. Open a Terminal window, run sudo gparted.
  3. Allocate a 1 MB primary partition for GRUB. The partition size will be rounded to a cylinder boundary so it’s perfectly normal the size turns out different.
  4. Allocate another primary for Windows XP, and yet another (mount point: “/”) for Linux. Assume the names are /dev/sda1, /dev/sda2, /dev/sda3, respectively.
  5. Apply the setting and reboot the system.
  6. Boot up with Windows XP CDROM and install it in the space previously designated as /dev/sda2. You may need to delete the partition and create it again.
  7. Now that Windows XP is installed, restart the computer using the Ubuntu CDROM. Choose Install Ubuntu.
  8. When asked with partition to install Ubuntu, select Specify partitions manually (advanced) and install it to /dev/sda3. You may need to specify its mount point again.
  9. Proceed to finish installation.
  10. In Ubuntu, open a Terminal window. Run the following commands:
    sudo mount /dev/sda1 /mnt
    sudo mkdir /mnt/grub
    sudo cp /boot/grub/* /mnt/grub
    sudo grub
  11. Now, in GRUB shell, submit the following commands:
    root (hd0,0) (This is the device name of /dev/sda1, since the space partition may be called differently in other Linux systems. Notice there is no space between “,” and “0.”)
    setup –prefix=/grub (hd0)
    quit
  12. Reboot the system.

This blog article is by no means self-contained for the understanding of GRUB and its usage. The following article is a good start point, though.

Reference:
Making a Dedicate GRUB Partition

In practice, I prefer to use gparted (loaded by Ubuntu CD) to partition my hard drive first. Then install Windows before I go through the procedure of this article. Letting the installation program create the menu.lst file for you is simpler.

Related articles:
Dual Boot Ubuntu and Windows

歷年的今天…



Leave a Reply

To spammers:
Don't even bother to attempt spamming. Each comment from a new username-email combination is subject to approval before it is published.