Previous | Next

Technical Notes on Disk Device Support

Win32 Driver Model (WDM) defines a device-driver architecture that provides a common set of I/O services understood by both Windows 98 and future versions of Windows NT. With WDM, developers can write a single bus driver or device driver for both operating systems.

The ability to have binary-compatible device drivers comes from the layered architecture. Each layer isolates portions of the services required of a device driver and lets hardware vendors contain all hardware-specific functionality into a single file. Before WDM, device drivers had to include hooks for a particular operating system in addition to the elements necessary to interact with a specific piece of hardware. The non-layered approach prevents device drivers from being supported across multiple operating systems.

The WDM layered architecture is based on the concept of driver classes. There are six layers to WDM.

Windows 98 uses the layered block device drivers to manage input and output to block devices, such as disks and CD-ROM drives. A block device is a device such as a disk drive that moves information in groups of bytes (blocks) rather than one byte at a time. Layered block device drivers are 32-bit, flat-model device drivers that run in protected mode. These drivers support conventional and small computer system interface (SCSI) disk drives, plus partitioned and non-partitioned removable media. Windows 98 also uses layered block device drivers to manage Windows 3.x FastDisk drivers, MS-DOS-based real-mode device drivers, and Windows NT miniport drivers.

Each layered block device driver can be loaded dynamically, so the appropriate driver can be loaded or unloaded as needed without restarting the computer. Although the drivers are virtual device drivers (VxDs), they do not use the standard virtual device services and APIs. Instead, the I/O Supervisor provides the services and functions the device drivers need to complete their tasks.

Specifically, the block I/O subsystem in Windows 98 provides the following:

For more information about the block I/O subsystem, see Chapter 28, "Windows 98 Architecture." For more information about WDM, see Chapter 30, "Hardware Management."

Supported Disk Devices

Windows 98 provides better disk device support than Windows 95 and ensures compatibility with existing MS-DOS-based and Windows-based disk device drivers.

Windows 98 also provides enhanced support for large media using logical block addressing, including hard disks with more than 1024 cylinders. Extensions to the INT 13 disk controller support are provided in the protected-mode disk handler drivers for this support.

The following types of hard disk drives are supported under Windows 98:

IDE
IDE DMA
IDE LBA
SCSI

The following types of bus adapters are supported under Windows 98:

EISA
ISA
MCA
PCI
PCMCIA
SCSI 2
VL bus

The following sections describe support in Windows 98 for IDE, SCSI, high-speed floppy disk, and removable media devices. Information about SCSI and non-SCSI port drivers is also included.

IDE Drives and Controllers

Windows 98 provides improved support for integrated device electronics (IDE) drive configurations, as summarized in this section.

Alternate IDE controllers.

Windows 98 provides protected-mode support for the use of one or more IDE controllers in a computer, or the combination of an IDE controller in a portable computer and an alternate controller in a docking station (available, for example, in some Compaq docking station products). IDE controllers provide support for multiple disk drives.

IDE-based CD-ROM drives.

Windows 98 supports CD-ROM drives that connect to IDE-compatible disk controllers.

Large IDE disk drives.

IDE drives that support a logical block addressing (LBA) scheme are available, allowing them to exceed the 0.5 GB (528 MB) size limitation. Windows 98 provides protected-mode support for IDE disk drives larger than 504 MB.

Note

The BIOS must also support LBA, otherwise third-party partitioning software is required.

The cluster size for a drive is defined by the Format program, depending on the size of the local drive as shown in Table 10.2.

Bus mastering chip sets.

Windows 98 provides support for bus mastering chip sets, such as Intel Triton and Opti Viper M.

Note

Bus mastering should only be enabled for specific hard drive models that are certified by their manufacturer to work properly with a Windows bus master driver. The drives must indicate that they support direct memory access (DMA) in the drive ID data. Check properties in the disk drive to see if a check box for DMA appears, which indicates that the controller supports DMA. However, it is a good idea to check with the hard disk manufacturer to see if the hard drive supports DMA.

Self-monitoring analysis and reporting technology (SMART).

Windows 98 provides support for SMART hard-drive fault prediction systems, which have been developed by several hard drive vendors.

Tape backup units.

Windows 98 provides support for IDE, floppy, and SCSI tape backup units.

ATAPI-CD changers.

Windows 98 provides support for ATAPI-CD changers with up to seven CD slots.

CD-ROM Disk Driver

The file Ppa3.mpd for the parallel Zip drive is included on the Windows 98 compact disc, in the drivers section of \Storage\Iomega\PPA3 (you can update the driver manually). The drivers Cdfs.vxd and Cdvsd.vxd are updated to include support for the following:

DVD Storage

DVD-ROM drives as storage media are supported by Windows 98. To use a DVD-ROM drive, it must be compliant to the Mt. Fuji specification (also called SFF8090). The CD-ROM class driver in Windows 98 has been updated to support DVD-ROM drives as well.

All DVD-ROM drives are required to support DMA. To enable support for DMA, go to the Device Manager tab, select Properties for the drive, select the DMA check box, and reboot to run on DMA.

Windows 98 has a new read-only Universal Disk Format (UDF) system, which supports reading media formatted according to UDF specification 1.02. Most DVD movie discs today are authored with UDF bridge format, which contains both the ISO-9660 and the UDF file system structures. You can tell if a disc is mounted by UDF or CDFS by checking the properties of a drive in Explorer. In My Computer, right-click on a drive, and then click Properties. The File System line in the properties page tells you whether the disc is mounted by UDF or CDFS.

Unlike CDFS, UDF is a generic file system, but it is primarily used by DVD discs. UDF uses the main file system cache (vcache) and there are no performance settings for end users to change.

