Dual booting - Windows & Linux


Dual booting - Windows & Linux




One of the major obstacles a new Linux user faces is the configuration of partitions. Windows and Linux use different notation for hard disks and partitions, which makes this task a bit daunting. Then, the user must know what partitions are and how they relate to one another. All in all, it can make a Linux newcomer hesitate a bit, especially if he is very afraid of destroying an existing Windows installation, with all his favorite documents.


Fortunately, things are much simpler than they appear at first sight.


In this article, I will try to explain how to configure a dual-boot system, running Windows XP and Kubuntu Linux. Please note that although my choice focuses on two rather popular versions of operating systems, the principle holds true for a wide range of versions and distributions with very small nuances. However, to be able to take full advantage of this article, you will need to know some things:


How to install Windows XP; See my step-by-step guide for further information.
How to install Kubuntu Linux; see my step-by-step guide for further information.
How to use VMware Player or Server and install guest operating systems in them; by reading the two articles above, you will have gained enough knowledge to attempt building and running your own virtual machines, however you might want to refer to my article VMware Player - A great friend, which explains the necessary procedures in detail.
I will install the two operating systems inside a single virtual machine. I will install Windows XP first, then Kubuntu. I will not fully detail the installation procedures; instead I will only focus on the crucial matter of partitioning and dual booting.


Getting ready
Install VMware Player / Server first.
Create the dual-boot virtual machine. Create the .vmx configuration file; you may use VMware Server or EasyVMX! online virtual machine creator. Next create two separate virtual hard disks; you may use VMware Server, EasyVMX! or QEMU emulator to create them. Personally, I find QEMU to be the most convenient choice.
Prepare your Windows XP and Kubuntu Linux installation disks; you may also use .iso files as mounted CD-ROMs for the purpose of installation, although it will be more realistic if you use CDs.
Installation setup


My virtual computer has 256MB RAM and 2 hard disks 4GB each. The question is: how do I configure the two operating systems on this machine?
Basic concepts
Imagine hard disk as an apartment. This apartment is used to store things in. Partitions are like rooms. Although they belong to the same entity, they are in fact individual storage spaces. Partitions are distinguished by different letters or names when booted in an operating system environment (you can read more in the guides above). Windows uses alphabetic letters while Linux uses a combination of letters and numbers, based on several parameters.
If you think of a hard disk as a linear storage space (i.e. one room after another in a line), partitions are segments of its length from one end to another. The first partition on any hard disk is called the primary partition. Whatever comes after the primary partition is the extended partition, which can be segmented into logical partitions. When you are booted into an operating system, the partition on which it resides becomes the active partition.
By reading my step-by-step installation guides, you will have realized that I strongly favor separating core system files from personal documents. In Linux, this is usually the default configuration - the system (root) and the personal stuff (home) are written to two separate partitions. We will also want to do this in Windows; install Windows XP on one partition and create a separate hard disk space for documents.
Furthermore, separating Windows from Linux by installing them on different hard disks is also a very good idea. This means that the chance of one operating system affecting the other is much smaller. This can be as simple as a physical failure of the hard disk or deliberate tampering with partitions.
Windows will want to be installed on a primary partition, because it wants to be near the first sector of the hard disk, the 1st sector (called Master Boot Record), where the boot information is written. Linux will want a separate partition for its installation, either primary or logical. Windows needs to be installed first, because whenever Windows is installed, it rewrites the 1st sector. This means that a Linux system already installed on the computer will not be able to boot the next time without repairing the boot sector.
Therefore, the recommended setup for Windows & Linux on a system with two hard disks should be:
Windows installed on the first hard disk, on the primary partition; one or more logical partitions can be created for personal or other data.
Linux installed on the second hard disk, preferably on the primary partition; the partitions will be created during the Linux installation setup, although they can be made beforehand.
Windows XP partitioning
Following the above guidelines, I started with Windows XP. During the partitioning phase, I made two partitions on the first hard disk, 2GB each - one for Windows and one for personal data. Just for fun, I also partitioned the second hard disk, into 3GB and 1GB partitions.






