Dual-booting all versions of Windows and Linux
How to Dual-boot Windows XP + Ubuntu Linux leaving GRUB in control (XP/2K installed first)
Last reviewed: September 2008
On this page:
About adding Ubuntu
This page shows how to correctly install Ubuntu (v8.04) on a computer that already has a Windows XP installed on it. A dual-boot of Windows XP + Ubuntu is created with Linux's boot manager (GRUB) in charge of the boot menu. The original Windows XP installation will remain intact (but on smaller hard disk space). No commercial utilities are required. The Master Boot Record (MBR) may, or may not, be overwritten depending on where you install Linux's boot loader (GRUB) but GRUB will be in control.
This page refers to a computer with Windows XP installed. However the original Windows can be Windows 2000 (2K).
When you then boot your computer you will be presented with a boot menu like this :
Ubuntu 8.04.1, kernel 2.6.24-19-generic
If you prefer to keep the existing Windows boot manager (NTLDR) in charge of the bootup menu instead of GRUB, then do not continue here - switch to this page
If you continue here:
A single hard disk can be used if it has sufficient space for the two operating systems plus your present and future software and data. Otherwise a second hard disk must be used. The disk is repartitioned by Ubuntu's own totally-free partition utility, GParted (it's Linux-based but at least as good as the commercial PartitionMagic). You should give serious consideration to the sizes of new partitions before you start. If using two hard disks, the second disk should be in situ before you start.
In the example shown here, a single 160 GB hard disk was used. Let's call it about 150 GB in total size after Fdisk and Format. It started with a single NTFS partition that used the entire disk, had Windows XP Pro (32-bit) installed, and 110 GB free space. You must adjust the partition sizes in this example to suit your own requirements.
Where to Install the GRUB Boot Loader
There are two locations where you can install GRUB.
The first (this is the Default) is on (hd0) which is at the start of the first hard disk. This overwrites the existing Master Boot Record (MBR) of the first disk. However, if required at a later time, the original MBR can easily be restored by using FDISK /MBR from MS-DOS or FIXBOOT from the Recovery Console (read below). The MBR on (hd0) is the most natural location for GRUB. This is THPC's preferred choice because of the simplicity of its implementation and the relative ease of rectification. Restoring/reinstall GRUB here is also quite easy.
Your second choice is to put GRUB at the start of a specific Primary partition; to put it on (hd0,Y) where Y is the partition number as seen by GRUB. In this situation the original MBR remains untouched. This option is available in the Advanced button during Ubuntu installation. Be sure you select a Primary partition and that partition does not contain another bootable operating system. (hd0,Y) must be made the Active partition ('Boot'). However if (hd0) is later made Active, then GRUB will be ignored and the Windows XP will boot again just as before you made any changes. Many users select the EXT2/3 partition and prefer this method as the MBR is not over-written. Restoring/reinstall GRUB here is marginally more difficult.
In both cases, read Remove GRUB, undo changes, and return to Windows only below to learn how to return to your original Windows-controlled system.
Summary of Procedure (Advanced users)
Finished! The GRUB boot loader menu will boot Ubuntu and Windows XP.
Preparation: Matters you must or should attend to before you start
Detailed procedure: Install Ubuntu Linux on Windows XP or 2000 (NTFS)
The existing 150 GB Primary partition will be resized to 129 GB leaving 21 GB Unallocated (free space) towards the end of the hard disk. The unused 21 GB space will initially be left Unallocated for the Ubuntu Linux installation partition (20 GB) plus its Swap file partition (1 GB). If you want a shared partition, you should allow for that when creating the partitions. All the numbers are approximates and are for example purposes only.
Finished! Both operating system will now boot from the Linux GRUB-controlled boot menu.
Remember to re-enable Virtual Memory and Hibernation when booted to Windows XP.
Remove GRUB, undo changes, and return to Windows-only
It's essential that you know how to return to your starting position in the event of a change of mind or perhaps even a mishap. The following procedure will return to your original Windows XP booting alone with the Windows boot loader (NTLDR) in control again.
Two items may need attention to achieve this.
THPC suggests you should follow the sequence shown here i.e. first correct the Active flag and the MBR if necessary and later delete/resize partitions.
How to boot directly to Windows XP when GRUB was put on (hdX,Y) and not on the MBR
In this situation the Ubuntu partition remains the Active partition irrespective of which was the last booted operating system.
The original MBR remains unchanged. Therefore, you simply need to make a Windows XP partition Active and then only Windows will boot. There are a variety of ways of achieving this.
How to boot directly to Windows XP when GRUB was put on the MBR (hd0)
In this situation the Active partition is always the Windows partition.
The aim here is to 'correct' the MBR on the first hard disk.
If the original Boot.ini file has gone 'missing', you can create a new Boot.ini by logging-on in the Recovery Console to the original Windows, and using bootcfg /rebuild at the prompt. When prompted for Load Identifier enter Windows XP 1, and for Load Options you can use /fastdetect (novices can read Bootcfg Command Usage).
How to restore or reinstall GRUB from a Ubuntu Live CD
You may for some reason wish to reinstall GRUB. GRUB can be easily returned to its original location with the following commands. It will be assumed that GRUB was installed on the MBR (hd0) of the first hard disk.
When you reboot, you will have the GRUB boot loader menu at startup.
Remember GRUB starts counting at 0
Notes for novices
Always note the sizes of partitions for accurate identification.
Please remember that you alone are responsible for the consequences of any changes you make to your computer hardware or software.
Copyright © LarryM 1998-2015 email@example.com