Some legacy third-party DVD movie player software may require MSCDEX functions, which are supported by CDFS only and not UDF. Use the following procedure to disable UDF for troubleshooting.

To disable UDF for troubleshooting

  1. Click Start, click Run, type MSConfig, and then click OK.
  2. Click Advanced, and then select the Disable UDF file system check box.

    When you are finished troubleshooting, clear the Disable UDF file system checkbox to enable UDF file system.

For more information about the System Configuration Utility (MSConfig), see Chapter 27, "General Troubleshooting."

Although most DVD discs contain both ISO 9660 and UDF file system structures, UDF takes precedence in mounting such discs. If UDF is disabled using the above registry key, CDFS will try to mount. However, Microsoft DVD playback software requires UDF be mounted on DVD discs.

SCSI Devices and Drivers

Windows 98 provides support for SCSI disk devices. SCSI support in Windows 98 includes disk SCSI translator drivers, the SCSI Port Manager, and SCSI miniport drivers.

Windows 98 provides broad support for popular SCSI controllers. Windows 98 includes 32-bit disk device drivers for popular SCSI controllers from Adaptec, Future Domain, and other manufacturers. Windows 98 also provides compatibility support for the Advanced SCSI Programming Interface (ASPI) and Common Access Method (CAM), which allows application and driver developers to submit I/O requests to SCSI devices. This allows existing MS-DOS-based applications and drivers that use the ASPI or CAM specification to work properly under Windows 98. Windows 98 also includes 16-bit and 32-bit drivers to support Windows-based ASPI clients and applications.

Although Windows 98 can use Windows NT miniport drivers, the best choice for a SCSI driver is one that complies with Plug and Play. Most Windows NT miniport drivers ignore configuration information from the SCSI Manager and check I/O ports to identify hardware. Miniport drivers in Windows 98 must honor configuration information without scanning for other adapters if the configuration information is not the default configuration. This is because many adapters supported under Windows 98 have port ranges that conflict with other adapters and are affected adversely by scanning. For example, Artisoft LANtastic network adapters occupy a range of port addresses used by Adaptec 154X adapters, and accessing these ports will cause the system to lock up.

Windows 98 provides several .MPD files with Plug and Play capabilities, including the ability to transition from protected mode to real mode (to support MS-DOS-based applications that must run in MS-DOS Mode) and to accept configuration information from the SCSI Manager for dynamically loading and unloading drivers.

High-Speed Floppy Disk Driver

Windows 98 includes the Hsflop.pdr floppy disk driver. The driver provides significantly enhanced performance on many machines.

Windows 98 provides protected-mode support for communicating with floppy disk controllers. Windows 98 provides INT 13 hard disk controller support as 32-bit device drivers, which results in improved performance, stability, and system robustness.

Windows 98 provides floppy disk controller support as a 32-bit device driver, and offers improved performance for file I/O to floppy disk drives, plus improved reliability of the system. You can format a disk or copy files to and from a disk while performing other tasks.

Tip

Windows 98 scans for floppy drives on each boot, which is helpful for laptops and other computers from which the floppy can be removed. If you are on a desktop with a floppy drive that is stationary, you can turn this option off to speed up boot time.

  1. From Control Panel, click System, and then click the Performance tab.
  2. Click File System, and then click the Floppy Disk tab.
  3. Uncheck the box next to Search for new floppy disk drives each time your computer starts.
  4. Click OK.

Removable Media and Docking Devices

Windows 98 provides protected-mode support for removable media devices with MS-DOS-compatible partitions, including floppy disk drives and controllers, Bernoulli drives, and CD-ROM, plus docking stations for portable computers. Windows 98 allows the system to lock or unlock the device to prevent the media from being removed prematurely.

Windows 98 also supports an eject mechanism for devices that support it, so that users can use software control to eject media from a device (for example, new floppy disk drives that support software-based media ejection).

Docking refers to the insertion or removal of a device in the system. Devices that can be docked include almost anything, depending on the hardware—monitors, network access, removable hard disk drives, or any removable resource. A docking station is a base unit into which you can insert the portable hardware and that includes drive bays, expansion slots, and additional ports. Port replicators can also be used as docking station substitutes that provide extra functionality not available in the portable docking device.

If a docking change occurs in the computer configuration during operation, such as the insertion of a portable computer into the docking station, the system is notified so that the new device can be configured and applications can be notified of the change.

Windows 98 supports "hot" docking, where the device can be docked or undocked while running at full power, and "cold" docking, where the device must be powered off or restarted before the device can be docked or undocked. Legacy portable computers use cold docking.

In addition, some devices require certain preliminary steps before they can be docked or undocked. For example, if you have a file open and decide to remove the hard disk, the file must be closed. To handle these situations, Windows 98 supports different undocking systems, depending on the type of hardware:

Hardware Profiles are used to set up multiple hardware configurations. This is especially useful for laptops that have docking stations or workstations with removable storage media.

Hardware Profiles are automatically created for portable computers when the system is docked or undocked. Furthermore, a new Hardware Profile would be created if the portable computer is placed in a different docking station.

LS-120 Support

The real mode MS-DOS kernel, protected mode, file system components, and the various formatting utilities are updated to support the LS-120 (120 MB) floppy drives built into some computers.

Non-SCSI Port Drivers

A non-SCSI port driver usually works with a specific adapter, so the driver is retained in memory only if the related adapter is present in the system. Windows 98 includes, for example, port drivers for IDE, ESDI, or floppy disk drives.

A port driver provides the same functionality as the SCSI Manager and miniport driver, but these drivers are monolithic and are not portable to Windows NT. A port driver manages and controls the adapter for a given block device. The port driver detects and initializes the adapter, handles interrupts, transmits I/O requests to the device, and carries out adapter-level error recovery and logging.

