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 PC World newsletter!

Error: Please check your email address.

Struggling for Christmas presents this year? Check out our Christmas Gift Guide for some top tech suggestions and more.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World

Most Popular Reviews

Follow Us

Best Deals on GoodGearGuide

Shopping.com

Latest News Articles

Resources

GGG Evaluation Team

Kathy Cassidy

STYLISTIC Q702

First impression on unpacking the Q702 test unit was the solid feel and clean, minimalist styling.

Anthony Grifoni

STYLISTIC Q572

For work use, Microsoft Word and Excel programs pre-installed on the device are adequate for preparing short documents.

Steph Mundell

LIFEBOOK UH574

The Fujitsu LifeBook UH574 allowed for great mobility without being obnoxiously heavy or clunky. Its twelve hours of battery life did not disappoint.

Andrew Mitsi

STYLISTIC Q702

The screen was particularly good. It is bright and visible from most angles, however heat is an issue, particularly around the Windows button on the front, and on the back where the battery housing is located.

Simon Harriott

STYLISTIC Q702

My first impression after unboxing the Q702 is that it is a nice looking unit. Styling is somewhat minimalist but very effective. The tablet part, once detached, has a nice weight, and no buttons or switches are located in awkward or intrusive positions.

Latest Jobs

Shopping.com

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?