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.

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

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 News Articles

Resources

PCW Evaluation Team

Azadeh Williams

HP OfficeJet Pro 8730

A smarter way to print for busy small business owners, combining speedy printing with scanning and copying, making it easier to produce high quality documents and images at a touch of a button.

Andrew Grant

HP OfficeJet Pro 8730

I've had a multifunction printer in the office going on 10 years now. It was a neat bit of kit back in the day -- print, copy, scan, fax -- when printing over WiFi felt a bit like magic. It’s seen better days though and an upgrade’s well overdue. This HP OfficeJet Pro 8730 looks like it ticks all the same boxes: print, copy, scan, and fax. (Really? Does anyone fax anything any more? I guess it's good to know the facility’s there, just in case.) Printing over WiFi is more-or- less standard these days.

Ed Dawson

HP OfficeJet Pro 8730

As a freelance writer who is always on the go, I like my technology to be both efficient and effective so I can do my job well. The HP OfficeJet Pro 8730 Inkjet Printer ticks all the boxes in terms of form factor, performance and user interface.

Michael Hargreaves

Windows 10 for Business / Dell XPS 13

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre x360

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga 910

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?