Important

Do not use a device= entry in System.ini to load a port driver. Windows 98 loads appropriate drivers from the System\Iosubsys subdirectory in the \Windows directory.

Master Boot Record

When the computer is powered on, a mechanism is required to manipulate interrupts, find the hard disk(s), and launch code necessary to load drivers located on the boot drive. This mechanism is contained in the Master Boot Record (MBR). The MBR of a hard disk resides at the first physical sector of the disk: track 0, side 0, sector 1.

The MBR is divided into five sections: Jump Code, Error Messages, Free Space, the Partition Tables, and Ending Signature. Table 10.5 outlines some of the more important components of the MBR.

Table 10.5 Important components of the MBR

Area Functions or purpose
Jump Code: 139 bytes Load MBR into memory
Enable interrupts
Scan disk characteristics
Find C: drive
Load boot sector from C: drive
Error Messages: 80 bytes Invalid Partition Table
Error loading operation system
Missing operating system
Free Space: 227 bytes
Partition Tables: 64 bytes Active partition
Starting head, sector, and cylinder
Partition Type
Ending head, sector, and cylinder
Total number of sectors on this partition
Ending Signature: 2 bytes Define the MBR boundary

If one of the values becomes corrupted, the system probably will not boot. Likewise, if a new value is introduced by an operating system and an existing software utility does not understand the new value, there is a possibility of data corruption.

The area of the MBR that has changed for FAT32 is the Partition Table. The Partition Table is divided into four 16-byte entries. Inside the Partition Table is the Partition Type. This entry is important for identifying the partition structure for the operating system. In order for FAT32 to accomplish its new capabilities, the MBR contains the following two new Partition Types:

DOS32.

Defines primary 32-bit FAT partitions of up to 2,047 GB. It is used when the primary partition does not require logical block addressing (LBA) to access that partition. LBA is a method of accessing hard disk drives based on the extensions of INT 13.

DOS32X.

Defines 32-bit FAT partitions of up to 2,047 GB. It is used when any portion of either the primary or extended partition is beyond 1,024 cylinders, 63 sectors per track, and 16 heads, and requires LBA to access. These new 32-bit FAT partition types cannot be accessed through MS-DOS 6.x or earlier.

The Legacy Boot Sector

The Boot Sector is the first sector on every logical drive. The Boot Sector contains a table of that drive’s characteristics and the code that boots the operating system. When the system starts, this code is loaded into memory where it loads the operating system files from the disk. The remainder of the Boot Sector is boot code and error messages.

The following is the first 64 bytes of a typical Boot Sector on a logical drive. Table 10.6 details some of the more important entries. All values are in hex, not decimal.

EB 3E 90 4D 53 57 49 4E-34 2F 31 00 02 04 01 00   .>.MSWIN4.1.....
02 00 02 00 00 F8 CA 00-23 00 0C 00 23 00 00 00   ........#...#...
B1 28 03 00 80 00 29 88-98 24 1D 20 20 20 20 20   .(....)..$.
20 20 20 20 20 20 46 41-54 31 36 20 20 20 F1 7D         FAT16   .}

Table 10.6 Important characteristics of the Boot Sector

Length Contents
3 bytes Jump to boot code.
8 bytes Windows name and version.
2 bytes Bytes per sector. 1
1 byte Sectors per cluster (always a power of 2). 1
2 bytes Number of reserved sectors before the first FAT. 1
1 byte Number of FATs. 1
2 bytes Number of root directory entries (max limit). 1
2 bytes Total number of sectors (00 00 if the drive is greater than 32 MB). 1
1 byte Media descriptor; here it is F8, which identifies this disk as a hard drive of any capacity. 1
2 bytes Number of sectors per FAT. 1
2 bytes Number of sectors per track. 1
2 bytes Number of heads. 1
4 bytes Number of hidden sectors. 1
4 bytes Number of sectors if drive is greater than 32 MB. 1
1 byte Drive number; here it is 80, which means primary partition.
1 byte RESERVED.
1 byte Extended boot signature (always 29h).
4 bytes Volume ID number.
11 bytes Volume label.
8 bytes Type of file system (12-bit FAT or 16-bit FAT).
1 This portion of the Boot Sector is known as the BIOS Parameter Block (BPB). It offers physical disk characteristics that MS-DOS/Windows use for finding specific disk locations. For example, by adding or multiplying values together, it gives details as to where the FAT, root directory, and data area begin and end.

For more information about the Boot Sector, see the Microsoft Programmer’s Reference. It contains detailed information about each of the values previously mentioned.

Changes to the Boot Sector

The number of reserved sectors before the first FAT is 1. This is the Boot Sector itself. FAT32 drives usually contain 32, but can vary based on how the drive is set up.

New Boot Sector BIOS Parameter Block

A FAT32 BIOS Parameter Block (BPB) is larger than a standard BPB and is referred to as Big FAT BIOS Parameter Block (BF_BPB). With this additional information, the Boot Sector is now two sectors since it is not possible to fit the boot code into 512 bytes. This additional sector is located in one of the 32 reserved sectors.

The BF_BPB is an extended version of the 12-bit and 16-bit FAT BPB. It contains an identical structure to a standard BPB, but also includes several extra fields for FAT32-specific information. Changes in the BPB for FAT32 include the following:

Root Directory Field.

This entry contains the number of root directories. For hard drives this has always been 512 (00 02h). This field is changed to 00 00 and is ignored on FAT32 drives.

Sectors Per FAT.

The number of sectors per FAT entry in the original BPB is changed to zero. This acts as a pointer to the entry in the BF_BPB as the boot process moves to the BF_BPB.

Drive Description.

