How to install Gentoo in a Win XP/NT configuration
This is just a synthesis of tips and tricks I found on various websites to make this work. It may come in handy when you want to add Gentoo on a PC with only one harddisk that has XP preinstalled on a single NTFS partition. Everything here is based on Gentoo's basic installation guide which I followed religiously except for the partition numbering. Here is what I did:
- * Downsize an existing partition to make space for Gentoo
* Create logical partitions (hda5 and up) for Gentoo
* Install Gentoo without touching the Master Boot Record
* Use NT loader to choose between XP and Linux, boot Gentoo from Grub
IMPORTANT NOTE: Don't bother following these instructions if you're using a separate disk for your Linux installation. Darth_Daver's howto explains in detail how to leave the Windows disk and its NT loader untouched, and still be able to use GRUB for booting both operating systems.
Before you start, backup your system.
Until Linux support for NTFS emerges from the experimental stage that is reportedly going to kill your disk before you can say "wobble", you will need to resize the disk before you boot the Gentoo installation CD. I used Partition Magic 7.0 for that, mainly because I couldn't find anything else that could do this for NTFS partitions:
1. Resize the C: drive
PM makes this very easy, just click on the resize button and let the wizard take over. All you need to decide upon is the size of the XP partition you want to keep, everything else is automatic. You need to reboot, and the PM script then neatly reslices your disk.
2. Add a Linux partition
I tried to do this with fdisk first, but eventually had to boot back into XP and use PM because fdisk still said that /dev/hda1 was spanning the entire disk, and I didn't dare to make any changes. It is entirely possible that this is no big deal for an expert, but for me it certainly was... Anyway, in PM, I installed a Linux partition using the wizard again. PM asks you if you want to install an OS on the new partition, you have to say no to this because otherwise it will attempt to create your partition before drive C. This leaves you no choice but to make the new partition a logical drive rather than a primary one, but that's just fine.
3. Use fdisk to repartition for Gentoo
Boot the installation CD and do everything by the book. When you run fdisk, the partition table looks something like this (on my 40 GB drive it did):
Code: Select all
Disk /dev/hda : 255 heads, 63 sectors, 4865 cylinders
Units = cylinders of 16865 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 2550 20482843+ 7 HPFS/NTFS
/dev/hda2 2551 4865 18595237+ f Win95 Ext'd (LBA)
/dev/hda5 2551 4865 18595237+ 83 Linux
Code: Select all
Disk /dev/hda : 255 heads, 63 sectors, 4865 cylinders
Units = cylinders of 16865 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 2550 20482843+ 7 HPFS/NTFS
/dev/hda2 2551 4865 18595237+ f Win95 Ext'd (LBA)
/dev/hda5 2551 2563 104391 83 Linux
/dev/hda6 2564 2691 1028128+ 82 Linux swap
/dev/hda7 2692 4865 17462623+ 83 Linux
4. Configuring Grub
Completely unnecessary to do anything tricky here, just bear in mind that your partition numbers have to correspond:
Code: Select all
grub> root (hd0,4)
grub> setup (hd0,4)
grub> quit5. Prepare a bootable file for the NT loader
The NT loader is run by a script called boot.ini that's hidden in the root directory of your C: drive. To boot Linux, this script would have to call a dummy boot sector file that you need to create and copy to your C: drive. If XP was using a FAT32 file system, you could simply mount the drive and create the file at the right location (this may work in W2K if you happen to have it installed on a FAT drive), but since it's NTFS we're talking about you'll have to create the file and then see how you get it into place next time you boot XP. Do this:
Code: Select all
dd if=/dev/hda5 of=/tmp/yourfilename.bin bs=512 count=16. Copy yourfilename.bin to C:\
If you haven't forgotten to take the CD out of the tray, you will boot back into XP. Move your fresh dummy boot sector file to the Windows root directory C:\. You can probably set attributes to create this as a hidden file, but I have no idea how one does that.
One important note (added several months after writing the original text): Repeat steps 5. and 6. every time you upgrade your GRUB! It took me quite a while to understand why my boot splash window continued saying it was version 0.90 in spite of several updates I had done since then, and worse things are known to happen...
7. Edit boot.ini
You need to tell the NT loader about the new OS you've just installed, so you will:
- * Go to Control Panel, start the Performance and Maintenance tool, and then click System.
* On the Advanced tab, click Settings under Startup and Recovery.
* Under System Startup, click Edit.
Code: Select all
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(1)rdisk(0)partition(1)\WINDOWS="Windows XP Professional" /fastdetectCode: Select all
C:\yourfilename.bin="Gentoo Linux"Navigation: [prev IG1: Installation from a boot floppy HOWTO ][Installing Gentoo] [Table of Contents]
