Updated 3 March 2009 to use Ubuntu 9.04
Scenario: You have Linux already installed but want to dual boot it with Vista on the same hard drive.
Summary of tutorial: We’ll dual-boot Ubuntu 9.04 with Vista. With Ubuntu already installed and owning the entire drive we’ll use the Ubuntu Live CD to shrink the Linux partition to create space for the Vista install.
Vista’s MBR will overwrite GRUB during installation so we’ll go through two scenarios. First – reinstall GRUB to the Linux partition and use EasyBCD to modify the Vista bootloader so that it will boot Ubuntu. Second reinstall GRUB to the MBR and configure it boot both Ubuntu and Vista
This tutorial has been tested on a Sun VirtualBox 2.1.2 virtual machine.
[#PAGE-BREAK#Back up the GRUB boot menu#]
Regardless of which bootloader you end up using it’s a very good move to first back up the GRUB bootloader. It’s easy to lose it and unless you know how to re-write it from scratch then you’re generally facing a full reinstallation of Ubuntu.
Firstly boot into Ubuntu and go to Applications –> Accessories –> Terminal. Then type in sudo gedit /boot/grub/menu.lst.
This text file contains all the information GRUB uses to configure various boot options. Scroll down and the entries between “## ## End Default Options ##” and “### END DEBIAN AUTOMATIC KERNELS LIST” are the Linux boot options.
Make a backup of the file by going to File Save As and selecting a different location. Or take a full copy of the contents and place it into a new text file. If you can create the backup on a removable disk or networked location.
[#PAGE-BREAK#Make space for Vista#]
Now we need to create space on the hard drive for Vista so this will involve resizing the main Ubuntu partition. Restart the system using the Ubuntu Live CD as this gives you access to GNOME Partition Editor. When the CD loads select “Try Ubuntu without any change to your computer”.
Once the CD loads go to System Administration Partition Editor.
Right-click on the main data partition which has been formatted with ext3 – it should be /dev/sda1 – and select “Resize/Move”
Move the slider from the right to shrink the ext3 partition and create free space on the hard drive which will take the NTFS Vista partition. Make sure that the free space is sufficient to hold Vista (at least 6GB – preferably 10GB). Then click “Resize/Move” to confirm the selection and “Apply” back in the main screen to carry out the pending change.
Restart the system with the Vista DVD and select “Press any key to boot from CD or DVD” to commence the installation.
Select your installation language and then “Install now”.
When prompted for an installation type select “Custom” and click Next.
On the “Where do you want to install Windows?” page there will be an option like “Disk 0 Unallocated Space”. This is the space we created with GNOME Partition Editor.
At this point Vista can’t install to this space so we need to make a new partition and mark it active so that Vista can use it.
Press SHIFT + F10 to launch a command window then type in DISKPART and press Enter.
Select the active disk by typing in “SELECT DISK 0″.
List the partitions by typing in “LIST PARTITION”. The newly-created NTFS partition is PARTITION 3.
Select this partition by typing in “SELECT PARTITION 3″ and then type in “ACTIVE”.
This marks the partition as active. Then type “EXIT” and “EXIT” again to go back to the installation screen. Select the NTFS partition and click Next and Vista will install.
Once it’s done Vista will boot but there’s no sign of Ubuntu so we need to set up dualbooting.
[#PAGE-BREAK#Dualboot Option 1 - Vista bootloader#]
Now we need the latest version of EasyBCD by Neosmart Technologies – download it here. Install the application and launch it.
To enable access to the Linux partition the best option is to install NeoGrub. Go to “Add/Remove Entries” go the NeoGrub tab and select “Install NeoGrub”. This adds the “NeoGrub Bootloader” option to the Vista bootloader.
Once that’s done choose Configure – this launches the NeoGrub menu.lst file location at C:NSTmenu.lst. Use Notepad or Wordpad to open the file and then paste in the boot entries from the backup copy of MENU.LST you made earlier. These entries occur between “## ## End Default Options ##” and “### END DEBIAN AUTOMATIC KERNELS LIST”. Save and exit then reboot the machine.
NOTE – if you didn’t make a backup of MENU.LST or you did but it’s on the Ubuntu EXT3 partition don’t despair. Download and install EXT2IFS which allows you to mount EXT2/EXT3 partitions within WIndows. This will let you browse the contents of the EXT3 partition and extract the MENU.LST file. Word of warning though – either enable the read-only option during installation OR copy the file to the Vista filesystem rather than opening it directly from the EXT3 partition. EXT2IFS bypasses the Linux permissions so there’s a chance of damaging the filesystem.
The system will come up with two boot options. Select “NeoGrub Bootloader” and then the Linux boot options will load. Choose the relevant option and the system boot into Ubuntu.
[#PAGE-BREAK#Dualboot Option 2 - GRUB bootloader#]
To reinstate GRUB as the system bootloader it needs to be reinstalled into the MBR.
Boot the system from the Ubuntu Live CD and select “Try Ubuntu without any change to your computer”.
Open a Terminal session – Applications Accessories Terminal
To enter the GRUB configuration mode type in “sudo grub” and press Enter. Then type in the following commands in sequence:
Reboot the system. You’ll get the GRUB bootloader but Vista won’t be an option – we need to add this to the boot options.
Boot into Ubuntu and open up another Terminal session. Then type in sudo gedit /boot/grub/menu.lst
Scroll down to the bottom of the file and type in the following text strings:
title Windows Vista
Save the file and reboot. When the GRUB loader launches hit ESC for the boot menu. Windows Vista is the last option – select it and Vista will load.
If you want to make the GRUB menu always available boot back into Ubuntu and edit the MENU.LST file. Find the hiddenmenu text string and change it to #hiddenmenu.
To increase the menu timeout change the default timeout 3 to something more appropriate.