New to FAT32 is a 2 byte field called Drive Description that determines the number of FATs on a drive. These 2 bytes set the flags to determine whether there is one or two FATs on the drive. If set, there is only one FAT. If the flag is clear, there are two FATs. FAT32 created by the FORMAT command will always create two FATs.

First Root Directory Cluster.

The root directory size is now limited to 65,535 entries, can grow just like a sub-directory, and its location is flexible. This value points to the cluster number of the first cluster of the root directory of the FAT32 drive.

File Information Sector.

This entry points to the second sector of the Boot Sector that contains the total free and most recently allocated cluster on the drive. This allows a FAT32 volume to obtain the quantity of free clusters on a volume as well as the most recently allocated cluster without having to read the entire FAT.

Backup Copy of Boot Sector.

Another important change to Boot Sector processing is a backup copy of the Boot Sector. With previous versions of the FAT file system, users worked in a "single point of failure" scenario. That is, if the Boot Sector became corrupted or unreadable, the volume would stop working. FAT32 has made adjustments to offset this potential problem.

When Fdisk writes to the boot volume that has a change, and that volume is using a FAT32 partition ID, Fdisk will write a backup Boot Sector to sector 6 of that volume. If the new MBR receives a read error, or has a signature validation problem with reading the Boot Sector, it will search sector 6 and try reading the rest of the bootstrap loader.

32-bit File Allocation Table

The purpose of the FAT has not changed. It still acts as a table for linking the clusters of a file together. File/Directory entries point to the first cluster in the file which the operating system uses to find the first entry in the FAT. The FAT then tracks the location of the remaining clusters in the file. The entries are twice the size (4 bytes) and you can hold many more clusters on a FAT32 drive.

With the 16-bit FAT, the quantity of clusters on a drive is 65,525 (216 with 10 reserved). With a 32-bit FAT, the highest 4 bits of the 32-bit values are reserved and are not part of the cluster number. Therefore, the maximum amount of clusters on a 32-bit FAT is: 268,435,445 (228 with 10 reserved).

Stepping Through a FAT32 Entry

The starting cluster given in the file/directory entry tells the operating system where to find the first piece of that file. The starting cluster also tells the operating system where to look in FAT32 for the next cluster number. The entry for a starting cluster in a file entry is in bold below.

49 4F 20 20 20 20 20 20-44 4F 53 07 00 00 00 00   IO      SYS.....
00 00 00 00 00 00 80 32-3E 1B 02 00 46 9F 00 00   .......2....F...

Two additional entries are used in the 32-bit directory entry. These two entries are taken from a reserved area and in this example are shown above as 00 00. Together with the existing 2 byte entry (02 00), there is a four-byte entry (00 00 00 02) to search the FAT. The following is a sample tracing of the file in a 32-bit FAT:

F8 FF FF 0F FF FF FF 0F-03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00-07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00-0B 00 00 00 0C 00 00 00
0D 00 00 00 0E 00 00 00-0F 00 00 00 10 00 00 00
11 00 00 00 12 00 00 00-13 00 00 00 14 00 00 00
15 00 00 00 16 00 00 00-17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00-1B 00 00 00 FF FF FF F8

As with FAT16, F8 is the media descriptor byte. The next 7 bytes, FF FF 0F FF FF FF 0F, are reserved. The clusters are grouped in 4 byte numbers as:

03 00 00 00, 04 00 00 00, 05 00 00 00, 06 00 00 00 

And so on. Invert the numbers to read:

00 00 00 03, 00 00 00 04, 00 00 00 05, 00 00 00 06 

And so on, to trace the file through the FAT. (The contents in the second entry is 00 00 00 03. F8 FF FF FF, and FF FF FF 0F are grouped as entries 0 and 1 respectively.) The new end of file marker is FF FF FF F8.

How Win.com Determines Improper Shutdown

Of the first 112 bytes of the FAT32, the first 8 bytes are reserved. The eighth byte of the reserved area, by default, is 0F. The virtual file allocation table (VFAT) and the Windows 98 shutdown process manipulate the fourth bit of this byte to 1 or 0.

When you write a file to the disk, VFAT handles the write. During the write, VFAT clears the fourth bit to 0 (07h). When Windows 98 exits properly, this bit is reset to 1. During reboot, Win.com reads that bit. If it is set to 0, it runs ScanDisk to check the drive for errors.

Hard Sector Error.

Windows 98 detects a hard sector error during startup. This process toggles the third bit to zero (0Bh). When detected during startup, Windows 98 automatically launches ScanDisk with a surface scan test.

Disabling ScanDisk at Boot.

There is a way to disable the improper shutdown check. It is in the Msdos.sys file under [OPTIONS]. The parameters for AutoScan are as follows:

Value Definition
AUTOSCAN = 0 Ignore the bits in the reserved FAT entry
AUTOSCAN = 1 Default behavior, run ScanDisk

Mirroring

On all FAT drives, historically, there are two copies of the FAT. If an error occurs reading the primary copy, the file system will attempt to read from the backup copy. On 12-bit and 16-bit FAT drives, the first FAT is always the primary copy and a modification is automatically written to the second copy. When a second FAT is written to as a backup, the process is called mirroring.

On new FAT32 drives, mirroring a secondary FAT can be disabled. This means that a read/write is quicker using one FAT, or if the first FAT is sitting on corrupted sectors, the second FAT can be used as a primary with the first FAT ignored.

Note

On FAT32 drives, a FAT can be very large. Disabling duplicate FAT writes can make FAT access quicker. Windows 98 does not provide a mechanism for eliminating the use of a second FAT. Mirroring is always enabled. Third-party utilities, however, might include this ability as users with larger hard disks might want to disable a second FAT to speed disk access. Any issues about mirroring should be directed to that third-party utility.

