Search:  
Gentoo Wiki

HOWTO_Dual_boot_after_installing_Gentoo


Please format this article according to the guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article


It has been suggested that this article or section be merged into HOWTO Dual-boot when installing Windows after Gentoo. (Discuss)

Recently I had to install Windows XP on my laptop to allow me doing some Windows development work. My laptop has been running Gentoo, of course; so I already had that OS sittig on my harddrive -- read: I wanted to install Windows 'after' GNU/Linux!

As most people, I felt quite relucant backing up my entire harddrive and re-partition it, just to get bloody Windows to install.

I had the target partition for XP already set up, but XP's Setup refused to install XP in there. "Ok", I though, "you want to do it yourself". I deleted the partition inside the XP Setup, created a new one, and tried to install there. Now XP Setup was tellig me the partion layout of my harddrive was "not compatible" with XP.

To cut a long and painful story short: the reason XP refused to create a new partiton turned out to be that NTLDR can't run from an extened partition. Don't get me wrong: NTLDR can boot into an XP residing on an extended partiton, but it can't be on an extended partition itself. So what you need is a primary partition that hosts NTLDR.

My original layout was like this:

hda1 -   100 MB Primary Linux Boot         (ext3)
hda2 -     2 GB Primary Linux Swap         (swap)
hda3 -    10 GB Primary Linux System       (reiserfs)
hda4 -    88 GB Extended
  hda5 -  20 GB Logical Linux /usr         (reiserfs)
  hda6 -  10 GB Logical Linux /home        (reiserfs)
  hda7 -  30 GB Logical Linux /mnt/storage (ext2)
  hda8 -  28 GB Logical Windows XP         (ntfs)

One of the primary partitions needs to be a NTFS partition (don't use FAT32, XP doesn't like that, even though it will install everything on there you won't be able to boot into XP later).

As this partition just hosts NTLDR and the required files for booting Windows, it can be tiny. I didn't want to move or resize partions but I was out of primary partitions.

So I bit the bullet and moved my Gentoo Grub boot partition with the kernel images and Grub configuration to a logical partiton inside the extended partion at the end of my drive. This means I wasted a lot of space as the XP boot files are, as I said -- tiny -- just a few MB, and my boot partition was 100 MB. I usually have quite a few kernel images on there. :)

The new layout looks hence like this:

hda1 -   100 MB Primary Windows XP Boot    (ntfs)
hda2 -     2 GB Primary Linux Swap         (swap)
hda3 -    10 GB Primary Linux System       (reiserfs)
hda4 -    88 GB Extended
  hda5 -  20 GB Logical Linux /usr         (reiserfs)
  hda6 -  10 GB Logical Linux /home        (reiserfs)
  hda7 -  30 GB Logical Linux /mnt/storage (ext2)
  hda8 -  28 GB Logical Windows XP         (ntfs)
  hda9 - 100 MB Logical Linux Boot         (ext3)

I booted into Gentoo, created the new partitions for XP and booting Linux and copied my current boot partitons's contens into the new boot partiton at the end of my drive.

One can either create NTFS file systems for the XP- and the primary boot partitons now or do it later through the XP Setup. I created the file systems while in Gentoo -- XP sometimes leaves (or rather wastes) a tiny bit of space at the end -- mkfs.ntfs seems to always get it right.

In any case, after installing XP, one has to create an entry in the grub.conf to boot XP and you naturally have to re-write the master boot record (MBR) by re-installing Grub as XP Setup overwrites it blatantly.

This assumes one wants to boot XP through Grub. There are ways to do it the other way around, read: get a menu by modifying XP's boot.ini in your primary partition and have that point to a copy of your MBR that then executes Grub in your Linux boot partition.

However, personally, I find that one menu to select from at boot time is enough. ;)

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Dual_boot_after_installing_Gentoo"

Last modified: Thu, 03 Aug 2006 08:21:00 +0000 Hits: 4,596