This is only a preview of the January 2009 issue of Silicon Chip. You can view 31 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "USB-Sensing Mains Power Switch":
Items relevant to "Remote Mains Relay Mk.2":
Items relevant to "Multi-Purpose Car Scrolling Display, Pt.2":
Items relevant to "433MHz UHF Remote Switch":
Purchase a printed copy of this issue for $10.00. |
WINDOWS
OR LINUX
By Greg Swain
Dual Booting With
Two Hard Drives
Dual-boot set-up tutorials usually assume that you’re installing
the two operating systems into separate partitions on the same
hard disk drive (HDD). But what if you want to use two hard
drives – one for each OS – and keep both bootloaders intact?
D
ESPITE USING WINDOWS in
the work environment, I have
also been a long-time user of Linux
(Ubuntu) at home. Ubuntu is an easyto-use, stable operating system with
a host of applications and is great for
browsing the net (using Firefox) and
for email and instant messaging.
A big advantage of Linux is that
it’s a very secure operating system.
Certainly, you don’t have the worries
about viruses and other internet nasties that you do with Windows.
14 Silicon Chip
However, reality dictates that most
people use Windows to run critical
applications. This means that if you
want to experiment with Ubuntu, a
dual-boot system is the way to go.
Taking it easy
The most common path to a dualboot Windows/Linux system is to
install Windows first and then install
Linux onto a second partition on the
same hard drive. If you do that, the
Linux installer automatically recog-
nise the presence of the Windows
installation and includes it in the
Linux bootloader (or at least, that’s
what should happen).
After that, you simply press the Esc
key when prompted as the system
starts up to bring up the boot menu.
This allows you to select which operating system to boot. If you don’t do
anything, the system automatically
boots the default OS after a preset time.
Similarly, if you install Windows on
one hard drive and then subsequently
siliconchip.com.au
install Linux on a second hard drive,
Linux should again detect the Windows installation and automatically
set up with a dual-boot system. The
only proviso here is that the Windows
disk must remain as the primary drive
(or have boot priority in the BIOS).
Note that, in each case, the Windows
bootloader is overwritten in the master boot record (MBR) by the Linux
bootloader (known as “GRUB”) when
you install Linux. This means that if
you later reformat the Linux partition
(or remove the Linux drive), then you
will no longer be able to boot Windows
unless you reinstate the Windows
bootloader.
Fig.1: the hard
disk boot priority
(ie, if your PC has
two or more hard
disk drives) is set
up in the system
BIOS. The system
will boot from the
first drive in the
list, provided it has
a valid operating
system.
Linux first?
What if you install Linux first and
then install Windows? Unfortunately,
you don’t automatically get a dual-boot
system, since the Windows installer
will not recognise a Linux installation.
Instead, it simply replaces the Linux
bootloader in the MBR with its own
and the system then only boots into
Windows.
The way around this is to reinstate
GRUB as the system bootloader.
Just how this is done is covered in
some excellent guides on dual-boot
systems published on the APC magazine website at http://apcmag.com/
howto_home.htm
The APC guides cover all sorts of
dual-boot scenarios involving Vista,
XP and Linux – eg, Vista and Linux, XP
and Linux, and Vista and XP. It doesn’t
matter which system you install first;
the APC guides have it covered.
We don’t intend to repeat what’s
in those guides here. Instead, we will
concentrate on one dual-boot scenario
that’s not in the APC guides and that’s
where Windows and Ubuntu Linux
have been independently installed
on separate hard disk drives (ie, with
only one disk drive connected during
each install).
Why separate HDDs?
There are several reasons why you
might want to keep the two operating systems on separate disk drives.
First, while a single-disk dual-boot
Windows-Linux system works perfectly well, what if you want to later
completely blow the Linux installation (including the GRUB bootloader)
away?
As stated above, the answer is to reinstall the Windows bootloader in the
siliconchip.com.au
MBR and while it’s a straightforward
procedure, you still have to do it (and
risk something going wrong).
There’s also a risk that you might
foul up an existing Windows installation if you do the wrong thing when
installing Linux. And that can be easy
to do when it comes to altering partition sizes and formatting partitions
for the Linux installation (even with
two disk drives), particularly if you’re
inexperienced.
By far the safest route to a dual-boot
system is to install each operating
system onto its own hard disk drive,
with only one disk connected during
each install. That way, you can not
possibly foul up an existing install
ation on the other (disconnected)
drive when installing the second OS.
It also means that the bootloader for
each operating system is kept intact
on its own drive.
The basic scenario
OK, so here’s the basic scenario.
First, you’ve installed Windows Vista
(or Windows XP) on one hard drive
and got it all working correctly. You’ve
then disconnected that drive from your
computer, plugged in a second hard
drive and installed Ubuntu.
Finally, having done all that, the first
drive has then been reconnected. The
result is a machine with two hard disk
drives, one with Windows installed
and the other running Ubuntu.
Of course, it won’t be a dual-boot
arrangement but you can choose which
OS you want to boot simply by changing the hard disk boot priority order
in the system BIOS – see Fig.1. If you
give the Windows disk priority, the
system will boot into Windows. If you
move the Linux disk to the head of the
queue, the system will boot into Linux.
As indicated previously, the beauty
of this scheme is that the bootloader
of each operating system is left intact.
That means that you can remove either
disk and the operating system on the
remaining disk will boot normally.
It’s also a very safe set-up that’s easy
to convert to dual-boot.
Dual booting
Unless you rarely use one OS, having to get into the system BIOS to
change the disk boot priority is not the
way to go. Instead, it’s better to convert
the system to dual-boot, so that you
can choose which OS you want from
a boot menu.
That’s done by modifying the bootloader on one disk and giving that disk
boot priority. In other words, you can
Changing Disk Drive Boot Priority
If your PC is less than about five years old, you can change the hard disk boot order in
the system BIOS (see Fig.1). This should cater for both SATA and IDE drives (or a mixture
of both) – it’s just a matter of moving the desired boot drive to the head of the queue.
On older systems with IDE-only drives, it might not be possible to do this in the BIOS.
Instead, you will have to change the boot priority using one of two methods:
(1) plugging one drive into the primary IDE port and the other into the secondary port; or
(2) where both drives are on the same IDE cable, by changing the master/slave jumpers
on the drives (the master drive boots first).
January 2009 15
either modify the Windows bootloader
and give the Windows disk boot priority in the system BIOS, or you can
modify the Linux bootloader and give
the Linux disk boot priority.
We’ll look at both methods here but
first, be sure to back up any critical
data that you might have on the two
disks. Both dual-boot methods are
quite simple to implement but backing
up is always a worthwhile precaution,
as accidents can occur (you could drop
a disk, for example).
Using the Linux bootloader
Fig.2: setting the timeout value and commenting out the “hiddenmenu” line in
GRUB’s menu.lst file.
Fig.3: placing the Windows boot entries just above the “### BEGIN AUTOMAGIC
KERNELS LIST” entry in GRUB’s menu.lst file makes Windows the default. If
you want Ubuntu to be the default, insert the Windows entries after the “###
END DEBIAN AUTOMAGIC KERNELS LIST” line.
The easiest method is to modify the
Linux bootloader (known as “GRUB”)
and this will work equally well for a
Vista-Linux system or an XP-Linux
system. All you have to do is edit the
/boot/grub/menu.lst text file which
GRUB uses to store the boot options.
Here’s the step-by-step procedure:
STEP 1: go into the system BIOS and
give boot priority to the Ubuntu hard
disk (see Fig.1).
STEP 2: boot into Ubuntu and make a
backup copy of the GRUB boot menu.
Do this by copying the file /boot/grub/
menu.lst to an external flash drive (or
to some other location).
STEP 3: enter sudo gedit /boot/grub/
menu.lst in a terminal window and
type in the root password at the
prompt. This will open the menu.lst
text file in the gedit text editor.
STEP 4: scroll down the file and change
the timeout line to a suitable value (see
Fig.2). This value sets the boot menu
display time (in seconds) during startup. A value of 5 to 7 should be ideal
(the default is 3).
STEP 5: comment out the hiddenmenu
line by inserting a “#” character at
the start of the line (see Fig.2). This
ensures that the boot menu is shown
at system start-up.
STEP 6: scroll down and locate the line
“### BEGIN AUTOMAGIC KERNELS
LIST”. If you want Windows to be
the default, then insert the following
entries into menu.lst above this line,
as shown in Fig.3:
title
rootnoverify
makeactive
map
map
chainloader
Fig.4: this is the resulting GRUB boot menu that appears at system start-up.
16 Silicon Chip
Microsoft Windows Vista
(hd1,0)
(hd0) (hd1)
(hd1) (hd0)
+1
This adds Windows Vista to the
GRUB bootloader.
Alternatively, if you want Ubuntu
siliconchip.com.au
to be the default OS, then scroll down further and locate
the “### END DEBIAN AUTOMAGIC KERNELS LIST” entry
in menu.lst. Insert the Windows Vista boot entries after
this line (ie, the first entry is the default operating system.
If you have XP instead of Vista installed, simply change
the title line to “Microsoft Windows XP”.
Note that you should keep the Windows boot entries
out of the area between the begin and end AUTOMAGIC
KERNELS LIST lines. If you don’t do this, the Windows
boot entries will be overwritten during the update-grub
process each time the kernel is updated.
Keeping the Windows boot entries outside this area
ensures that they remain static and won’t be lost during
kernel updates (not that it’s really any great hardship to
re-enter the necessary lines).
STEP 7: save the menu.lst file, exit Linux and reboot the
machine.
That’s it – you now have a fully-functioning dual-boot
system. Each time the machine starts, the GRUB boot
menu will appear and you will be able to choose between
Windows and Ubuntu – see Fig.4.
Fig.5: managing the Vista bootloader is easy with EasyBCD.
Here’s how to install NeoGrub, to dual-boot Linux.
Breaking up is easy to do
Divorcing the two systems couldn’t be easier. As indicated previously, the bootloader on each disk is left intact,
so if you remove one disk, the system will still boot into
the OS on the remaining disk.
Of course, if you remove the Windows disk, the Windows entry will still appear on the GRUB boot menu when
you boot Linux. That can be fixed by simply deleting the
Windows boot entries from the menu.lst file.
Note also that if you change the disk boot priority in the
BIOS and subsequently make the Windows disk number
one, then the system will always boot into Windows. It
will be as though the Linux disk doesn’t exist. This means
that you must assign boot priority to the Linux disk in the
system BIOS if you want GRUB to bring up the dual-boot
menu at system start-up.
Using the Windows Vista bootloader
If you’re happy with the GRUB bootloader (and why
not?), then you don’t have to go any further. However, if
you have Vista and Linux set-ups and want to dual-boot
using the Windows bootloader, then that’s also easy to do.
Adding the Linux boot entries to the Vista bootloader is
best done using a program called EasyBCD from NeoSmart
Technologies. This freeware program has an easy-to-use
graphical interface that makes tweaking the Vista bootloader a breeze. Note: EasyBCD is for use with Windows
Vista only – it can not be used with Windows XP.
OK, let’s go through the procedure step-by step:
STEP 1: give the Ubuntu disk boot priority in the BIOS,
then boot Ubuntu.
STEP 2: enter sudo gedit /boot/grub/menu.lst in a terminal
window and type in the root password when prompted.
This will open the menu.lst text file.
STEP 3: scroll down to the end of the file and locate the
Linux boot entries between “## ## End Default Options ##”
and “### END DEBIAN AUTOMAGIC KERNELS LIST”.
Copy these entries, paste them into a new text file and
save the file to an external USB drive (eg, a flash drive).
STEP 4: exit Ubuntu, then modify the BIOS to give the
Vista disk boot priority and start Windows.
siliconchip.com.au
Fig.6: clicking “Install NeoGrub” (Fig.5) adds the NeoGrub
Bootloader under the existing Windows Vista entry.
Fig.7: you can also change various settings in EasyBCD
including the default OS and the menu timeout (seconds).
January 2009 17
Fig.8: the Ubuntu boot entries in /boot/grub/menu.lst (on the Linux disk) are
copied and pasted into the NeoGrub configuration file at C:\NST\menu.lst on
the Windows disk. This enables the Vista bootloader to dual-boot Vista and
Linux. Don’t forget to change all (hd0,0) entries to (hd1,0).
Fig.9: once it’s all working, the Vista bootloader displays the Vista and NeoGrub
boot options in the menu at system start-up.
STEP 5: download and install EasyBCD. You can grab it here: http://
neosmart.net/dl.php?id=1
STEP 6: launch the application and
click on the Add/Remove Entries
button to bring up the dialog shown
in Fig.5.
STEP 7: click on the NeoGrub tab, then
click the Install NeoGrub button. The
“NeoGrub Bootloader” entry will be
added beneath the existing “Microsoft
Windows Vista” entry (Fig.6).
STEP 8: click Configure. This creates
the NeoGrub menu.lst file in the
C:\NST folder. This file is analogous
to the menu.lst file in Ubuntu, except
that it’s initially almost empty.
STEP 9: open C:\NST\menu.lst in
Notepad and paste in the Linux boot
entries that you previously saved on
your USB drive.
STEP 10: change all (hd0,0) entries in
the menu/lst file to (hd1,0) – see Fig.8.
This is necessary since Ubuntu in now
on hard disk 1, partition 0 (as opposed
to hard disk 0, partition 0 when the
Linux drive has boot priority).
STEP 11: save the C:\NST\menu.
lst file, exit Notepad and reboot the
computer. You now have a working
dual-boot system using the Vista
bootloader.
When the machine restarts, it will
display a boot menu with two options
(see Fig.9):
(1) Microsoft Windows Vista; and
(2) NeoGrub Bootloader.
Selecting the latter will bring up the
Linux boot options shown in Fig.10.
Kernel updates
One drawback of using the Vista
bootloader is that the C:\NST\menu.
lst file will not be automatically updated if you update the Linux kernel.
This means that if you do update the
kernel, then you will have to copy
the updated boot entries from /boot/
grub/menu.lst (on the Linux drive)
to the C:\NST\menu.lst file on the
Windows drive.
Don’t forget to change the (hd0,0)
entries to (hd1,0) each time you do
this.
GRUB is more convenient
Fig.10: selecting the NeoGrub Bootloader option from the menu brings up the
Linux boot options. If no further action is taken, the default will load at the end
of the timeout period set in C:\NST\menu.lst.
18 Silicon Chip
Using the GRUB bootloader is
slightly more convenient if only because you don’t have to edit C:\NST\
menu.lst every time you do a kernel
update. The GRUB bootloader is also
slightly easier to set up but in the end,
SC
the choice is yours.
siliconchip.com.au
|