Root Directory

With FAT32, the limitation is now 65,535 root directory entries.

There is a new entry in the Boot Sector that points to the first cluster of the root directory. The root directory is no longer forced to reside at a specific location after the second FAT and it can grow just like a subdirectory.

There is a trade off in performance when you have a large number of directory entries to pass across when searching for actual data. For this reason, it is recommended that you limit the number of root directory entries to a small, manageable number. There is no actual recommended size for the same reasons as there is no optimal cluster size to choose from.

Extensions Changed, Superseded, or No Longer Supported

The following list presents some areas where FAT32 may be incompatible with legacy software:

VCACHE and CDFS Supplemental Cache

The 32-bit VFAT works in conjunction with a 32-bit, protected-mode cache driver (VCACHE), and replaces and improves on the 16-bit, real-mode SMARTDrive disk cache software provided with MS-DOS and Windows 3.1.

The VCACHE driver uses an improved caching algorithm over SMARTDrive to cache information read from or written to a disk drive, and results in improved performance for reading information from the cache. Also, the VCACHE driver is responsible for managing the cache pool for the Universal Disk Format (UDF) system, and the 32-bit network redirectors.

Another big improvement in VCACHE over SMARTDrive is that the memory pool used for the cache is dynamic and is based on the amount of available free system memory. Users no longer need to allocate a block of memory to set aside as a disk cache; the system automatically allocates or deallocates memory used for the cache based on system use. The performance of the system also scales better than earlier versions of Windows, due to the intelligent cache use.

The 32-bit, protected-mode CDFS implemented in Windows 98 provides improved CD-ROM access performance over the real-mode MSCDEX driver in Windows 3.1 and is a full 32-bit ISO 9660 CD file system. The CDFS driver replaces the 16-bit, real-mode MSCDEX driver, and it features 32-bit, protected-mode caching of CD-ROM data. If MSCDEX is specified in the user’s Autoexec.bat when Windows 98 is installed, the 32-bit CDFS driver is used instead.

CDFS has a larger and smarter cache than MSCDEX, optimized just for CD-ROMs and separate from VCACHE. The CDFS driver cache is dynamic and requires no configuration or static allocation on the part of the user.

CDFS reads ahead in parallel with the application so that multimedia presentations play back more smoothly than with earlier versions of Windows. Because CDFS uses a separate cache, the cache memory can be swapped out to the hard disk when CD-ROM activity pauses. This gives applications more room to run and protects the main hard disk cache from being flushed out whenever a very large multimedia stream is played back.

The supplemental cache size for CDFS is used to hold path, table, directory, and file information. This particular cache is used to improve CD streaming and to reduce seek latency as effectively as possible with a moderately sized cache. This means that the cache is more complex, using smart priority-based caching schemes to achieve results optimized for CD-ROMs.

For more information about configuring the CD-ROM cache to match the characteristics of CD-ROM drive types, see Chapter 26, "Performance Tuning."

Command-Line Switches for Disk Utilities

This section describes the commands that can be used from the command line to run ScanDisk, DriveSpace, and Disk Defragmenter disk utilities. These commands are provided to allow these disk utilities to be run from batch files.

Note

To provide compatibility with existing batch files, Windows 98 provides a start command to allow synchronous use of Windows-based programs from the command-line. To run a Windows-based program from the command-line and wait for it, use this syntax:

start /W "program_name arguments"

Defrag

This command controls Windows 98 Disk Defragmenter.

Syntax

defrag [drive: | /all] [/F | /U | /Q] [/noprompt] [/concise | /detailed]

Parameters
drive:
Drive letter of the disk to be optimized.
/all
Defragment all local, nonremovable drives.
/F
Defragment files and free space.
/U
Defragment files only.
/Q
Defragment free space only.
/concise
Display the Hide Details view (default).
/detailed
Display the Show Details view.
/noprompt
Unattended mode; do not stop and display confirmation messages.

DrvSpace

This command controls Windows DriveSpace at the command line, and can be used with either DblSpace or DrvSpace drives. These command switches are maintained for use in batch files and for compatibility with the compression utilities provided in MS-DOS version 6 and higher. Each switch performs the indicated operation, without asking for any additional input before beginning.

Additionally, the /interactive switch can be added to any command line to have DriveSpace ask for any missing parameters, and the /noprompt switch can be added to any syntax except the /info and /settings command-lines. The /noprompt switch prevents any confirmation dialog boxes from appearing (except for error messages). Notice that there is no way to prevent error messages from being displayed.

When you run DriveSpace without command-line arguments, the DriveSpace Manager appears, with menu commands for selecting the operations to perform.

Syntax

drvspace /compress d: [/size=n| /reserve=n] [/new=e:]
drvspace /create d: [/size=n | /reserve=n] [/new=e:] [/cvf=nnn]
drvspace /delete d:\d??space.nnn
drvspace /format d:\d??space.nnn
drvspace /host=e: d:
drvspace [/info] d:
drvspace /mount {[=nnn] d: | d:\d??space.nnn} [/new=e:]
drvspace /move d: /new=e:
drvspace /ratio[=n] d:
drvspace /settings
drvspace
/size[=n| /reserve=n] d:
drvspace /uncompress d:
drvspace /unmount d:

Parameters
d??space.nnn
The file name of the hidden compressed volume file on the host drive, which can be either Drvspace.nnn or Dblspace.nnn, where nnn represents the actual file name extension.

The following sections provide details about these parameters.

If you add switches or parameters to the drvspace command, the operating system carries out the requested task without starting the DriveSpace program. The command syntax differs from task to task, as summarized in the following list.

