Install Windows on a computer that has Ubuntu on it

The Ubuntu installer is fully capable of squeezing Ubuntu onto a computer that has Windows on it. What about the other way around? What if Ubuntu is the only operating system that's installed and you want to install Windows alongside?




GParted Edit View Device

Partition Help

New; Delete 1 Resize/Move

Copy Pasts 1 Ur

do Ap-pfy

Q/dev/sda (19.99 GiB) i

/dev/sdal 16.03 GiB

unallocated 3.96 GiB

Partition Filesystem




unallocated ■unallocated

16.03 GiB 3.96 GiB

6.65 GiB

9.39 GiB boot

0 operations pending

Figure 3.56: Resizing the Ubuntu partition to make space for Windows (see Tip 303, on the preceding page)

Here's how it's done—these steps tell you how to make space for Windows, install it, and then repair the boot loader so that Ubuntu can once again boot:

1. Boot from your Ubuntu installation CD/DVD and select the Try Ubuntu... option from the Ubuntu installer boot menu. Once Ubuntu is up and running click System ^ Administration ^ Partition Editor. This will start the Gparted partitioning tool.

2. Right-click the Ubuntu partition (it will be the largest in Gparted's display) and click Resize/Move. In the dialog that appears, click and drag the right-hand edge of the partition so that the Ubuntu partition shrinks to make space for Windows. About 3-4GB should be enough, depending on your needs. Click the Resize/Move button. Then click the Apply button in the main Gparted window. Once resizing is complete, you should see that Gparted now indicates an "unallocated" area to the middle-to-right of the disk display, similar to that shown in Figure 3.56.

[ Minimal BASH-like line editing is supported. For the first word. TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ]

grub> find /boot/grub/stagel ( grub> root fhd0,0)

grub> setup [hdHJ Checking if "/boot/grub/stagel" exists... yes Checking if B/boot/grub/stage2" exists... yes Checking if M/boot/grub/e2fs_stagel_5' exists... yes

Running "embed /boot/grub/e2fs_stagel_5 (hdal"... 16 sectors are embedded, succeeded

Running "install /boot/grub/stagel fhdQ) (hd0)l+16 p (hd0,0)/boot/grub/stage2 /boot/grub/menu-lst"... succeeded □ one.

grub> quit|

Figure 3.57: Restoring the Ubuntu boot loader (see Tip 303, on page 351)

3. Reboot the computer using your Windows installation CD/DVD and install Windows as you would normally, on a blank hard disk, but with one caveat—select the Unpartitioned Space option when prompted where on the disk you want to install Windows. Be careful you select it again after creating the partition—it will probably be identified as Partition 3 [New (Raw)]. You'll be warned the other operating system on the disk must be marked inactive. This is fine.

4. once Windows installation has completely finished and the Windows desktop appears, reboot from your Ubuntu installation disk. You'll now need to restore the Ubuntu boot loader (you'll no longer be able to boot your Ubuntu installation on the hard disk, but don't worry—it's still there!). select the Try Ubuntu... option on the menu. Once the Ubuntu desktop appears, open a terminal window (Applications ^ Accessories ^ Terminal). Then type the following: $ sudo grub grub> find /boot/grub/stagel

You will see something like (hd0,0). Using this information, type the following (see Figure 3.57 for an example): grub> root (hd0,0)

grub> setup (hd0) grub> quit

Replace (hd0,0) with the details you discovered earlier, if applicable.

5. When you reboot, the Ubuntu boot menu will be back but you now need to add an entry for Windows. choose to boot Ubuntu and, once the desktop appears, open a terminal window. Type gksu gedit /boot/grub/menu.lst. At the bottom of the file, below the line that reads ### END DEBIAN AUTOMAGIC KERNELS LIST, type the following (this assumes that, as described above, you created the Windows partition in the middle of the disk, in-between the Ubuntu main and swap partitions):

title Boot into Windows rootnoverify (hd0,1) makeactive chainloader +1

6. You'll also need to change two lines at the top of the file—put a hash before the line that reads hiddenmenu on its own, so that it now reads #hiddenmenu. Then change the line that reads timeout 3 to read timeout 10 (the number of spaces between timeout and the number don't matter). Then save the file and reboot. You should find that there's now a Windows entry on the boot menu.

Was this article helpful?

0 0

Post a comment