X
Tech

Dual-Boot Ubuntu and Windows XP Professional

I have taken the next step in setting up my Ubuntu working environment, and maintaining access to XP on my laptops for the few things that I still can only do on Windows. As always, I have started this on the older "test" laptop, a Fujitsu-Siemens Lifebook S2110, which has an AMD Turion 64 CPU.
Written by J.A. Watson, Contributor

I have taken the next step in setting up my Ubuntu working environment, and maintaining access to XP on my laptops for the few things that I still can only do on Windows. As always, I have started this on the older "test" laptop, a Fujitsu-Siemens Lifebook S2110, which has an AMD Turion 64 CPU. I kept my "primary" Windows XP disk intact, by using a second disk drive which I had previously used to test Vista and Ubuntu on that system.

My first attempt at this was to simply load XP on the disk as usual, and then boot the Ubuntu installation disk and see what it did. It came up and offered to preserve XP in its current partition, and use the rest of the disk for Ubuntu. I learned the hard way that this was not a good idea; it tries to reduce the Windows partition to exactly the size of the used space, and this seems to be too tight. After grinding on the disk for a very long time, it finally said that there had been an error in the resizing, and aborted. When I booted XP again to see if it had been corrupted, it noticed the problem and repaired the partition (back to the full size of the disk), and everything seemed to be ok again.

The next attempt I used the manual partitioning option in Ubuntu setup, and set the Windows partition to about 10 GB more than the actual used space. That seemed to go very well, and was done pretty quickly. Then Ubuntu installed itself as usual, and the next time I rebooted, the GRUB boot loader offered to boot either Ubuntu (default) or Windows XP. Wow!

As I continued setting up the Ubuntu partition, and copying over what I needed from XP, I realized that a lot of the space that was used in the XP partition was actually my photos, videos and documents. Rather than copy those onto Ubuntu, and then have to worry about keeping both up to date, I wanted to make another partition on the disk that I could access from either operating system. I didn't want to repeat the entire installation (although it goes so quickly that in the end it would have taken about the same amount of time), so I installed the Gnome Partition Editor ("sudo apt-get install gparted"), then used that to reduce the size of the Ubuntu partition, and create a new FAT32 partition. That also went smoothly, and once I had copied the Documents, Pictures and Videos from the XP partition to the new FAT32 partition, I had exactly the setup I wanted!

Now that I know a little better what I am doing, I would say that resizing and moving partitions on an existing disk is not the best way to do this. If you have another computer already running Linux, or another disk with Linux that you can swap into your computer, it would be much easier and faster to do all of the partitioning at the beginning, starting from an empty disk, and then just install things where you want them. Here are a couple of tips about doing that:

- It's best to plan for the Windows partition to be the first one on the disk. If you are working with certain Windows OEM "recovery" disks, they will only install to what they think is partition C:, which they assume is the first partition on the disk.

- When you create partitions with gparted, you can choose between Primary and Extended partitions. The only ones that really need to be primary are those where you want to boot Windows.

- Ubuntu wants to have at least two partitions to load into - one for the actual Linux file sysetm (root), and one for swap. You can either create two partitions for this, or you can create an Extended partition and then make two logical partitions inside of it (this is what the default Ubuntu installation does).

- Once the disk is partitioned, it's best to install Windows first. At least from my Fujitsu "recovery" media, installing windows always installs the standard Windows (Microsoft) boot loader, so if you install Ubuntu first, it will then overwrite GRUB and you will have to go back and repair that in order to get the dual boot working.

Now that I have this working, I'm already starting to think about doing something similar to my main laptop. But that one is actually able to run Vista (more or less), so I would like to set it up with partitions for Ubuntu, XP and Vista. My first attempts at that have run into trouble, though, because both the XP and Vista recovery disks insist on installing into the C: partition. I'll have to scratch my head over that a little more.

Editorial standards