Action Command
Compress a hard disk drive or floppy disk. drvspace /compress
Create a new compressed drive in the free space on an existing drive. drvspace /create
Delete a compressed drive. drvspace /delete
Format a compressed drive. drvspace /format
Display information about a compressed drive. drvspace /info
Mount a compressed volume file (CVF). When DriveSpace mounts a CVF, it assigns it a drive letter; you can then use the files that CVF contains. drvspace /mount
Change estimated compression ratio of a compressed drive. drvspace /ratio
Change the size of a compressed drive. drvspace /size
Uncompress a compressed drive. drvspace /uncompress
Unmount a compressed drive. drvspace /unmount

Dblspace.bin, Drvspace.bin, and Drvspace.sys

Dblspace.bin or Drvspace.bin is the part of the system that provides access to the compressed drives. When you start the computer, the operating system loads D??space.bin along with other operating system functions, before carrying out the commands in Config.sys and Autoexec.bat. D??space.bin initially loads in conventional memory, since it loads before device drivers that provide access to upper memory. Normally, if the hard disk drive has been compressed using DriveSpace, D??space.bin is loaded even if you press F8 and choose an alternate startup option.

Drvspacx.vxd is the protected-mode driver for DriveSpace. This driver takes over from the real-mode D??space.bin driver when Windows 98 switches to protected mode. The real-mode driver is required for starting the computer, but after the system switches to protected mode, DRVSPACX ensures that you have 32-bit, protected-mode performance, and the memory used by the real-mode driver is reclaimed.

The Dblspace.sys device driver does not provide access to compressed drives; instead it determines the final location of D??space.bin in memory. When loaded with a device command, the Dblspace.sys device driver moves D??space.bin from the top to the bottom of conventional memory. When loaded with a devicehigh command, Dblspace.sys moves D??space.bin from conventional to upper memory, if available. Whenever possible, Dblspace.sys moves a portion of D??space.bin into the HMA.

How DriveSpace Assigns Drive Letters

When you compress a drive using DriveSpace, it creates a new drive and assigns a drive letter to that drive. DriveSpace skips the first four available drive letters and assigns the next available drive letter to the new drive. For example, if the computer has only drives A, B, and C, DriveSpace skips letters D, E, F, and G, and assigns drive letter H to the new drive.

When assigning letters to additional drives (for example, if you compress another drive), DriveSpace works backwards from the first drive letter it assigned. In the example above, DriveSpace would next assign the letter G.

DriveSpace attempts to avoid drive-letter conflicts with drives created by fdisk, RAMDrive, networks, or other installable device drivers that assign drive letters. However, if a drive-letter conflict does occur, DriveSpace resolves the conflict by reassigning its drive letters.

Drvspace /Compress

Compresses the files and free space on an existing hard disk drive, floppy disk, or other removable media. Compressing an existing drive makes more space available on that drive.

Note

DriveSpace cannot compress a drive that is completely full. To compress the startup hard disk drive, the drive must contain at least 2 MB of free space. Other hard disk drives and floppy disks must contain at least 768 KB of free space. (DriveSpace cannot compress 360 KB floppy disks.)

Syntax

drvspace /compress drive1: [/new=drive2:] [/reserve=size]

Parameters
drive1:
Specifies the existing drive you want to compress.
Switches
/compress
Compresses the hard disk drive or floppy disk specified by the drive parameter. This switch can be abbreviated to /com.
/new=drive2:
Specifies the drive letter for the uncompressed (host) drive. After DriveSpace compresses an existing drive, the system will include both the existing drive (now compressed) and a new uncompressed drive. If you omit the /new switch, DriveSpace assigns the next available drive letter to the new drive.
/reserve=size
Specifies how many megabytes of space to leave uncompressed. Because some files do not work properly when stored on a compressed drive, you may want to reserve some uncompressed space. The uncompressed space will be located on the new uncompressed drive. This switch can be abbreviated to /reser.
Drvspace /Compress Examples

To compress drive D, type the following command:

drvspace /compress d: 

On drives larger than 256 MB, more space will be left on the host (because D??space drives cannot be larger than 512 MB). Because this command does not specify how much space to leave uncompressed, DriveSpace leaves 2 MB of uncompressed space (the default). Because the command does not specify a drive letter for the uncompressed drive, DriveSpace assigns the next available drive letter to the new uncompressed drive (the host drive).

To direct DriveSpace to compress drive E, assign the drive letter F to the new uncompressed drive (the host drive), and leave 4 MB of uncompressed space on drive F, type the following command:

drvspace /compress e: /new=f: /reserve=4 
Drvspace /Create

Creates a new compressed drive by using free space on an uncompressed drive. The new compressed drive will provide more storage capacity than the amount of space it uses.

Syntax

drvspace /create drive1: [/new=drive2:] [/size=size | /reserve=size] [/cvf=nnn]

Parameters
drive1:
Specifies the uncompressed drive that contains the space you want to use to create the new drive.
Switches
/create
Creates a new compressed drive by using free space on the uncompressed drive specified by drive1. This switch can be abbreviated to /cr.
/new=drive2:
Specifies the drive letter for the new compressed drive. The /new switch is optional; if you omit it, DriveSpace assigns the next available drive letter to the new drive.
/reserve=size
Specifies how many megabytes of free space DriveSpace should leave on the uncompressed drive. To make the compressed drive as large as possible, specify a size of 0.

You can include either the /reserve switch or the /size switch, but not both. If you omit both switches, DriveSpace uses all but 2 MB of free space. The /reserve switch can be abbreviated as /reser.

/size=size
Specifies the total size, in megabytes, of the compressed volume file. (This is the amount of space on the uncompressed drive that you want to allocate to the compressed drive.) You can include either the /reserve switch or the /size switch, but not both.
/cvf=nnn
Reports extension of the CVF file.
Drvspace /Create Examples

