Windows 7/Kubuntu Dual BootThe hard drive took a major dump in my laptop this weekend, left it backing up some stuff while I went to go see Tron, and when I got home it sounded like a DJ was scratching some kind of new rap tune. Needless to say, the drive was on its way out, but luckily I have been able to recover almost all of my data so far 🙂

After installing a replacement hard drive, I thought it was about time that I put a dedicated linux partition on this system as I have been using Kubuntu to do some Android development (installed via Wubi). While Wubi is nice for messing around, it isn’t the most stable system to be using and I have had a couple of disasters in the past with it messing up my virtual partitions. Wubi also has some known bugs, where after installing inside Windows, you’ll get a message about no root filesystem being defined and that you should fix it in the partition manager. Nice, if you can actually get there to do it!

So, I installed Windows 7, left 40gb of free space intentionally for Kubuntu. After the process of doing all the software installs and updates etc. for Windows I thought that I had better take a shot at installing the Linux side of things. Boy, what a mess 🙂 Firstly, there is something about the partition layout in Windows 7 that GPartEd just cannot see them (even using the GPartEd Live CD, or any LiveCD including Kubuntu). It thinks my hard drive is completely unpartitioned. Not what I was expecting, as I was hoping I could just throw some linux partitions into the free space, and then install. Very confusing 🙂 Adding any changes at this point would erase my new Windows 7 partition instantly.

I remember something a friend told me years ago about partitioning, that he had once used Linux to do the partitioning of his drives for some wierd XP install, as the Windows tools at the time were quite shit, so I figured that to get this to work the way I want it, I should probbably attempt something similar. I didnt really have much to lose (besides sitting through a few hundred megs of Windows Updates) so I went ahead and prepared the partition in GPartEd.

An important thing to remember here is the partition table. You must go into the Partition Table section and create a new ms-dos partition table, otherwise if you don’t it may try and use GPT by default (which won’t work with Windows 7). If you try to install Windows 7 without this partition type change, it will pop up a Warning message when you try to select the partition, and clicking Details will tell you that it cannot install on a GPT partition. So, after this step (which will completely zap your entire drive) I proceeded to create an NTFS partition, leaving 40gb free space for Linux later on. After applying the partition changes, booting the Windows 7 installer and installing windows by selecting the NTFS partition I just created, I was then able to reboot with a KUbuntu LiveCD and work with the free space on the drive correctly! It will even mount the Windows partition (just remember to hit Yes on the option to Unmount it duringi the Kubuntu install). Even grub works well and offers Windows 7 as an option in the boot menu.

When installing Linux with manual partitions, remember to add a swap partition at least 2x the size of the available ram in the machine, and the rest can then be an ext4 partition (that mounts to /) and thats the minimal that Kubuntu will need in order to boot correctly. Grub takes care of the rest of the issues with booting and selection etc. as most of Grub resides in the liunux part.

I am sure that several people have had problems trying to get the dual booting to work correctly, so I hope that this helps at least one human being out there who has struggled with this as long as I have.