A lot of people who use Linux also dual-boot their computer to Windows. The two most worrisome parts of such a setup are partitioning the drive and configuring the boot loader. Here’s how to install Knoppix in a multiboot setup.
Installing Knoppix in a dual-boot configuration is a bit trickier than a clean install, as it requires you to resize partitions to make room for Knoppix and possibly requires you to configure your boot loader. This hack walks you through a typical Knoppix install that dual-boots with Windows. This walkthrough assumes that Knoppix is being installed on a computer with a single IDE hard drive containing a single Windows partition that fills the drive.
As in the single-boot system example (“Install Knoppix as a Single-Boot System” [Hack #41]), start the Knoppix installer with the following command:
knoppix@ttyp0[knoppix]$ sudo knoppix-installer
You are prompted to create partitions for Knoppix to install to. The entire hard drive is filled with a single Windows partition, so you have no free space to create a partition. Luckily, you can resize your Windows partition with qtparted, which can resize both FAT32 and NTFS partitions.
Resizing a partition can be risky, and there is always a potential for data loss. Before resizing any partition, defragment the hard drive completely from within Windows; otherwise, a file fragment near the end of the partition might be deleted when the partition is resized. Of course, it is always a good idea to back up any important data.
To resize your hard drive from within qtparted, select /dev/hda from the list of disks on the left side of the qtparted window, then click on the /dev/hda1 partition listed on the right side and select Operations -> Resize. In the resizing window that appears, you can decide how much free space to leave after the partition. In my experience, I’ve needed to create a root partition of 2.2 GB to have enough room for the Knoppix files, and if you install from the DVD, you will need 13 GB. In our example, resize the partition so that 2.5 GB of free space is available, so you have enough room for the 2.2 GB root partition and a swap partition. After you click OK, qtparted displays the free space you have just created in the main window. Now click on the gray free space, and create a swap partition and a 2.2 GB root partition, as covered in [Hack #41]. Once you are finished resizing, click File -> Commit to actually perform the resizing and partition creation. After you commit the changes, close qtparted to return to the main installer menu.
Depending on the type of system you have, your hard drive might be listed as /dev/sda instead of /dev/hda (this is often the case with SATA drives, for instance). If you only see /dev/sda and don’t see /dev/hda, chances are /dev/sda is the drive you want to configure.
The next step is to configure the installation by selecting a username, password, and so on. Once you are finished, click Start Installation to start copying the files to the partition. After this process, you are prompted to create an optional boot floppy, after which the installation is complete.
During the install process, Knoppix attempts to automatically detect any Windows partitions on the drive and will add them to the boot choices in /boot/grub/menu.lst. If you are multibooting with another Linux system, be aware that Knoppix overwrites your boot loader with its version of grub. To fix your menu.lst file so you can boot both your new Knoppix install and your old Linux install, finish the Knoppix install, then mount the root partition for your new Knoppix install. Then edit the /boot/grub/menu.lst file and update grub, as in “Repair Grub” [Hack #66]. Restart the computer and remove the disk from the drive, and you should see a new boot prompt with options for booting either Linux or Windows.
If you would like to change the OS from which your system boots by default, boot into your new Knoppix install and edit the /boot/grub/menu.lst file as root, changing the line that reads default 0 default 2 or whatever number your Windows partition is assigned at the bottom of the file. (Keep in mind that grub starts counting from zero, not one.)
You should now be able to boot either into Knoppix or Windows. Just as when booting from the CD, the Knoppix hard-drive install has your Windows partition icons on the desktop, allowing you to access files in the same way you are accustomed to.