To create a new compressed drive that uses all available space on uncompressed drive E, type the following command:

drvspace /create e: /reserve=0 

To create a new compressed drive by using 10 MB of space on uncompressed drive E, type the following command:

drvspace /create e: /size=10 

To create a new compressed drive by using space on uncompressed drive D, and to direct DriveSpace to leave 2.75 MB of free space on drive D, type the following command:

drvspace /create d: /reserve=2.75 

The following command creates a new compressed drive by using all but 2 MB of the space on drive D:

drvspace /create d: 

Because the command includes neither the /reserve switch nor the /size switch, DriveSpace uses the default value for the /reserve switch and leaves 2 MB of space on drive D.

Drvspace /Delete

Deletes the selected compressed drive and erases the associated compressed volume file.

Caution

Deleting a compressed drive erases the entire drive and all the files it contains.

Syntax

drvspace /delete d:\d??space.###

Parameters
d:\d??space.###
Specifies the drive you want to delete. (DriveSpace will not allow you to delete any drive containing open files, including the drive containing Windows 98.)
Switch
/delete
Deletes the specified drive. This switch can be abbreviated as /del.
Drvspace /Delete Example

The following command directs DriveSpace to delete the compressed volume for drive C:

drvspace /delete h:\dblspace.### 

DriveSpace then deletes the compressed volume file for drive C. This completely erases the compressed drive and all the files it contains.

Drvspace /Format

Formats the selected compressed drive.

Caution

Formatting a compressed drive deletes all the files it contains. You cannot unformat a drive that has been formatted by using drvspace /format.

Syntax

drvspace /format d:\d??space.###

Parameters
d:\d??space.###
Specifies the drive you want to format. (DriveSpace will not allow you to format any drive containing open files, including the drive containing Windows 98.)
Switch
/format
Directs DriveSpace to format the specified compressed drive. This switch can be abbreviated as /f.
Drvspace /Format Example

The following command directs DriveSpace to format compressed drive E:

drvspace /format h:\dblspace.### 

DriveSpace then formats compressed drive E, which completely erases all the files on it.

Drvspace /Info

Displays information about the selected drive’s free and used space, the name of its compressed volume file, and its actual and estimated compression ratios. You can use this command while Windows is running.

Syntax

drvspace [/info] | [drive:]

Parameters
drive:
Specifies the compressed drive about which you want information. If you do not specify a drive letter, DriveSpace displays information about the current drive.
Switch
/info
Directs DriveSpace to display information about the selected drive. This switch is optional and can be omitted as long as you specify a drive letter.
Drvspace /Info Examples

The following command displays information about the current drive:

drvspace /info

The following command displays information about drive C:

drvspace /info c: 

The following command displays information about drive E:

drvspace e: 
Drvspace /Mount

Establishes a connection between a compressed volume file (CVF) and a drive letter so that you can use the files the CVF contains. DriveSpace usually mounts CVFs automatically. You need to mount a CVF only if you previously unmounted it.

Syntax

drvspace /mount[=nnn] drive1: [/new=drive2:] drvspace /mount d:\d??space.### [/new=drive2:]

Parameters
drive1:
Specifies the drive that contains the compressed volume file you want to mount. You must specify a drive letter.
Switches
/mount=nnn
Directs DriveSpace to mount the compressed volume file with the file name extension specified by the nnn parameter. For example, to mount a CVF named DBLSPACE.001, you would specify /mount=001. If you omit the nnn parameter, DriveSpace attempts to mount the compressed volume file named DBLSPACE.000.
/new=drive2:
Specifies the drive letter to assign to the new drive. This switch is optional; if you do not specify a drive letter, DriveSpace assigns the new drive the next available drive letter.
Drvspace /Mount Examples

To mount a compressed floppy disk in drive A, type the following:

drvspace /mount a: 

To mount the compressed volume file DBLSPACE.001 located on uncompressed drive D, type the following:

drvspace /mount=001 d: 
Drvspace /Ratio

Changes the estimated compression ratio of the selected drive. DriveSpace uses this ratio to estimate how much free space the drive contains. You might want to change the estimated compression ratio if you plan to store new files with a compression ratio that differs greatly from the current ratio.

Syntax

drvspace /ratio[=r.r] [drive:]

Parameters
drive:
Specifies the drive for which you want to change the estimated compression ratio. If you do not specify a drive, DriveSpace changes the estimated compression ratio for the current drive.
Switch
/ratio=r.r
Changes the estimated compression ratio of the specified drive. To change the ratio to a specific number, specify the ratio you want. You can specify a ratio from 1.0 to 16.0. However, not all drives can accept values in this entire range. If you do not specify a ratio, DriveSpace sets the drive’s estimated compression ratio to the average actual compression ratio for all the files currently on the drive. This switch can be abbreviated as /ra.
Drvspace /Ratio Examples

To change the estimated compression ratio of the current drive to match that drive’s actual compression ratio, type the following command:

drvspace /ratio  

To change the estimated compression ratio for drive D so that it is 3.2 to 1, type the following:

drvspace /ratio=3.2 d: 

To change the estimated compression ratio of the current drive to 6 to 1, type the following:

drvspace /ratio=6 
Drvspace /Size

Enlarges or reduces the size of a compressed drive. You might want to enlarge a compressed drive if its host drive contains plenty of free space. You might want to reduce its size if you need more free space on the host drive.

Syntax

drvspace /size[=size1 | /reserve=size2] drive:

Parameters
drive:
Specifies the drive you want to resize.
Switches
/size=size1
Changes the size of the specified drive. You can specify the new size of the drive by using the size1 parameter. The size of the drive is the number of megabytes of space that the drive’s compressed volume file uses on the uncompressed (host) drive.

