Dual boot Linux, Windows

In this column we investigate installing a dual boot system using both the LILO and GRUB boot loader. A boot loader allows you to select an operating system to boot when your computer is first turned on. This article works on the assumption that you have already installed the operating systems you wish to dual boot.

Getting ready

Before setting up the dual boot system you will need to know where each operating system is located on your hard disk. Using fdisk to find this, log in as root and in a shell type:

$ /sbin/fdisk /dev/hda

If your operating systems are installed on another hard disk, substitute /dev/hda with this disk.

To display the list of partitions on this drive, type p and an output similar to the following will be displayed:

Device Boot	Start	End	Blocks	Id	System
/dev/hda1	1	96	771088+	6	FAT16
/dev/hda2	97	2646	20482875	83	Linux

This output shows that Windows is installed on the first partition and Linux on the second. We will use this scenario above as the example in the following sections. To quit fdisk, type q.

LILO

The LInux LOader (LILO) uses a configuration file named /etc/lilo.conf. If your distribution uses LILO, this file will be present. This is the LILO configuration for our dual boot system:

prompt
timeout=50
default=linux
boot=/dev/hda
linear

image=/boot/vmlinuz-2.4.18-14 label=linux initrd=/boot/initrd-2.4.18-14.img read-only other=/dev/hda1 label=win

Compare this file to the /etc/lilo.conf installed on your own system.

The first section of this file defines how LILO will operate. When editing your LILO configuration you should not need to change this section. A detailed explanation of each keyword can be found by typing:

$ man lilo.conf

The second section of the LILO configuration file defines the operating systems available to boot. This is what you need to be concerned with when setting up a dual boot system.

The ‘image’ keyword is followed by the filename of a Linux kernel. Your kernel will already be included in your /etc/lilo.conf. If you wish to boot another Linux kernel, such as one you have compiled yourself, you can add another ‘image’ entry with the new kernel file name. Each ‘image’ entry will appear as an option in the LILO menu. The ‘label’ keyword specifies a unique identifier for each kernel for use in the LILO menu.

The ‘other’ keyword is followed by a partition containing an operating system other than Linux to be booted. In our case, Windows is installed on /dev/hda1. You can add ‘other’ keywords for each non-Linux operating system. Once again, the ‘label’ keyword specifies a unique identifier. To install a LILO configuration, type as root in a shell:

$ /sbin/lilo

GRUB

GRUB is another boot loader used by many Linux distributions. The GRUB configuration file is located at /boot/grub/menu.lst. This is the GRUB configuration file for our dual boot system:

default=1
timeout=5

title Linux root (hd0,1) kernel /boot/vmlinuz-2.4.18-14 ro initrd /boot/initrd-2.4.18-14.img title Win rootnoverify (hd0,0) chainloader +1

Compare this file to the /etc/grub.conf installed on your own system. Like LILO, the first section of this configuration file defines how GRUB operates. These settings should not need to be modified to build the dual boot system.

The second section of the GRUB configuration file defines the operating systems available to boot. Each operating system is defined with the ‘title’ keyword followed by a unique identifier.

The ‘root’ keyword specifies the partition where the operating system can be found. GRUB identifies hard disks using the keyword ‘hd’ followed by a pair of integers corresponding to the drive number and partition number. For example, (hd0,0) means the first partition on the first hard disk. In our case, Windows is located at (hd0,0) and Linux at (hd0,1).

The ‘kernel’ keyword is followed by the filename of a Linux kernel. The ‘initrd’ keyword is followed by the initrd filename corresponding to the kernel.

The ‘rootnoverify’ keyword is used to specify a partition containing an unsupported operating system — in our case, Windows. The ‘chainloader’ keyword is used to boot Windows from this partition.

To install a GRUB configuration, as root in a shell type:

$ grub-install /dev/hda

Join the newsletter!

Error: Please check your email address.
Rocket to Success - Your 10 Tips for Smarter ERP System Selection
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World
Show Comments

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Sarah Ieroianni

Brother QL-820NWB Professional Label Printer

The print quality also does not disappoint, it’s clear, bold, doesn’t smudge and the text is perfectly sized.

Ratchada Dunn

Sharp PN-40TC1 Huddle Board

The Huddle Board’s built in program; Sharp Touch Viewing software allows us to easily manipulate and edit our documents (jpegs and PDFs) all at the same time on the dashboard.

George Khoury

Sharp PN-40TC1 Huddle Board

The biggest perks for me would be that it comes with easy to use and comprehensive programs that make the collaboration process a whole lot more intuitive and organic

David Coyle

Brother PocketJet PJ-773 A4 Portable Thermal Printer

I rate the printer as a 5 out of 5 stars as it has been able to fit seamlessly into my busy and mobile lifestyle.

Kurt Hegetschweiler

Brother PocketJet PJ-773 A4 Portable Thermal Printer

It’s perfect for mobile workers. Just take it out — it’s small enough to sit anywhere — turn it on, load a sheet of paper, and start printing.

Matthew Stivala

HP OfficeJet 250 Mobile Printer

The HP OfficeJet 250 Mobile Printer is a great device that fits perfectly into my fast paced and mobile lifestyle. My first impression of the printer itself was how incredibly compact and sleek the device was.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?