Installing Windows on a logical partition
Installing Windows on a logical partition
Some people - me included - still feel the urge to install Windows on their PC, as some smart-ass people develop Software exclusively for Windows, ignoring the Linux community. (Same applies for drivers!)
Unfortunately there is one restriction. If you've already set up your system with Linux and are just happy with it since years, you'll encounter one problem: Windows needs a primary partition.
Well, I've should have known, that this task would be such a PITA, so I could reserve a little space on the primary space - just for Windows.
Too bad, that I'm not willing to move all my partitions, just to sacrifice one figgin' big primary partition for Windows. Why can't it just live in one of those nice logical partitions?
Well, Windows can live in a logical partition - that's for sure! Here I'll explain how it's done.
If there are any questions, drop a mail to: hl.chau<nospam><at><nospam>gmx.net (Remove <nospam>, replace <at> with "@")
- I will not explain, how to create, delete, resize or move partitions. If you need help on these topics, please refer to the man pages, search for other howtos or ask some experts.
- Also there will be no instructions about how to use an hex editor.
- I assume you have enough knowledge about partitioning, numbering scemes, installing LILO/GRUB, etc. and that you are able to change the partition numbers according to your system setup
- Please make a full backup of your harddisk, or at least backup your most valuable data!
- I cannot be held responsible for any damages, caused directly or indirectly by this document. Use it at your own risk!
Windows does run on a logical partition. But it still needs a primary partition to boot from. Typically these files reside in that partition:
So the main idea is to split windows up into two partitions: The boot partition and the OS partition.
There are two variants:
- The first one is my "Quick'n'Dirty" version. Windows displays the boot partition as Drive "C:\", which is totally useless unter Windows. As no one would dare to touch these sensitive files. If someone still does, your geniune Microsoft OS would not boot anymore... The Windows itself resides under "D:\". Well pretty ugly if you ask me.
- The second is the "Real Pwned Clean WOALP (Windows-on-a-Logical-Partition)" version. Windows will still run normally, but it won't expose the boot partition to the user and even think it's running on "C:\"! So there will be no sign, that Windows is actually running on a logical partition.
Preparing the partitions
My partition table looks like this:
Device Size Type Mount /dev/hda1 64MB ext2 /boot /dev/hda5 1GB swap swap /dev/hda6 7GB ext3 / /dev/hda7 30GB ext3 /mnt/media /dev/hda8 10GB ext3 /mnt/data /dev/hda9 6GB ext3 /mnt/dev /dev/hda10 45GB ext3 /mnt/work - ~20GB - Available space
- You'll have to reduce either the boot or swap partition, in order to create a new primary partition for windows to boot (here: /dev/hda2). Remember, 8MB are already enough for Windows. In fact, the files only need about 350KB! It doesn't matter whether you use FAT or NTFS.
- Set the boot/active flag on this partition.
- For Windows itself, create another partition in the logical space. (here: /dev/hda11)
The modified partitiontable should look like this:
Device Size Type Mount /dev/hda1 56MB ext2 /boot /dev/hda2 8MB vfat /mnt/winboot ... /dev/hda11 10GB vfat /mnt/winxp
Ok, now everything's prepared for the Windows installation.
Note: But don't forget to create a GRUB floppy or burn a Linux rescue/live CD, as the Windows installer will overwrite your MBR with their geniune MBR!
Preparing your bootloader
Just add a new entry into your boot table pointing to the Windows boot partition. Here for example add these lines into GRUB:
title Windows XP rootnoverify (hd0,1) chainloader +1 boot
That does the trick...
Installing Windows XP
Next step would be installing Windows XP onto the logical partition. After the first installation process, the installer reboots your PC.
Don't let your computer boot the newly-installed bare Windows system. Put in your GRUB floppy or rescue CD, in order to boot your Linux. There reinstall your old MBR or rerun your bootloader installer.
Too bad, your new genuine MBR is lost now :(
Version 1: Quick'n'Dirty
Restart your system, and boot your Windows partition. Let the installer finish it's work and that's it! Everything's done. :)
Version 2: Real Pwned Clean WOALP
First, hide the windows boot partition (here: /dev/hda2). If you like, select any other partiton as boot/active partition. Then mount your Windows OS partition, and edit the Windows registry manually. This step is needed, so that you can change the drive letter assignments of your Windows partition. The genuine installer gave the windows partition the genuine drive letter "D:\". Well speaking about genuinity, here are the genuine instructions about the registry modification:
- Open file "/windows/system32/config/system" with your favorite hex editor;
- Replace every occurrence of "D:\" with "C:\". Be careful with this, the replacements should make sense! Like "D:\", "D:\Documents and Settings", etc.;
- Swap drive letter assignment "D:" to "C:". (Look for e.g. "\DosDevices\C:", swap with "\DosDevices\D:")
- Optionally remap other drive letters according to your preference, like remap CD/DVD-ROM from "E:\" to "D:\". But please assure, that there are no double assignments!;
Now that you've finished editing these things, unmount the partition, reboot the system, boot from the Windows partition and let it finish it's work.
And now, enjoy your genuine OS. ;)
- Some more explanations and data dumps (especially the registry)