Bootloader/Replace GRUB

Ralf Mardorf ralf.mardorf at
Mon May 13 21:31:23 UTC 2013

This one is tricky, but it does work.
I've got two SATA HDDs, Linux names are sda and sdb.
/dev/sda1 is ufs including my FreeBSD and /dev/sdb1 is ntfs including
the Windows XP install, there are many other installs, all of them are
Linux distros.
To install XP on /dev/sdb1 I had to disconnect /dev/sda1.

"With Windows

This assumes that your Windows partition is sda3. Remember you need to
point set root and chainloader to the system reserve partition that
windows made when it installed, not the actual partition windows is on.
This example works if your system reserve partition is sda3.

# (2) Windows XP
menuentry "Windows XP" {
        set root=(hd0,3)
        chainloader (hd0,3)+1

If the Windows bootloader is on an entirely different hard drive than
GRUB, it may be necessary to trick Windows into believing that it is the
first hard drive. This was possible with drivemap. Assuming GRUB is on
hd0 and Windows is on hd2, you need to add the following after set root:

drivemap -s hd0 hd2" -

So for my grub.cfg on a Linux on /dev/sdb9, resp. inside the MBR of sda,
I need to add a chainloader.

[rocketmouse at archlinux ~]$ cat /mnt/q/boot/grub/grub.cfg
set timeout=8
set default='0'; if [ x"$default" = xsaved ]; then load_env; set default="$saved_entry"; fi
set color_normal='light-blue/black'; set color_highlight='light-cyan/blue'

menuentry "FreeBSD"{
    set root=(hd0,msdos1)
    chainloader +1

menuentry "XP"{
    set root=(hd1,1)
    drivemap -s hd0 hd1
    chainloader +1

menuentry 'Ubuntu Quantal,        kernel 3.6.5-rt14' {
  set root='(hd1,9)'; set legacy_hdbias='0'
  legacy_kernel   '/boot/vmlinuz-3.6.5-rt14' '/boot/vmlinuz-3.6.5-rt14' 'root=/dev/sdb9' 'ro' 'quiet' ''
  legacy_initrd '/boot/initrd.img-3.6.5-rt14' '/boot/initrd.img-3.6.5-rt14'


More information about the freebsd-questions mailing list