Friday, August 15, 2008

Setting Up A Dual-Boot Linux And Vista PC

After covering setting up dual-boot Dos/Linux and Vista/Linux systems (where Windows was installed first), I decided it was time to take a look at how easy it is to install Vista onto a PC where a Linux distro was already installed. Turns out it’s not all that difficult, but it’s easier if Windows is installed first.

Now, I think it’s realistic to say that there’s going to be more people who want to install linux onto a Windows PC than Windows onto a Linux system, but since a number of people contacted me privately by email asking for pointers, I still think that there’s an audience for this kind of information (most seem to want to set up Windows on a Linux PC so that they can play games on the system).

Installing vista onto a system that already has a Linux distro installed (say, for example, Ubuntu) isn’t difficult as such, but it certainly is more complicated than adding a Linux partition to a drive with Windows on it.
What you need:
OK, apart from a PC with Linux installed on it, you’ll need a disc and a GParted Live CD, or you can use the GNOME Partition Editor system application already installed with the Linux distro. For clarity and simplicity, I’ll use a GParted Live CD I have in at the PC Doc HQ. You can download the latest GParted Live CD from SourceForge (current version is 0.3.4-8).
You will also need a copy of EastBCD 1.6 in order to be able to tweak the Vista boot loader (basically it’s a GUI front end for the BCEDIT boot loader editor in Vista). This will need to be installed into Windows Vista.

The process:
OK, here’s how you set up a Linux/Vista dual-boot system where Linux is installed first:

* Boot the Linux PC using the GParted Live CD. During boot up select the auto-configuration boot option.
* Work your way through the keyboard and language settings of GParted and then once the GUI is loaded right-click on the main partition (the partition onto which Linux is currently installed, probably /dev/sda1) and choose Resize/Move.
* Next simply use the slider to allocate enough space for Windows Vista (allow at least 8GB). Once you are happy with the settings, click Resize/Move.
* Nothing has changed yet - to commit the changes to the partition click Apply.
* Once the changes have been made right-click on the partition that is just been resized and select Manage Flags. Remove the boot flag by unchecking boot and click Close (this is necessary to allow the installation of Vista because it wont install where there a bootable non-Windows partition on the drive).
* Close GParted and shut down the system.
* Remove the GParted Live CD and boot up off a Windows Vista Installation CD
* Install Vista normally. However, remember to install it onto the disk space you just freed up using GParted (it’ll show up as unallocated space, more than likely on Disk 0).
* Windows Vista will, during installation, overwrite the disk is MBR and this will mean that the GRUB boot loader will be lost. This means that once the system boots up into Windows you wont be able to find Linux anywhere. Dont panic! It is still there! What you need to do is modify the Vista boot loader to boot up Linux. On the face of it this might sound complicated, but dont worry, it is not! Start off by shutting down Windows and booting the system off a Linux Live CD corresponding to the distro you have installed (in my case, Ubuntu).
* Once the Live CD is loaded fire up a Terminal window (Applications Accessories Terminal).
* In the Terminal window type the following (which will set the user to superuser mode and launch GRUB):
sudo grub
Next find the partition where the GRUB files are located:
find /boot/grub/stage1
You will now see a reply such as (hd0,0). Set this location as root by typing the following:
root (hd0,0)
Next type the following to reinstall the GRUB boot loader:
setup (hd0,0)
Finally, exit Terminal by typing:
Make a note of the location you installed GRUB to ; you will need it when we come to use EasyBCD in a moment.
* OK, now you need to go back into Windows Vista and launch EasyBCD.
* Click on Add/Remove Entries followed by the Linux/BSD tab.
* From the Type dropdown box choose Grub. Change the default name from NeoSmart Linux to the name of the Linux distro and from the Drive dropdown box choose the partition onto which you installed GRUB earlier (more than likely it willl be Drive 0, Partition 0). When you are done click on Add Entry followed by Save.
* Restart the PC.
* The Windows boot manager will now show you two options - Windows Vista and the Linux distro.

No comments: