14.5 Preparing a Hard Disk for UseAfter you have physically installed the hard disk and configured CMOS Setup to recognize it, that drive must still be prepared before it can store data. This process requires three steps:
The following sections examine each of these steps in turn. 14.5.1 Low-Level FormattingLow-level formatting a hard drive lays down the tracks and sectors that will be used to store data and also embeds servo information that the drive head positioning mechanism uses to locate those tracks and sectors. Modern drives are low-level formatted at the factory, and cannot be low-level formatted by the user. You sometimes need to low-level format a drive, or at least to do something that resembles a low-level format. The three most common situations that require formatting a drive down to bare metal are the presence of a virus that cannot be eradicated by a logical format or by repartitioning the drive, a corrupted partition table that cannot be corrected by using a partitioning utility, and a drive that is beginning to develop bad sectors. For all these situations, the solution is to pseudo-low-level format the drive with the maintenance utility provided by the drive manufacturer. Although these utilities do not do a true low-level format, they write binary zeros to every accessible bit on the drive, wiping all data and partitions from the drive. These utilities also typically have a sector-sparing function that allows them to detect bad sectors and swap them out for a spare sector, returning that drive to its factory-fresh, error-free state. If you need to do a low-level format of your drive, download the latest version of the low-level format utility from the manufacturer's web site. Create a DOS-bootable diskette, and copy the low-level format program executable to that floppy. Boot the floppy and run the format program, carefully following all instructions supplied with the utility. Most SCSI host adapters include a low-level format utility in ROM. 14.5.2 PartitioningThe next step required to prepare a disk for use is called partitioning. Partitioning logically divides a disk into segments, each of which can be logically formatted to store data in the format, or filesystem, used by a particular operating system. 14.5.2.1 Understanding PartitioningEach physical disk must have at least one partition, and may have as many as four. Creating the first partition on a physical disk drive creates the Master Boot Record (MBR) for that disk and writes the MBR to the first physical sector. Subsequent changes to the partitioning of that disk, no matter which operating system makes them, update that single MBR. The MBR on each physical disk contains a section called the partition table. The partition table tells the computer and the operating system how the hard disk is logically divided and how to access the information stored on that hard disk. There are two types of partitions. A primary partition is one from which the computer may be booted. Each primary partition is logically formatted as a single volume for a particular operating system and is assigned one drive letter. A primary partition may occupy all or part of a physical hard drive, and a single hard drive may contain from zero to four primary partitions. The second type of partition is called an extended partition. An extended partition is essentially a virtual physical disk, which may itself be subdivided into logical volumes. A disk may contain zero or one extended partition. The computer cannot be initialized from an extended partition, although the operating system files may reside on a volume located on an extended partition. Extended partitions are neither formatted nor assigned drive letters. Instead, extended partitions are further divided, or subpartitioned, into logical volumes, each of which may be logically formatted and assigned its own drive letter. Each of these logical drives may be treated as an independent entity. You might, for example, create an extended partition, subdivide it into two logical drives, and then format one of these drives for FAT and the other for NTFS. If a physical disk contains multiple primary partitions, you may format each primary partition for a different operating system, and mark one primary partition as active, which causes the computer to boot the operating system contained within that partition. Using multiple primary partitions is one way to install and boot multiple operating systems from the same hard disk. For the system to boot from the hard disk, at least one partition must be marked active. To change which operating system boots, you must use fdisk or another partitioning utility to change the active partition. Windows NT/2000 refers to the active partition as the system partition. It contains the hardware-specific operating system bootstrap files needed to initialize the computer and begin the boot process. A disk may also contain a boot partition, which may be located on either a primary partition or on a logical volume within an extended partition. The boot partition contains the remainder of the operating system files needed to load and run the operating system. The system partition and the boot partition may be (and often are) the same partition, or they may be located in different partitions, including those located on separate physical disk drives. The system partition must be located on a primary partition, but the boot files of another operating system may share that primary partition. For example, one convenient way to dual-boot Windows 98 and Windows NT is to partition the disk with an active primary C: partition and a D: volume, which may be a primary partition or a logical drive in an extended partition. Installing Windows 98 to C: makes that volume bootable. Installing Windows NT to D: automatically installs the boot files to C:, making it the NT system partition, and installs the remainder of Windows NT to D:, making it the NT boot partition. Windows NT Setup also installs a boot manager, which allows you to choose between booting Windows 98 and Windows NT when you start the system. The advantage to implementing dual-boot this way is that you don't have to change the active partition to boot the other operating system. To summarize:
14.5.2.2 How Drive Letters Are AssignedPartitioning a disk with DOS or Windows assigns a drive letter to each primary partition and each logical volume created in an extended partition, a process called dynamic drive letter assignment. Adding and partitioning another hard disk or changing partitions on an existing hard disk may cause existing drive letters to change, which can confuse programs that expect themselves or their data to be on a particular volume and suddenly find that is no longer true. Modifying partitions under DOS or Windows 9X assigns drive letters as follows:
Assume, for example, that a computer has one physical disk, partitioned into one primary partition labeled C: and an extended partition that contains two logical volumes labeled D: and E:. If you then add a second disk and create on it a primary partition and an extended partition that contains two logical volumes, drive letters are reassigned as follows: the primary partition on Disk 0 remains C:; the primary partition on Disk 1 becomes D:; the two logical volumes on Disk 0, formerly D: and E:, are reassigned as E: and F: respectively; and the two new logical volumes on Disk 1 are assigned G: and H:. To avoid this reassignment of drive letters, do not create a primary partition on the new hard disk. Instead, partition the entire disk as an extended partition and create three logical volumes within that partition. This leaves the original C:, D:, and E: drive letter assignments unchanged, and assigns F:, G:, and H: to the three new logical volumes. The only drawback to partitioning a disk without a primary partition is that the disk can never be made bootable without being repartitioned to contain a primary partition and then reformatted. Windows NT/2000/XP partitioning works differently, because it uses both dynamic drive letter assignment and static drive letter assignment. Before you run Windows NT Disk Administrator the first time, Windows NT uses dynamic drive letter assignment to assign drive letters as described above. Disk Administrator, however, converts these dynamic drive letter assignments to static drive letter assignments, which means that adding a new disk no longer causes drive letters to be updated automatically. You can, however, use Disk Administrator to reassign static drive letters manually to partitions by using the Tools Assign Drive Letter command. You can assign any drive letter that is not already being used by a local or network drive to any partition. Don't change the drive letter assignment for the system partition, though, because many applications and services assume that the system partition is C:. 14.5.2.3 Partitioning a Hard DiskWith only minor exceptions, partition tables and partitions are completely standard. This means, for example, that DOS can access a partition created by Windows NT and vice versa. You don't have to partition a disk using the native utility of the operating system that you plan to install on that partition. In broad terms, there are three ways to partition a disk: by using the Setup program provided by the operating system, which typically invokes its native partitioning utility; by using that partitioning utility manually; or by using a third-party partitioning utility like PartitionMagic. For better control, we partition disks manually rather than allowing the operating system Setup program to make partitions for us. Setup may make the same choices about partition sizes and types that we would have made ourselves, but then again it may not. You can use the fdisk utility from Windows 9X to partition a disk that will boot Windows 9X or Windows NT/2000/XP. To do so, boot a Windows Startup Disk that contains fdisk.exe (and format.com, which you'll need later) and take the following steps:
Different versions of fdisk support some or all of these undocumented command-line switches:
The partitioning tool we use is PartitionMagic from PowerQuest (http://www.powerquest.com). In addition to standard partitioning functions, PartitionMagic does things no other partition utility we know of can do, including changing the sizes of partitions and converting a partition from one filesystem to another on the fly. If you frequently install or repartition hard disks, you need a copy of this utility in your toolkit. 14.5.3 Logical FormattingAfter you partition the disk to create logical volumes, the next step is to format each volume, which creates the filesystem structure that will organize the data stored on that volume. This logical format writes information to disk that is needed by the filesystem, including:
In the DOS/Windows 9X environment, the filesystem you create will be one of the following. 14.5.3.1 FAT16MS-DOS and the initial release of Windows 95 support only the FAT16 filesystem. FAT16 uses 16-bit addressing, which limits it to 65,536 discrete addresses. If FAT16 addressed individual sectors, it could access only (65,536 sectors x 512 bytes/sector = 33,554,432 bytes), or 32 MB. To get around this small limit, FAT addresses clusters rather than individual sectors. A cluster is a group of sectors. The number of sectors/cluster is always a power of two, is constant within a volume, and is determined automatically based on the size of that volume. Table 14-1 lists the cluster sizes that FAT16 uses for various partition sizes.
The downside to using clusters is that a cluster is the smallest addressable unit on the volume, so each file must occupy at least one cluster, and every file on average wastes half a cluster. This means, for example, that storing a one-byte file on a FAT16 volume larger than 1 GB requires 32,768 bytes of disk space, and that storing a 32,769-byte file requires 65,536 bytes of disk space. This allocated but unoccupied and unusable disk space is referred to as slack space. Large FAT16 volumes with many files have a lot of it. For example, a 1+ GB FAT16 volume with 15,000 files, each of which will average half a 32 KB cluster wasted, has (15,000 x 16,384), or 245,760,000 bytes of slack space. FAT16 is the lingua franca of DOS/Windows operating systems. Any Microsoft operating system (and many non-Microsoft ones) can read and write FAT16 volumes. Windows 95 and later and Windows NT/2000 support slightly modified versions of FAT16 called VFAT, which support long filenames. 14.5.3.2 FAT32The hard limit of 2 GB on FAT16 volume size and the huge waste on large volumes led Microsoft to introduce the FAT32 filesystem with Windows 95 OSR2. They really should have called it FAT28, because four of the 32 address bits are reserved. Using 28-bit addressing, FAT32 addresses up to 268,435,456 sectors or clusters. Addressing individual sectors, FAT32 can access (268,435,456 sectors x 512 bytes/sector = 137,438,953,472 bytes), or 128 GB. In fact, though, FAT32 does not use individual sector addressing, simply because the overhead involved in managing so many small disk space allocation units would significantly degrade performance. Instead, FAT32 continues to use cluster-based addressing, but with much smaller cluster sizes than FAT16. Table 14-2 lists the cluster sizes that FAT32 uses for various partition sizes.
The smallest FAT32 partition you can create with fdisk and format is 512MB, unless you use undocumented command-line switches, which are undocumented for good reasons. You can convert FAT16 volumes smaller than 512 MB to FAT32 by using the Windows 98 conversion utility or PartitionMagic, but there is little reason to do so because FAT32 benefits only large volumes. FAT32 also eliminates the limitation on root directory entries, which allows you to store as many files and directories in root as you wish. Standard DOS applications are still limited to accessing files no larger than 2 GB, and Win32 applications to accessing files no larger than 4 GB. There are some drawbacks to using FAT32. First, because FAT32 uses more but smaller clusters, file access on FAT32 volumes should theoretically be slower than on FAT16 volumes. We tested this by creating same-size volumes formatted for FAT16 and FAT32, restoring a standard file set, defragmenting the volume, and then running various disk benchmark programs. In each case, the performance of the FAT32 volume was 3% to 5% slower than that of the FAT16 volume. With equal volume and cluster sizes, there is little discernible difference between FAT16 and FAT32. A more important consideration for many people is that FAT32 is supported only by Windows 95 OSR 2.x, Windows 98, Windows 2000/XP, and Linux. This means that on a system that dual-boots Windows 9X using FAT32 volumes and Windows NT 4 using NTFS volumes, neither operating system can access the other's volumes. The shareware product WinImage (http://www.winimage.com) allows Windows NT 4 to open FAT32 partitions directly. Windows 95 OSR2.x and Windows 98 include FAT32-aware versions of the fdisk, format, defrag, and scandisk utilities, which can be used for either FAT16 or FAT32 partitions. Note, however, that DriveSpace3 compression does not support FAT32 partitions. The same is true of third-party disk utilities that predate FAT32. Attempting to use them on a FAT32 volume will at best not work, and may destroy your data. Most pre-FAT32 applications can reside on a FAT32 partition without difficulty, as can their data. Note that some pre-FAT32 device drivers, particularly DOS block-mode drivers like aspidisk.sys (used to access SCSI drives without enabling BIOS support) do not work properly from FAT32 partitions. To further complicate matters, Microsoft created an enhanced form of FAT32 called FAT32X to allow FAT32 partitions to extend beyond 1,024 translated cylinders, which means any drive larger than 8 GB. FAT32X partitions use a different filesystem flag in the partition table, and manipulating FAT32X partitions requires using methods that differ from those used for FAT32. The fdisk and format utilities included with Windows 95 OSR2.x and Windows 98 automatically create FAT32X partitions on drives larger than 8 GB, and most computer vendors supply systems with large drives already formatted as FAT32X. Other than the bundled DOS/Windows utilities, the only utility we know of that can manipulate FAT32X partitions is PartitionMagic 4.0+. 14.5.3.3 NTFSThe native filesystem of Windows NT/2000/XP, NTFS places effectively no limits on the sizes of partitions, volumes, and files. NTFS is faster, more robust, and more secure than any FAT filesystem. If your computer runs Windows NT/2000/XP, there are only two reasons not to use NTFS. The first is that because only Windows NT/2000/XP (and, of course, Linux) can access NTFS volumes, using NTFS in a dual-boot environment means that the other operating system will not be able to access the NTFS volumes. Second, there is a paucity of disk diagnosis and repair utilities available that are NTFS-aware. For a long time, Microsoft recommended creating a small FAT partition as the system partition from which NT would boot, and devoting the rest of the disk to one or more large NTFS partitions. Their thinking was that if there was a problem on the NTFS boot partition, you might still be able to get the system booted so that you could run a disk diagnostic utility. In practice, doing this doesn't accomplish much. A better solution is to configure the system as dual-boot, using the same operating system on both boot disks. By that, we mean that you should install your main Windows NT/2000/XP installation on one large NTFS volume, and install a second minimal Windows NT/2000/XP installation on another NTFS volume, ideally on a different physical drive. If the main installation fails to boot, you can boot to the other copy of Windows NT and use it to recover important data and configuration files from the main Windows NT installation before you attempt other recovery procedures.
14.5.3.4 Formatting with Windows 9XWindows 9X provides several ways to perform a logical format. You can use the fdisk and format utilities on a Windows 9X Startup Disk to partition and format a hard disk before installing Windows 9X. Once Windows 9X is installed, you can perform a logical format by right-clicking on a volume in My Computer or Windows Explorer and choosing Format, or by using the command-line format utility. Command-line format uses the syntax format <drive:> /switches, where <drive:> is the drive letter assigned to that volume, and the available switches that pertain to hard disk formatting are:
Unlike the Windows NT command-line format utility, the Windows 9X utility does nothing that you can't do using the graphical utilities, so there is little reason to use it. For flexibility, we prefer to use PartitionMagic to partition and format a drive before installing Windows 9X. 14.5.3.5 Formatting with Windows NT Family (NT/2000/XP)Windows NT provides several methods to perform a logical format. During Setup, Windows NT allows you to format existing or newly created volumes as either FAT or NTFS. Other than using a third-party utility like PartitionMagic, this is the only method available to format an NTFS volume before Windows NT has been installed. The format process invoked during Setup is not very flexible, so we prefer to use PartitionMagic to create and format partitions before installing Windows NT. Once a system is bootable under Windows NT, you can also perform a logical format on a disk by using the graphical Disk Administrator utility, by right-clicking on a volume in My Computer or Windows NT Explorer and choosing Format, or by using the command-line format utility. The first two methods allow you to select all format options, but limit your choice of allocation unit (cluster) size. Command-line format provides complete flexibility in choosing cluster size, and uses the syntax format <drive:> /switches, where <drive:> is the drive letter assigned to that volume, and the available switches that pertain to hard disk formatting are:
In general, there are enough potential gotchas in using nonstandard cluster sizes that you should avoid using the command-line format utility to create nonstandard cluster sizes, and instead use the default cluster size proposed by one of the other Windows NT formatting methods.
14.5.3.6 Converting a FAT16 Volume to FAT32There are few circumstances where converting an existing FAT16 volume to FAT32 makes sense, but there are a couple of ways to do it if the need arises. To use the bundled Windows 98 utility, choose Start Programs Accessories System Tools Drive Converter (FAT32). Drive Converter converts FAT16 to FAT32, but not the converse, so be absolutely sure you want to take this step before you start the program. If you change your mind later, you'll have to repartition and reformat the drive to revert to FAT16. Converting to FAT32 (or attempting to do so) may cause the following problems:
PartitionMagic 4.0 or later can convert FAT16 to FAT32 and vice versa. |