I then installed Windows XP on the highlighted partition.
Kubuntu Linux partitioning
Now comes the supposedly tricky part. After booting off the CD (which is also a live CD, by the way) and starting the installation, you will reach the partitioning stage, which scares so many people. What now?
Selecting the hard disk
As you can see, Kubuntu installer finds the two hard disks and asks us which one to choose. We could safely select the second hard disk (hdb - hard disk b), ignoring the existing partitions. Remember, we want to leave the first hard disk alone (hda).


Select Manually edit partition table and click Continue >.






The image below may seem confusing, but it is a really very simple situation map:


Windows XP is installed on the first hard disk, on the first partition - hence the notation hda1. Please note that Windows partition is active - this means it has an operating system on it.


The second partition on that hard disk is the extended partition, which can contain one or more logical partitions. Indeed, the partition table tells us that - hda2 - extended. Within the extended partition, there is a logical partition, which is currently unformatted and thus its type is unknown. It bears the hda5 symbol.


The reason for this jump from hda2 to hda5 is because a hard disk can contain no more than 4 primary partitions. Logical partitions in the extended partitions will therefore begin at number 5.
The third partition is the tiny 8MB partition for system use (the File Allocation Table - FAT, the 0th sector). Its type stands for free, meaning it has not been partitioned. This explains the hyphen in the partition name (hda-1).
By looking above the table, you can see colored bars. The first one, marked in red, denotes the NTFS partition containing Windows (note even the little Windows logo marking it). Yellow color shows how much of the space is taken. The second partition has a pale gray border, which means it has no file system. The thick blue rectangle denotes the extended partition. The last bit belongs to the FAT, marked in gray and without a border - meaning it is unpartitioned.
All of the above belongs to the first hard disk, which we are not interested in.
Nevertheless, please note how friendly Kubuntu is. It marks everything in colors and even displays a little Windows logo to keep you from doing harm.






To switch to the second hard disk, use the little drop-down button above the colored bars on the right side. Currently it reads /dev/hda. Switch to /dev/hdb.


This is the second hard disk, where we want to install Linux. We can see the partitions we created earlier, during the Windows installations.


Once again, please note the partition table and the color bars. There are no color borders, meaning both partitions are unformatted. The thick blue rectangle marks the extended partition.


For Linux installation, we will require a swap partition of at least 256MB and a root partition of at least 2GB. This means that the arbitrary partitioning we did earlier does not suit us. We will delete the existing partitions and then create our own table, as explained in the Kubuntu installation guide.






Select the extended partition by highlighting it. The grayed-out buttons on the menu above the colored bars will become active. Choose Delete to destroy the extended partition.






As you can see, the previously partitioned but unformatted space is now free. Repeat this with the primary partition (hdb1) so that all of the space is free.






Now, we will create our own setup, with swap, root (/) and home (/home). This is explained in great detail in the installation guides.






Once you are satisfied with the partitioning, click Continue > to proceed.


Our partitions need to be mounted. Again, we will follow the same principles as before.


To make our system truly dual-bootable, we need to mount our Windows partition and the Linux partitions. First, we will mount hda1, where Windows resides. Make sure you DO NOT reformat this partition!


Then, we will mount the three linux partitions, namely hdb1, hdb2 and hdb3. We will also format them. Reformat option stands for partitions that may have existed before and may have been formatted with some other file system. For best results, you should reformat them. Each partition will be formatted according to the file system you chose during their creation.


The information about these mount points will be given over to the boot loader, which will use it to prompt the user about the choices during boot up.






It's time to complete the install.
Dual booting


After Kubuntu installs and you reboot, you will enter the boot screen. By default, Kubuntu uses the GRUB boot loader. As you can see, you have the choice of booting Ubuntu (actually Kubuntu), in a number of modes, or Microsoft Windows XP Professional.






Conclusion


And that's it. You now have a fully dual-bootable machine, which runs two operating system from two separate hard disks. Furthermore, you have personal data stored on separate partitions, which keeps it immune from destruction in case the operating systems become inaccessible.


As an afternote, bear in mind that by default Linux can read from an NTFS partition, but cannot write to one. There are patches that overcome this limitation. Nevertheless, it is usually useful to create a FAT32 partition on the system to use when booted in both Windows and Linux, for exchange of files between the two. Well, now it's time you do this yourself!

Previous
Next Post »