'; window.popUpWin.document.write(zhtm); window.popUpWin.document.close(); // Johnny Jackson 4/28/98 } //--> Windows 98 Professional Reference -- Ch 17 -- File Systems: File and Disk Resources


Windows 98 Professional Reference

Previous chapterNext chapterContents


- 17 -
File Systems: File and Disk Resources



When you think about it, you'll probably agree that the disk subsystem is one of the most important systems in any computer. Not only is it intimately involved in the operation of the system (although the same can be said of the processor, memory, and video adapter), it's the component responsible for storing all the work product generated on most systems. Its health is therefore vital to avoid data loss.

In this chapter, you learn all about Windows 98 disk and file systems. You learn about the underlying technology and design of disk and file systems and about how to use and maintain them.

Exploring Hard Disk Drives

Hard disk drives are hermetically-sealed devices that contain a number of platters, which spin rapidly when the drive is powered up. (It's been said that if you were to remove a platter while it was spinning and put it on its edge on the ground, it would go about 60 to 100 mph.) Different disks have different numbers of platters. All platters spin on a common spindle. Each platter has its own read/write head, which "floats" a small distance over the platter surface when the disk is operating. The distance the read/write head floats above the platter is about one-quarter the diameter of a human hair. Platters are rigid, usually made out of aluminum or glass, and coated with a magnetic material and other layers that give them the capability to store magnetically encoded bits of data.

Each platter has a number of tracks. Each track is divided into sectors, which are always equivalent to 512 bytes of data. An individual track (for example, track 23) on all the platters together is called a cylinder.

A specific area of the hard disk drive is addressed using a combination of three values: cylinder, head (platter), and sector. For example, cylinder 46, head 2, sector 231 refers to a single 512-byte sector within a hard disk drive.

Different hard disk drives have different geometries, which is the arrangement and number of platters (heads), cylinders, and sectors. The values for a particular hard disk drive are stored in the computer's CMOS.


TIP: To calculate the maximum theoretical capacity for a drive, simply multiply the number of heads by the number of cylinders by the number of sectors per track by 512 bytes per sector.


Understanding Partitions

Individual hard disk drives can be divided into partitions, which are logical subdivisions of the hard disk device. Each hard disk drive can have up to four partitions. A partition can be either primary or extended. A hard disk can have up to four primary partitions, although only one primary partition can be active at a time. Extended partitions are made up of logical drives, which are distinct hard disk letters that appear for the operating system. A hard disk can have only one extended partition. Typically, hard disks that result in multiple drive letters are configured with a single primary partition and a single extended partition, with the extended partition containing from one to many logical drive letters. (You can have any number of logical drives within an extended partition; in reality, you are limited to the number of available drive letters, up to the letter Z.)

Suppose that you are setting up a hard disk and want to divide it in such a way that you end up with four drive letters, from C to F. You create a single primary partition (Windows 98 can boot and run only from a primary partition) that is the size needed for the C drive. You also create a single extended partition, which has three logical drives created within it, each logical drive being the size needed for drive letters D, E, and F.


NOTE: For a secondary hard disk drive (one that does not have to boot an operating system), you can configure the hard disk to consist of a single extended partition made up of one or more logical drives.


Partitions under Windows 98 are set up and maintained using a program called FDISK (short for Fixed Disk Setup Program). FDISK lets you view your current partition arrangement and also delete and create partitions.

Partition data for a hard disk drive is stored as part of the Master Boot Record (MBR) located at cylinder 0, head 0, sector 1. A 64-byte section of the MBR contains the partition configuration for the hard disk. Each partition is defined by a 16-byte entry (which means that there can be no more than four partitions, because 16 bytes times four partitions is 64 bytes). Within the MBR sector, the partition data is stored starting at decimal offset 446 and uses up the remainder of the 512-byte MBR sector (the last 2 bytes are not related to the partition data, but are the end-of-sector marker, which is always 0x55AA).

Each 16-byte partition table entry is arranged as follows:

Logical drives store their partition data somewhat differently than primary and extended partitions. What happens is this: An extended partition entry in the MBR partition table indicates the extended partition's first sector, which is the location of the first logical drive in the extended partition (an extended partition must contain at least one logical drive if it is to function). The first sector of the first logical drive stores another partition table. This logical drive partition table is stored in the last 64 bytes of that first sector (leaving 2 bytes for the end-of-sector marker) arranged just like the main partition table in the MBR. However, the logical drive's partition table contains only two entries: The first entry contains the configuration for that logical drive, and the second entry contains the configuration of the next logical drive. Entries three and four are empty and are not used. The second entry points to the next logical drive, which again contains its own logical drive partition table, and so forth. As you can see, logical drives within an extended partition are therefore defined by this linked list of partition tables, each one pointing to the next.

Understanding FAT

Any operating system relies on one or more file systems, which are the methods used to store files on storage devices. There are many different kinds of file systems, such as FAT, New Technology File System (NTFS), High Performance File System (HPFS), CD-ROM File System (CDFS), and so forth. Windows 98 can use four different file systems: FAT16, FAT32, CDFS, and Universal File System (UFS) for DVD-ROM drives. Most of the following discussion about FAT concerns FAT16--differences between FAT16 and FAT32 are discussed in the following section.

FAT stands for File Allocation Table, a method for storing files and file directories on a hard disk. FAT has a long history, being used first under MS-DOS. Through a variety of techniques, including the new FAT32 variant, FAT has been extended and improved over the years.

A FAT-formatted volume is arranged starting with a Partition Boot Sector, followed by two identical copies of the FAT (FAT1 and FAT2), the root directory listing, and then the remainder of the volume. Two copies of the FAT are stored in case one is damaged.

The Partition Boot Sector contains the information needed to boot an operating system (if the partition is a primary partition intended for that purpose). The data in the Partition Boot Sector is described in the following chart.

Bytes Description
3 Jump instruction
8 OEM Operating System name in text format
25 BIOS Parameter Block
26 Extended BIOS Parameter Block
448 Bootstrap code

The BIOS Parameter Blocks (both normal and extended) store additional configuration information about the volume, such as the number of bytes per sector, number of sectors per cluster, number of root directory entries, and so forth.

FAT volumes are divided into allocation units, called clusters. FAT16 can handle up to 16 bits worth of clusters (65,535). FAT32 can handle up to 32 bits worth of clusters (4,294,967,295). Depending on the size of the volume, clusters can be different sizes. The minimum cluster size is 512 bytes; larger clusters are always a power of 2 multiples of 512 bytes (for example, 1024 bytes, 2048 bytes, 4096 bytes, and so on). The maximum cluster size under FAT is 65,535 bytes, or 64 K.

Every file on a FAT volume consumes at least one cluster, regardless of the file's size or the size of the clusters. On a volume using 32 K clusters, a 1-byte file consumes 32 K of available disk space. If a file on the same volume was 32 K + 1 byte long, it would consume two clusters--32 K in the first cluster, plus 1 byte in the next cluster.

FAT16 volumes can be no longer than 4,095 M, because 65,535 maximum clusters times the maximum cluster size of 65,535 bytes yields 4,294,836,225 bytes, which is equivalent to 4,095 M, or 4 G. The following chart shows the maximum volume sizes and their corresponding cluster sizes.

Volume Size Cluster Size
32 M 512 bytes
64 M 1 K
128 M 2 K
255 M 4 K
511 M 8 K
1023 M 16 K
2047 M 32 K
4095 M 64 K

The FAT table is a simple linked list. Each file's entry in the directory points to the first cluster used. Using the corresponding FAT table entry, the operating system can then work down the list of FAT entries for each cluster, locating each of the clusters occupied by a file. Consider the following example: A file is 70 K long, and the volume uses 32 K clusters. The file's entry in the directory says that the first cluster is number 2,345. The operating system then finds all the pieces of the file by first reading FAT entry 2,345 (for the first 32 K of the file). The FAT entry indicates that the next cluster is, say, number 4,123 (for the second 32 K of the file). Cluster 4,123 indicates that the next cluster is number 932 (the remaining 8 K of the file). The FAT entry for cluster 932 stores 0xFFFF instead of a pointer to the next cluster, thereby indicating that the last cluster for the file has been reached.

Each FAT entry corresponds to a cluster, and contains relatively simple information:

File information is stored within the volume's data area, except for the root directory, which is in a fixed position on a FAT16 volume. The root directory is limited to 512 entries on FAT16.

Each directory on a FAT volume is actually a file, but one that is marked as being a directory entry so that the operating system knows how to deal with it. (Unless you are editing the byte-by-byte information on a disk, you won't be aware that a directory is actually a file.) Within the directory "file" are entries for all the files and subdirectories in the directory. When you enter a DIR command at a command prompt, you are simply displaying the contents of the directory file, formatted so that it's easy to read. Directories consume clusters just as files do. Notice that directories are not the FAT; the FAT is simply a table that lets the operating system locate parts of the files and directories listed in a directory, starting with the root directory.

Each directory entry contains the following information:

The attribute bits indicate whether an entry is for a file or another directory (a subdirectory), whether or not the entry is for a volume label, and the user-settable attributes (read-only, system, hidden, and archive).

To tie all the parts of this discussion together, let's examine an extended example: A file called TEST.FIL is stored in the directory C:\Windows\System\, is 50 K long, and is being read into an application. The sample volume uses clusters that are 32 K long. (Some steps are simplified because they're not relevant to this discussion).

1. The application requests the file's data from the operating system. The application sends the operating system the file's name and directory, in the form of a fully qualified pathname: C:\Windows\System\TEST.FIL.
2. The operating system locates the file by first scanning the entries in the root directory of drive C for an entry called Windows that has the directory attribute set (indicating that it's a directory).
3. The Windows directory entry indicates that it starts at cluster 555. The FAT is then read; using the linked list in the FAT described earlier in this section, the operating system discovers that the Windows directory occupies clusters 1123, 2342, 523, and 4923. Using that information, the operating system reads the Windows directory and scans it for an entry called System.
4. An entry called System is found in the \Windows directory listing, and it has its directory attribute set. The System entry indicates that number 1154 is its first cluster.
5. The FAT is read again, starting at cluster 1154 and following the chain until all System directory clusters are known. Using that information, the operating system reads the System directory table into memory and scans it for an entry called TEST.FIL. The entry is found, and its directory attribute is clear, indicating that it's a file. By reading that entry, the operating system finds that the first cluster of TEST.FIL is number 2987.
6. The FAT is read again, starting at cluster 2987. Using the linked list, the operating system locates both of the clusters holding TEST.FIL and can then read both clusters' contents into memory.
7. The operating system then passes the cluster contents (the file's contents) to the application as a stream of bytes.

As you can see, retrieving a file is a lot of work! Fortunately, the system keeps most directory entries--as well as the entire FAT table--in RAM, so the necessity to read the directories and FAT entries doesn't require much disk activity. However, notice that writing changes to a file requires quite a few steps (all of which require disk writes), because all the following things must take place when a file is saved:

When you realize all the work that has to be done to open, read, and write files, it's a wonder that it doesn't take more time to do it all!

Understanding FAT32

Starting with Windows OEM Service Release 2 (OSR2) and continuing into Windows 98, Microsoft developed a modified version of FAT called FAT32. Because hard disk drives were growing in capacity so rapidly, the move to FAT32 was required to support larger drives without having to use unreasonably large cluster sizes.

FAT32 works substantially the same way as FAT16, and Microsoft worked to keep differences minimal to reduce compatibility problems. However, there are some key differences:

All these changes, as well as some other optimizations, offer these advantages over FAT16:

There are also some drawbacks to consider when thinking about using FAT32:

Understanding Long Filenames on FAT

As is probably clear from the preceding discussions about FAT16 and FAT32, there is no room set aside in either file system to store more than the 8.3 filenames supported under DOS. And yet Windows 95 and Windows 98 (not to mention Windows NT) support long filenames on such FAT volumes. How is this possible?

Recall that individual directory entries have a number of attribute bits, one of which is set if the entry indicates a volume label. In earlier MS-DOS versions, there was usually only a single such entry, located in the root directory, that stored the volume label for the drive. MS-DOS ignores additional directory entries that have this attribute set, as do most utility programs.

Microsoft developed a scheme whereby long filenames could be supported on FAT volumes by using this volume label directory attribute. When you create a long filename under Windows 98, such as MYLONGFILE.TXT, multiple directory entries may be created, with the second and successive entries being flagged with the volume label attribute (so that MS-DOS and other utilities ignore those entries). Windows 98 stores pieces of each long filename in each of these entries, with up to 11 characters stored per entry. In the case of MYLONGFILE.TXT, there are two directory entries: the first is stored as MYLONG~1.TXT, while the second entry stores the remainder of the full filename and is not individually viewable, except with a disk sector editor.

Long filenames under Windows 98 must follow these rules:

One problem of which you should be aware occurs at the MS-DOS command prompt. The command-line buffer at the command prompt is limited to 128 characters, by default. Because of that, you can't use MS-DOS commands for long filenames if the command plus the filename exceeds 128 characters. You can expand the MS-DOS command-line buffer to help address this problem by placing the command SHELL=C:\WINDOWS\COMMAND.COM /U:255 in the CONFIG.SYS file (255 is the absolute maximum value).

Understanding NTFS

Although NTFS is not supported under Windows 98 (nor does Microsoft plan to support it), a discussion about Windows file systems isn't complete without an overview of NTFS.

New Technology File System (NTFS) was designed to be an "industrial strength" file system, appropriate for use on file servers and other high-end systems. NTFS includes the following features:

Unlike High Performance File System (HPFS, designed for OS/2), NTFS uses clusters of varying sizes, similar to the FAT scheme. However, cluster sizes under NTFS are much smaller than FAT16 clusters, as follows:

Partition Size Cluster Size
512 M 512 bytes
1024 M 1 K
2048 M 2 K
4096 M 4 K
8192 M 8 K
16384 M 16 K
32768 M 32 K
>32768 M 64 K

NTFS volumes are arranged into the following areas:

The Master File Table area and NTFS System Files are actually part of the same area on the disk, made up of 16 records (only 11 are used at this time), each one having a filename, as follows:

System File Filename Description
Master File Table $Mft Contains the contents of the NTFS volume
Master File Table #2 $MftMirr Duplicate of the first three records of the Master File Table
Log File $LogFile Transaction log used to recover disk transactions in case of error (such as a power failure while writing a transaction)
Volume $Volume Volume information, such as name, NTFS version information, and so on
Attribute Definition $AttrDef A table listing attributes used on the volume
Table    
Root Filename Index $. The root directory contents
Cluster Bitmap $Bitmap A bitmap showing used and unused clusters on the volume; used for rapidly allocating clusters
Partition Boot Sector $Boot Bootstrap program for the volume
Bad Cluster File $BadClus List of bad clusters on the volume
Quota Table $Quota Stores disk quota information for volume users
Upcase Table $Upcase Table used to convert lowercase letters to uppercase letters, using Unicode

Each file on an NTFS system is seen as a set of file attributes (which are quite unlike the file attribute flags used under FAT). NTFS can have file attributes for data in the file, for security information, for file metadata (such as icons), and even for the name of the file. (These file attributes are similar to the OLE file format in which individual files can be made up of separate streams of data.)

Understanding DriveSpace

Windows 98 includes disk compression software called DriveSpace, which operates only on FAT16-based volumes. DriveSpace creates a single file on the volume, in which it stores all the files. The DriveSpace driver then "hides" the actual volume from the system and replaces it with a virtual volume, which is the contents of the compressed file system. DriveSpace is limited to being used on volumes with a size of 2 G or less. You learn more about DriveSpace disk compression later in this chapter.

DriveSpace can store files using three different compression levels: no compression, HiPack compression, and UltraPack compression. UltraPack compression is approximately 30 percent more efficient than HiPack compression, but requires a minimum of a Pentium-class computer and suffers from greater performance reduction.

Comparing File Systems

For hard disk drives, you have three file system choices under Windows 98:

Interestingly enough, the choice that offers the best overall performance is FAT16 with DriveSpace compression, but with the compression level set to perform no compression. Because DriveSpace volumes store data more efficiently than FAT (and use a single FAT chain on the real FAT16 drive), they can read and write data more quickly than equivalent FAT16 drives. that FAT16 with DriveSpace compression set to either HiPack or UltraPack performs more poorly than FAT16.

Generally, FAT16 performs better than FAT32, with about an overall 5 percent advantage in performance. However, this slight performance advantage may be offset by FAT32's other features, such as more efficient use of disk space. And these two factors are not the only things you have to consider when choosing which file system to run: You also have to think about compatibility, whether you require the use of any utility software that won't work with FAT32, or if you want to dual-boot Windows NT (which isn't able to access FAT32 volumes).

Understanding Storage Hardware

Disk subsystems are made up of three primary components: the hard disk itself, the interface between the hard disk controller and the hard disk, and the bus interface between the computer system and the disk controller. These three components work together and play a large part in disk performance.

Hard disk drive performance is measured using the following factors:

Depending on the application, Average Access Time and Data Transfer Rate may both play roles in the ultimate performance of an application.

Hard disk drive controllers are connected to the computer through one of the system buses, of which there are several different types. Ranging from slowest to fastest, they are ISA, EISA, VL-Bus, and PCI. Even with systems that integrate disk controllers on their motherboards, the disk controller still exists on one of these types of buses (usually PCI in today's PCs). Using a disk controller on a local bus, such as PCI, guarantees the best performance for transferring data from the hard disk to the system, all else being equal.

Hard disk controllers and hard disks also have to communicate, and there are a number of different methods in which this is accomplished. On most desktop systems, a drive interface called EIDE (Enhanced IDE), also known as Fast-ATA, is the most prevalent.

EIDE disk interfaces are not terribly intelligent; they rely on the computer's processor to perform much of their work (which is the reason they are less expensive than other disk interface alternatives). There are several methods through which an EIDE disk interface works with the computer system to perform these data transfers. The primary method is called Programmed Input/Output, or PIO. PIO Mode 3 and PIO Mode 4 are most commonly seen today; they transfer data at a peak rate of 11 MBps and 16.6 MBps, respectively.

The other major drive interface standard is called Small Computer Systems Interface (SCSI, pronounced "scuzzy"). SCSI comes in three flavors: SCSI-1, SCSI-2, and SCSI-3. Basically, the higher the SCSI number, the faster the drive interface operates. SCSI-2 supports transfer rates of 10 to 20 MBps; SCSI-3 (formerly called UltraSCSI) supports rates of 20 to 40 MBps. Different SCSI-2 systems may use techniques called fast SCSI and wide SCSI which defines how the data is transferred from the disk to the controller--fast SCSI uses a faster transmission frequency and wide SCSI transfers twice as much data at a time.

Generically, SCSI supports many features that make it the primary choice for network file servers and other high-end systems. These features include scatter/gather, connect/disconnect, elevator seeking, and tag command queuing.

Because Windows 98 does not make good use of the more advanced SCSI features, EIDE drive systems and SCSI drive systems under Windows 98 tend to operate at about the same speed, with EIDE systems sometimes having a slight performance edge. It's a different story under Windows NT, however; SCSI systems almost always outperform their equivalent EIDE systems under that operating system. Therefore, if you plan on dual-booting both Windows 98 and Windows NT, you should prefer systems that have SCSI-based disk subsystems.

Configuring Disk Subsystems

When choosing and configuring a disk subsystem, you face many choices. What hard disk interface to use? How should hard disks and CD-ROMs be connected to the hard disk interfaces in different situations? Which file system should be used when the drives are formatted? How should the drives be partitioned? In this section, you learn about the factors that go into making these choices.

First, when selecting a disk subsystem for a computer running Windows 98, it helps to get the fastest and largest disks available within your budget. Because there is no performance benefit to SCSI under Windows 98, unless you plan on running Windows NT in the near future, you can save some money and purchase an EIDE-based disk system.

Deciding on file systems and partitioning schemes requires that you balance all your requirements in a way that makes sense to you. Most of these factors have already been discussed in this chapter, but are recapped here:

If you're a systems professional learning about how all these factors work together and how to implement them, consider using a good tape drive so that you can more easily reconfigure a system based on any changing requirements, and so that you can actually try different disk configurations with Windows 98.

Understanding Windows 98 Disk Operations

The first part of this chapter deals with how disks work, how file systems work, how they work under Windows 98, and so forth. In this remaining part of the chapter, you learn about actual disk operations under Windows 98: how to partition, format, defragment, compress, test, and repair your disk file systems.

Partitioning Hard Disks

Partitioning hard disks (review the rules for disk partitions earlier in this chapter) is accomplished using a program called FDISK, which runs from the command line. Generally, disk partitions are created before installing Windows 98, although strictly speaking, you have to create only a primary partition before installing Windows 98 and can then run FDISK in a Windows 98 MS-DOS window to create further partitions. Once you make changes in FDISK to change partitions, you must restart the system for the partition changes to take effect (and before the partition or logical drive can be formatted). FDISK's main screen is shown in Figure 17.1.

Figure 17.1

The main screen of the FDISK Fixed Disk Setup Program.

FDISK is a straightforward program to use. Simply select the menu choices corresponding to what you want to do and follow the prompts. For dangerous tasks, such as removing existing partitions, FDISK warns you before carrying out the action.


WARNING: Even though FDISK is simple to use, its capability to destroy data means that you should treat it with respect. Think carefully about removing existing partitions and about re-creating other partitions because data stored on the removed partitions is not accessible after the partitions are removed.


Formatting Disks

Once a volume is partitioned, you can format it. Formatting prepares a volume to receive data using the file system selected with FDISK. Volumes can be formatted in one of two ways: through a graphical utility accessed from My Computer or Windows Explorer, or through the FORMAT command used at the command line. Both methods provide the same result.

To format a volume from the Windows desktop, open My Computer, right-click the drive you want to format, and choose Format from the shortcut menu. You then see the Format dialog box shown in Figure 17.2. Table 17.1 lists the options available in the Format dialog box.

Figure 17.2

The Format dialog box.

Table 17.1 Options in the Format Dialog Box

Option Description
_Quick (erase) Quick-formats an already-formatted volume, with the effect of simply erasing all the contents of the volume quickly.
Full Formats an unformatted volume. This option causes each and every cluster on the volume to be formatted.
Copy System Prepares a volume to be made bootable. Do not use this option for
Files Only formatting hard disks under Windows 98.
Label Allows you to enter a volume label in the field, which is used to identify the volume.
No Label Select this checkbox to avoid creating a volume label.
Display Summary Displays a summary screen after the format is complete showing you
When Finished various statistics about the newly formatted volume.
Copy S_ystem Files Causes boot files to be placed on the formatted volume, making it bootable. Do not use this option when formatting hard disks under Windows 98.

You can also format volumes using the FORMAT command from a command prompt window. The syntax for the format command is as follows:

FORMAT drive_letter: [/V:label] [/Q] [/S]

In this syntax, the following parameters are used:

Parameter Meaning
Drive_letter: The letter of the drive to be formatted
/V:label Specifies a volume label
/Q Performs a quick format
/S Makes the formatted drive bootable

You typically use the command-line version of FORMAT when booting the system with the EBD. For example, to start over with a system and reinstall Windows 98, you can boot the EBD and then use the command FORMAT C: /V:Win98 /S to format the primary partition and prepare for the Windows 98 installation program.

Defragmenting Hard Disks

As you learned earlier in this chapter, the files that occupy FAT hard disks become fragmented over time. Because FAT simply locates new file clusters in the first available space on the disk, as files are deleted and other files grow, the contents of files tend to spread over the disk, reducing performance when accessing those files. On a disk that has a fragmentation level of 10 percent or more (that is, 10 percent of the files are fragmented), you will experience perceptible reductions in the performance of the system.

To defragment a hard drive, open My Computer or Windows Explorer and right-click the drive you want to defragment; choose Properties from the shortcut menu. Click Defragment Now to begin the defragmentation process. Alternatively, you can start the Disk Defragmenter program from the Start Menu/Programs/Accessories/System Tools menu, and then choose a drive to defragment (you can also choose to defragment all hard drives if you start Disk Defragmenter in this way).


TIP: Under Windows 98, you should schedule frequent disk defragmentation using the Task Scheduler (see Chapter 34, "Automating Tasks"). It's often a good idea to completely defragment busy systems once a week; Task Scheduler can be set to do this while you're not using the computer.


After starting Disk Defragmenter, you see a status display while the drive is being defragmented. You can continue to use the computer while this process completes, but you should avoid any activity that involves writing data to the drive being defragmented (doing so causes the defragmenter to have to start over with the drive). While the Status window is displayed, you can click the Show Details button to view a graphical representation of the disk clusters as they are moved around on the disk (see Figure 17.3). Each box in the Show Details window represents one disk cluster.

Figure 17.3

Watching Disk Defragmenter do its work.

Testing Hard Disk Drives

Hard disks can and do develop errors occasionally. Sometimes, these are file system errors (meaning that something in the directory or FAT is inconsistent with the contents of the disk); sometimes, the error is caused by bad spots developing on the disk (which happens occasionally and is not usually cause for concern). However, developing bad sectors is cause for great concern if it continues to happen or involves more than a couple of bad sectors; you should replace hard disks that exhibit these characteristics.

You can test for and repair most disk errors using a program called ScanDisk, which can be run from within Windows, from the command line, or from the EBD. ScanDisk can examine the directory and FAT structures on the disk and can also perform a surface scan, in which it tests each and every disk cluster on the disk to ensure that all are readable.


NOTE: Under Windows 98, the command-prompt version of ScanDisk is run whenever the system starts without having been properly shut down. Directory problems can frequently develop when systems aren't properly shut down; running ScanDisk at startup after a bad shut down greatly reduces chances for subsequent disk problems.


Start ScanDisk in one of two ways: Open a drive's Properties dialog box, select the Tools tab, and click Check Now; alternatively, start the program from the Start Menu/Programs/Accessories/System Tools menu. In both cases, you see the main ScanDisk screen shown in Figure 17.4.

Figure 17.4

The main ScanDisk screen.

You have several options when using ScanDisk. First, choose whether to perform a Standard or Thorough test (the Standard test only checks directory and FAT structures). Then choose whether any errors encountered should be repaired automatically by ScanDisk; if you leave this checkbox blank, ScanDisk prompts you when it finds errors.

If you choose to perform a Thorough scan, click the Options button to display the Surface Scan Options dialog box shown in Figure 17.5. The possible settings are shown in Table 17.2.

Figure 17.5

The ScanDisk Surface Scan Options dialog box.

Table 17.2 ScanDisk Surface Scan Options

Surface Scan Option Description
Areas of the Controls which areas of the disk system are scanned. Choose
Disk to Scan System Area to check the FAT and other control structures for the partition.
Do Not Perform When this option is deselected, ScanDisk reads the contents of
Write-Testing each cluster to ensure that all clusters can be read, and then writes the contents back to the same location to ensure that they can be written. Selecting this checkbox skips the write portion of the testing.
Do Not Repair Bad When ScanDisk does a surface scan and finds bad sectors, it moves
Sectors in Files Hidden the file contents stored in that sector to another location on the
and System Files disk and marks the sectors as bad so that they are not reused. Checking this box avoids this action for any files that have their hidden or system attributes set. Some software programs require that a file be stored in a particular location; moving such files may cause those programs to stop functioning.

From ScanDisk's main window, you can also click the Advanced button to change how ScanDisk operates. Doing so displays the ScanDisk Advanced Options dialog box shown in Figure 17.6. Table 17.3 defines the options in this dialog box.

Figure 17.6

The ScanDisk Advanced Options dialog box.

Table 17.3 ScanDisk Advanced Options

ScanDisk Advanced Option Description
Display Summary section Controls whether the summary window is displayed when ScanDisk finishes.
Log File section Controls how ScanDisk keeps log files of its actions. (The log file is called C:\SCANDISK.LOG.)
Cross-Linked Files section Controls how ScanDisk should handle any cross-linked files, where two separate files both claim the same cluster on the disk.
Lost File Fragments section Controls how ScanDisk should handle lost file fragments.
Check Files For section Controls which directory integrity tests ScanDisk will perform.
Check Host Drive First Used only for compressed volumes. This option causes the host drive to be checked before the contents of the compressed drive are tested.
Report MS-DOS Mode Name Reports filenames that are not Length Errors properly recognized by MS-DOS.

Using DriveSpace

Windows 98 includes a feature called DriveSpace, which can automatically compress the data stored on FAT16 drives. When a drive is compressed using DriveSpace, all files read from and written to the drive are automatically compressed using settings you define. Many application data files may consume as little as one-quarter their original size when they are compressed. (However, already compressed files such as .ZIP or .JPG files cannot be compressed further, and most .EXE files don't compress very much.)

Start DriveSpace by opening it from Start Menu/Programs/Accessories/System Tools. The main DriveSpace window is shown in Figure 17.7.

To compress a drive, first select it in the DriveSpace window and then choose the Compress command from the Drive menu. You are shown a summary of the effect of compressing the drive (see Figure 17.8).

Click the Options button to control how the compressed drive is created. Figure 17.9 shows the Compression Options dialog box.

Figure 17.7

The main Windows 98 DriveSpace window.

Figure 17.8

The DriveSpace compression estimate.

Figure 17.9

The DriveSpace Compression Options dialog box.

In the Compression Options dialog box, you can choose the drive letter to be reserved for the host drive as well as whether or not the host drive will be hidden from the system. You can also choose how much free space to keep open on the host drive.


What's a Host Drive?


When DriveSpace compresses a drive (for example, drive C), it changes the letter of the actual drive to something else (usually the next available drive letter in the system). On the actual drive partition, it creates a single file that contains the drive's contents, which are compressed within the file. The compressed file is mounted so that it appears as an actual drive, using the original drive letter of the host drive.
However, if you were to boot an MS-DOS disk and examine drive C in this example, you would see the actual drive C (the host drive) and not the compressed contents. For the whole illusion to work, and for you to access the contents of the compressed drive, the DriveSpace driver (DRVSPACE.BIN) must be loaded into memory.


Compressing a drive can take a long time, often several hours. It's a good idea to start the compression process when the computer won't need to be used for a while.

Maintaining a Compressed Drive

Once a drive is compressed, you can use all the normal Windows 98 disk maintenance tools on it, such as ScanDisk or Disk Defragmenter. Those utilities automatically compensate for the compressed drive and carry out their functions on it normally.

You must do several additional things to maintain compressed drives, however. First, you may want to change the compression level used to store files. There are four compression levels: no compression, Normal Compression, HiPack Compression, and UltraPack Compression. Higher compression levels make available more space on the drive but at the cost of disk performance.

You adjust the compression level used to store new files using the DriveSpace utility. Access the Advanced menu and choose Options to display the Disk Compression Settings dialog box shown in Figure 17.10. Choose from the available options to select a compression level for new files being stored on the compressed drive.

Figure 17.10

The Disk Compression Settings dialog box.

Notice that there is no setting for UltraPack Compression on the Disk Compression Settings dialog box. This is because UltraPack Compression is used only to compress files that haven't been used for a period of time; it is not used for normal file save operations. To adjust the compression level of files stored on the compressed drive, you use a program called the Compression Agent. The Compression Agent (accessed from the Start Menu/Programs/Accessories/System Tools menu) can change a file's compression level to the UltraPack level and can also adjust all the other file's compression levels based on settings you choose. You typically run Compression Agent on a regular basis to optimize how compressed files are stored on the disk; you normally run the Compression Agent through Task Scheduler. Figure 17.11 shows Compression Agent's main window.

Figure 17.11

The main window of the Compression Agent.

To choose the settings for Compression Agent, click the Settings button to display the Compression Agent Settings dialog box (see Figure 17.12).

Figure 17.12

The Compression Agent Settings dialog box.

Use the settings in the Compression Agent Settings dialog box to strike your preferred balance between available disk space and performance. A good rule of thumb is to use UltraPack only for files that haven't been accessed in 20 to 30 days; leave the files you access frequently stored either with no compression or with HiPack compression.

For performance reasons, you may want Compression Agent to never compress files of a certain type. You can use the Exceptions button to define specific files, entire folders, or all files that share a particular file extension, and you can define how such files will be compressed, exclusive of the default Compression Agent settings. The Add Exceptions dialog box is shown in Figure 17.13.

Figure 17.13

The Add Exceptions dialog box.

Disk Compression Notes

Compressing a disk using DriveSpace should be done only when there are no other good alternatives, such as adding more physical disk space or reducing the number of files that must be stored. Although compressed drives can extend the life of a disk drive significantly by making much more space available, there are problems you can encounter and should be aware of:

Conclusion

In this chapter, you learned about hard disks and file systems under Windows 98. You also learned about the NTFS file system that Windows NT uses. You learned how long filenames are stored, how FAT16 and FAT32 compare, and how FAT16 and FAT32 are structured. You also learned how to perform common operations on hard disk drives, such as defragmenting them, repairing errors, and compressing them.

You can continue exploring the architecture of Windows 98 by examining Chapter 11, "Windows 98 Architecture and Application Support," or you can continue learning about devices in Windows 98 by reading Chapter 12, "Supporting Devices." Other chapters closely related to disk support include Chapter 20, "Backup and Restore"; Chapter 35, "Tools and Strategies for Optimizing Windows 98"; and Chapter 36, "The Windows 98 Boot Process and Emergency Recovery."


Previous chapterNext chapterContents

Copyright, Macmillan Computer Publishing. All rights reserved.