Free Agent: Dual-Boot Basics

Linux purists may cry foul, but many of us still need to dual-boot between Windows and Linux. And while the latest Linux distributions are adept at putting themselves on a PC that runs Windows, the resulting configuration may make it difficult for you to share files between operating systems.

This month we'll look at how to make your documents easily accessible no matter which OS you're using by putting them in their own partition. We'll also address another issue that dual-booters sometimes face: what to do if a new or upgraded Windows installation takes over the boot-loading process, thereby wiping out your dual-boot ability.

Partition Planning

To install Linux on a Windows PC, you need to create two partitions to make room for it. If you have a factory-installed version of Windows on your PC, chances are it uses the whole hard disk as a single partition; this means that on a PC with a 40GB hard disk, the C:\ drive is roughly 40GB in size.

Most recent Linux distributions take this fact in stride, and allow you to shrink the Windows partition during installation to make room for Linux's main file system and swap (virtual memory) partitions. A typical Linux desktop installation requires somewhere between 2GB and 3GB of disk space these days, but can take up even more room if you select lots of the optional programs on the install discs. You can make life easier for yourself by deleting any unwanted programs and files on the Windows partition, and defragmenting it--thereby increasing the amount of free space that is available for Linux.

Getting to Your Docs

But before you install Linux, here's an important thing to consider. The default file system in Windows XP and Windows 2000 is NTFS, a system Linux knows how to read, but cannot write to. And no version of Windows can read or write to the Linux file system partitions. All this means that there's no easy way to work on documents in one OS, then boot to the other OS and continue working on the same files.

Fortunately, NTFS isn't the only Windows file system. Windows XP also supports the older FAT32 system, a holdover from Windows 98 and Windows Me that lacks NTFS's security features and is therefore readable and writable from Linux.

One simple way to make your documents fully accessible from either Windows or Linux is to put them on a separate FAT32 partition created just for that purpose. Setting up such a partition is easy if your hard disk already contains free space that isn't part of an existing partition: You can create your new FAT32 partition using the Disk Management portion of Windows XP's Computer Management console, located in Control Panel's Administrative Tools folder.

If your Windows partition takes up the whole disk, though, it won't be quite that easy. Although the Disk Management tool lets you create and delete partitions, it doesn't allow you to resize them. You can use a commercial partitioning utility like Symantec's excellent $70 Norton Partition Magic 8.0 to resize partitions without affecting partition contents (though it's always a good idea to back up the contents first).

If you don't want to spend that much to be able to resize partitions once in a blue moon, you can use Andy McLaughlin's free Partition Logic utility. This is a downloadable boot disk image that you burn to CD, and then use to boot the PC and create or resize disk partitions.

Linux pros may opt instead to boot the PC with a Linux install disc and use the GNU partition editor utility called Parted in rescue mode to resize and create partitions. The fastest way to become an expert at using the Parted tool is by reading the online documentation.

Also, if all you need to do is read files on your Linux partition from within Windows NT/2000/XP, you can skip the repartitioning altogether and simply install the Ext2 Installable File System for Windows. Note, however, that this won't let you read the contents of an NTFS partition from Linux.

Get Back to Where You Once Booted

When you install an operating system on your PC's hard disk, the process usually puts a small program called a boot loader in a reserved hard disk location called the master boot record. When the PC powers up, it launches the boot loader program stored in the master boot record, which in turn loads the operating system or offers a menu of operating system choices.

After you install Linux on your Windows system, the Linux boot loader (these days, most distributions use GRUB, the GNU GRand Unix Bootloader) replaces the Windows NTLDR boot loader. (There is a way to add your Linux installation to NTLDR using a free utility called bootpart, but I can't think of a good reason to go through the hassle).

However, if you reinstall Windows (because you're upgrading, or recovering from an incurable spyware infestation, for example), it will overwrite the Linux bootloader with NTLDR, removing the option to boot to Linux. To restore the Linux boot loader, boot the PC with a Linux installation disc and select its rescue mode. There, you can use the command-line version of the GRUB boot loader to detect the Linux partition and restore GRUB to the hard disk's master boot record, where it will be located in most dual-boot configurations.

If yours is located elsewhere, you're probably already a GRUB expert. To become one, which is not a bad idea for someone who dual-boots Windows and Linux, start with the official GRUB Manual.

If all of the above seems like kid stuff to you, see Matthew Newton's October 2004 column, in which he describes how to customize boot loader behavior using scripts.

PC World contributing editor Scott Spanbauer is sitting in for Free Agent author Matthew Newton this month.
To comment on this article and other PCWorld content, visit our Facebook page or our Twitter feed.
Shop Tech Products at Amazon