2.4 Preparing Your Hard DiskTo prepare your hard disk for installing Linux, you must allocate the space in which Linux will reside. You'll learn how to do so in this section. First, I'll explain how hard disks are organized, followed by how to view the structure of a hard disk. Finally, I'll describe how to alter, or partition, the structure of your hard disk in preparation for installing Red Hat Linux. 2.4.1 How Hard Disks Are OrganizedLet's start by reviewing facts you've probably learned by working with Windows. Most operating systems, including Windows 95/98, 2000, and XP, manage hard drives by dividing their storage space into units known as partitions. So that you can access a partition, Windows associates a drive letter (such as C: or D:) with it. Before you can store data on a partition, you must format it. Formatting a partition organizes the associated space into what is called a filesystem, which provides space for storing the names and attributes of files as well as the data they contain. Windows supports several types of filesystems, such as FAT, FAT32, and NTFS. Partitions comprise the logical structure of a disk drive, the way humans and most computer programs understand the structure. However, disk drives have an underlying physical structure that more closely resembles the actual structure of the hardware. Figure 2-6 shows the logical and physical structure of a disk drive. Figure 2-6. The structure of a hard diskMechanically, a hard disk is constructed of platters that resemble the phonograph records found in an old-fashioned jukebox. Each platter is associated with a read/write head that works much like the read/write head on a VCR, encoding data as a series of electromagnetic pulses. As the platter spins, the heads record data in concentric rings known as tracks, which are numbered beginning with zero. A hard disk may have hundreds or thousands of tracks. All the tracks with the same radius are known as a cylinder. Like tracks, cylinders are numbered beginning with zero. The number of platters and cylinders of a drive determine the drive's geometry. Some PCs require you to specify the drive geometry in the BIOS setup. Most modern PCs autodetect the drive geometry but let you specify a custom value if you prefer. Most operating systems prefer to read or write only part of a track, rather than an entire track. Consequently, tracks are divided into a series of sectors, each of which holds a fixed number of bytes, usually 512. To correctly access a sector, a program needs to know the geometry of the drive. Because it's sometimes inconvenient to specify the geometry of a drive, some PC BIOS programs let you specify logical byte addressing (LBA). LBA sequentially numbers sectors, letting programs read or write a specified sector without the burden of specifying a cylinder or head number. 2.4.2 Viewing Disk PartitionsThe first step in preparing your hard disk is viewing its partition information. Once you know how your hard disk is organized, you'll be able to determine how to reorganize it to accommodate Linux. To view the partitions that exist on your Windows 95/98 hard disk drives, you can use the fdisk utility. If your system runs Windows 2000 or XP, you must use the Disk Management tool, which resides within the Computer Management folder of the Administrative Tools control panel applet. 2.4.2.1 Using fdisk (Windows 95/98)
2.4.2.2 Using the Disk Management tool (Windows 2000/XP)To use the Disk Management tool, click Start Control Panel Administrative Tools Disk Management. The tool graphically depicts your system's drives and the partitions and free space they contain, as shown in Figure 2-9. Figure 2-9. The Disk Management tool2.4.3 Obtaining Sufficient Disk SpaceLike Windows, Red Hat Linux requires special partitions on which to store its filesystems and swap data. You must devote two—or preferably three—partitions to Linux. By viewing the partitions on your hard drive, you can determine which of the following two cases best describes your system:
If you're unsure whether your free space satisfies these criteria, simply begin the installation; the installation program will notify you if it is unable to proceed. In that case, you can return to this chapter to learn how to gain or add additional disk space. 2.4.3.1 Installing a new disk driveOften, the easiest way to install Linux is to install a new disk drive. If your system has only a single hard drive, you can probably install a second drive and place Linux on the new drive. Before purchasing a drive, you should make sure that the system provides room to mount the new drive and that you have the proper data and power cables. Be sure to install both disk drives on the primary disk controller so they can be booted; if you have an IDE CD-ROM drive, you should move it to the secondary controller. If your system already has two disk drives, you probably can't simply add a third disk drive: the BIOS of most PCs lets you boot the system from only the first or second hard drive on the primary controller. In such a case, you can probably replace one of your existing drives with a larger drive adequate to support your existing needs and Linux. 2.4.3.2 Identifying an unused partitionYou can use the drive letter information provided by fdisk to examine the contents of a partition in the Windows Explorer. If you can find a partition that holds no useful data but is large enough to accommodate the type of Linux installation you want, you can delete the partition and use the free space to hold Linux. At least 75 MB of the unused partition should reside within the first 1023 cylinders of the drive; otherwise, you will have to use a boot floppy to load Linux.[3]
The easiest way to delete a partition is to start installing Red Hat from the disks in this book, and then request deletion of the partition when the installation program gives you the opportunity. Make note in Table 2-1 of the partition you wish to delete and then begin the installation process described in Chapter 3. 2.4.3.3 Shrinking a partitionEven if all of your partitions contain useful data, one or more partitions may be larger than required. In that case, you can reduce the size of each such partition and reorganize the drive to include contiguous unused space to hold Linux. Again, at least 75 MB of the unused space should reside within the first 1023 cylinders of the disk drive; otherwise, you'll have to use a boot floppy to load Linux. You can use the Windows Explorer to determine the amount of free disk space in a partition. Simply right-click on the drive icon and click on Properties in the pop-up menu. The Properties dialog box shows the amount of used and free disk space associated with the drive. If you are able to find one or more FAT or FAT32 partitions that have sufficient free space for a Linux installation, you can use a special utility to split the used and unused portions of a partition into separate partitions. Disc 1 of Red Hat Linux includes the unsupported fips utility, which can split FAT and FAT32 partitions. For information on using fips, see the documentation in the dosutils directory of the CD-ROM.
Many Linux users find commercial partitioning tools—such as PowerQuest's PartitionMagic or VCOM's Partition Commander—helpful. Both tools are relatively inexpensive (approximately $40-$70) and support partition types and operations not supported by fips. For example, they can split NTFS and Linux ext3 partitions. This is important, because you may not initially create Linux partitions of exactly the right size. Using fips, you'd be stuck; but, using PartitionMagic or Partition Commander, you can change your system's partition structure as many times as you like until you get it just right. For information on PartitionMagic, see the PowerQuest web site at http://www.powerquest.com/partitionmagic. For information on Partition Commander, see the VCOM web site at http://www.v-com.com/product/pc_ind.html.
|