You can specify the drive’s new size by using either the size1 parameter or the /reserve switch, but not both. If you include neither the size1 parameter nor the /reserve switch, DriveSpace makes the drive as small as possible.

/reserve=size2
Specifies how many megabytes of free space you want the uncompressed (host) drive to contain after DriveSpace resizes the drive. The /reserve switch can be abbreviated as /reser.

You can specify the drive’s new size by using either the /reserve switch or the size1 parameter of the /size switch, but not both. If you include neither the /reserve switch nor the size1 parameter, DriveSpace makes the drive as small as possible.

Drvspace /Size Examples

To change the size of drive C so that its compressed volume file uses 60.5 MB of space on drive D, type the following command:

drvspace /size=60.5 c: 

To change the size of drive E so that its host drive, drive D, contains 20 MB of free uncompressed space, type the following command:

drvspace /size /reserve=20 e: 

To change the size of drive C so that it is as large as possible, type the following command:

drvspace /size /reserve=0 c: 
Drvspace /Uncompress

Uncompresses a drive that was compressed by using DriveSpace.

Syntax

drvspace /uncompress drive:

Parameter
drive:
Specifies the drive you want to uncompress.
Switch
/uncompress
Uncompresses the specified drive.
Notes on Drvspace /Uncompress

Backing up before uncompressing.

Before uncompressing the drive, you should back up the files it contains. If you include the /interactive switch, DriveSpace will prompt for this.

Invalid pathnames after uncompressing.

When you uncompress a drive, DriveSpace either changes that drive’s letter or the letter of its host drive (depending on how the compressed drive was originally created). DriveSpace shows how the drive letters will change when it decompresses the drive. Some programs have settings that include explicit pathnames and drive letters. If a program’s settings specify a drive that is no longer valid after uncompressing, the program will probably display an error message or be unable to find one of its components or data files. In that case, you need to correct the drive letter specified by that setting.

Disk space.

You can uncompress a drive only if the data it contains will fit on the host drive. If you use the drvspace /uncompress command, and DriveSpace indicates the drive will not have enough free disk space, delete unnecessary files or move them to another drive.

Duplicate file names on compressed and host drives.

If the root directories of the compressed and host drives contain files or directories with identical names, DriveSpace cannot uncompress the compressed drive. If this happens, DriveSpace displays an error message. Remove or rename one copy of each file, and then try uncompressing the drive again.

Uninstalling DriveSpace.

When you uncompress the last mounted compressed drive, DriveSpace first decompresses the drive, and then prompts you to remove the DrvSpace driver from memory.

Drvspace /Uncompress Example

To uncompress drive E, type the following command:

drvspace /uncompress e:
Drvspace /Unmount

Breaks the connection between the selected drive’s compressed volume file and its drive letter. Unmounting a drive makes it temporarily unavailable.

You cannot unmount a drive containing open files, including the drive containing Windows 98.

Syntax

drvspace /unmount [drive:]

Parameters
drive:
Specifies the drive you want to unmount. This parameter is optional; if you omit it, DriveSpace unmounts the current drive.
Switch
/unmount
Unmounts the specified compressed drive.
Drvspace /Unmount Example

To unmount compressed drive E, type the following command:

drvspace /unmount e: 

ScanDisk

This command syntax controls Windows ScanDisk.

Note

At the command prompt (for example, when you use F8 to start only the command prompt), you can use scandisk with the same switches to run the MS-DOS-based equivalent for this command. At the command prompt, type scandisk /? for more information.

Syntax

scandskw [drive:] [/A] [/N] [/P]
scandisk drive:\dblspace.nnn
scandisk drive:\drvspace.nnn

Parameters
drive:
Specifies one or more drives to be checked.
/A or /All
Checks all local, nonremovable hard disk drives.
/N or /NonInteractive
Starts and closes ScanDisk automatically. However, this switch does not prevent ScanDisk from stopping to report errors found on the drive.
/p or /Preview
Runs ScanDisk in Preview mode, where it reports and seems to correct errors that it finds, but it does not actually write changes to the disk.

Important

When running scandskw in Preview mode, it appears as though ScanDisk is fixing errors, but it is not. Also, notice that unlike other settings in ScanDisk, the /Preview switch is not saved in the registry, so the next time you run ScanDisk, it is no longer in Preview mode.

To determine whether ScanDisk is running in Preview mode, look for the tag "(Preview)" in the caption of the main ScanDisk window.

Dblspace.nnn or Drvspace.nnn
Checks the specified unmounted DoubleSpace or DriveSpace compressed volume file, where nnn is the file name extension for the hidden host file.

Table 10.7 describes the codes provided when ScanDisk finished running.

Table 10.7 Exit codes after ScanDisk has finished

Exit code Description
0x00 Drive checked, no errors found.
0x01 Errors found, all fixed.
0xFA Check could not start — cannot load or find Dskmaint.dll.
0xFB Check could not start — insufficient memory.
0xFC Errors found, but at least some were not fixed.
0xFD At least one drive could not be checked.
0xFE Check was canceled.
0xFF Check was terminated because of an error.

You can capture the exit code in a batch file to define an action to take in the event of particular exit code. For example:

start /w scandksw c: d: /n
if errorlevel exitcode goto command
...

In this sample, start /w forces the batch file to stop and wait for scandskw to finish (otherwise, because it is a Windows-based program, the batch file would continue as soon as scandskw had been launched). Also in this example, if the actual exit code is greater than or equal to the exit code specified by exitcode, the batch file runs the specified command; otherwise, it continues to the next line in the batch file. The goto command entry could specify any command you want.