O'Reilly logo

Ubuntu Hacks by Bill Childers, Kyle Rankin, Jonathan Oxer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #6. Dual-Boot Ubuntu and Windows

If you're not ready to give Ubuntu total control over your computer, you can meet it halfway. Learn how to install Ubuntu so you can dual-boot with Windows, even if Windows already owns your entire hard drive.

"Install Ubuntu" [Hack #5] details how to install Ubuntu Linux on your machine as the primary operating system. But what if you're not ready to ditch Windows, or you've got a business requirement to run a certain Windows-only application? A possible solution for you might be to enable your system to dual-boot both Windows and Ubuntu. A dual-boot system has multiple hard disk partitions or hard disks, with each partition or disk containing a complete operating system. Typically, there is a boot loader installed on the first hard disk in the system that lets you choose which operating system to boot when you power on the system.

The Dapper Drake version of Ubuntu supports setting up a dual-boot environment from within the installer. Previous versions also had this capability; however, Dapper's installer automatically shrinks your current Windows partition and makes space available for the Ubuntu installation. Prior to this feature, you had to manually shrink your current Windows partition using tools like PartitionMagic or qtparted.


There are just a couple of preparation steps that must be taken prior to setting up a dual-boot system:

  • Your current Windows partition must be freshly defragmented to ensure that there is a large, contiguous block of free space available to dedicate to Ubuntu.


There are some files that the Windows defragmentation utility can't move, so you may want to try a third-party defragmentation utility, such as Executive Software's Diskeeper (http://www.diskeeper.com/defrag.asp). However, if it's your swap (paging) file that refuses to budge, and you have sufficient memory to run without one, try disabling it (right-click My Computer, choose Properties, select Advanced→Performance→Settings→Advanced→Change, and choose No Paging File), defragmenting your hard drive using the Windows disk defragmenter, and then re-enabling the paging file.

  • You must back up any critical data you have on your Windows partition. The Ubuntu installer tries to resize your partition as safely as it can, but like any other disk utility, there is a slim chance of a loss of data. Play it safe and back up anything you can't live without.


Let's get started on the dual-boot installation. (Something to remember is that the dual-boot installation is almost like a standard installation; the major difference lies in the method the partitioner uses to partition the hard disk.) First, boot from the CD, just like a standard standalone Ubuntu install. From the installer screen (see Figure 1-1), select "Install to the hard disk," and press Enter. The installer will kick off and begin the installation.

The Ubuntu installer, beginning a dual-boot install

Figure 1-1. The Ubuntu installer, beginning a dual-boot install

You'll follow the standard installation procedure [Hack #5], up to the point when the system will ask you how you want your disk partitioned. Rather than selecting "Erase entire disk," you'll select "Resize IDE1 master, partition #1 (hda1) and use freed space," as shown in Figure 1-2.

Resizing the disk

Figure 1-2. Resizing the disk

At this point, the partitioner will ask you how much space you wish to devote to Linux. Input your desired Linux partition size in either percent or gigabytes and select Continue (see Figure 1-3).

Assigning the free space to Linux

Figure 1-3. Assigning the free space to Linux

The partitioner will then ask you to confirm your decisions, and then it will write the changes to disk. If all looks good, select Yes to proceed, as shown in Figure 1-4.

Writing the partition changes to disk

Figure 1-4. Writing the partition changes to disk

After this, the installer will actually partition the disk and format your new Linux partition as an ext3 filesystem, and then you'll be asked to enter your full name to create your Ubuntu account. From this point on, there is no difference between the dual-boot installation and a standard installation. The system will begin copying the binaries and other data from the CD-ROM, and at the end of the install, the GRUB boot loader will be written to the master boot record. The installer will prompt you to reboot, and you'll be able to select from Windows or Linux at boot time.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required