Chapter 6. Disk Drive Performance Hacks

Introduction: Hacks #58-67

While filesystem choices can have an effect on storage efficiency and performance, the hacks in this chapter address a variety of topics on getting the best raw hardware performance possible from your system board and disk drives. As with most performance-related things, lower timing values and higher clock, rotation, and data transfer speeds yield the best results.

Disk performance is ultimately measured in bytes transferred per second, which can be metered with a variety of benchmarking programs, such as SiSoft Sandra (http://www.sissoftware.net). Such programs can also tell you what the capabilities of your system board and disk drives are so you can determine if the real performance is living up to specification.

The following list describes the capabilities of each type of disk drive interface you’re likely to encounter. From this list and a benchmarking program, you can tell what type of changes you can make to improve overall disk performance. Each version of the ATA specification, maintained by the industry trade group T13 (http://t13.org/), covers one or more implementations of technology and performance. You will find a lot of uses of the term ATA— UltraATA, UltraDMA, ATA-33, etc.—on product packages and advertising material. These labels may be misleading, as they can cover a wide range of capabilities from ATA-3 to ATA-5 rather than relating to specific industry standards. Check the product package and documentation to find the actual ATA industry standard a product is designed for when making performance comparisons. The current specification is ATA-5, which covers 44-133 Mbps data transfer rates using DMA-4 and UDMA-5 I/O methods.

ATA

Uses Programmed I/O Mode 1 (PIO-1) for a maximum data transfer rate of 4 megabytes per second (MBps). PIO mode requires constant attention by the CPU to handle data transfers at the expense of other I/O transactions and program operations.

ATA-2 (aka ATA-16)

Uses DMA-2 for a maximum data transfer rate of 16 MBps. DMA differs from PIO in that the CPU opens a direct memory-to-I/O device communications channel to let data flow freely without CPU intervention, so other I/O and program operations can continue at the same time.

ATA-3 (aka ATA-16)

Uses DMA-2 for a maximum data transfer rate of 16 MBps; ATA-3 devices are ATA-2 devices with the addition of S.M.A.R.T. internal drive diagnostic technology to “predict” drive failures.

ATA/ATAPI-4 (aka ATA-33, DMA-33, or UDMA-33)

Uses UDMA-2 for a maximum data transfer rate of 33 MBps.

ATA/ATAPI-5 (aka ATA-66, DMA-66, or UDMA-66)

This is the first in a series of devices with significant DMA-mode performance increases. Uses UDMA-4 for a maximum data transfer rate of 44 or 66 MBps. Requires 80-wire cable [Hack #59] to achieve maximum throughput.

ATA/ATAPI-5 (aka ATA-100 or UDMA-100)

This update to the ATA-5 specification increases the throughput capabilities to 100 Mbps using UDMA-5 I/O methods.

ATA/ATAPI-5 (aka ATA-133 or UDMA-133)

This update to the ATA-5 specification increases the throughput capabilities to 133 Mbps using UDMA-5 I/O methods.

As you can see from the list, Direct Memory Access (DMA) is required to achieve the highest possible performance, but data transfer mode is not the only determining factor affecting overall drive performance.

Direct Memory Access DMA is a feature that allows an I/O device and memory to directly interact for faster data transfer without the CPU. DMA transfers occur in a burst or periodic timeframe, allowing control to be returned to the CPU to handle other program operations.

There are three other factors about the hard drive itself to consider, rotation speed, seek time, and on-disk cache [Hack #58] .

Choose the Fastest Hard Drive

Did you know that the “high performance Brand X” hard drive inside your PC is probably not the highest performance version of the drive that “Brand X” makes? PC manufacturers use the most current disk drive series available from their drive vendor, but typically only the most economical model of that series. Your PC maker buys a select version of the popular disk drive brands, so their “select” or so-called “OEM” components are not necessarily top of the line, even if you think your PC maker is the best in the world.

Tip

OEM, or Original Equipment Manufacturer, has become a generic term for products branded or labeled by a “big name” company like Hewlett-Packard or Dell that are actually made by another company. For example, that beautiful charcoal gray or black monitor with the Dell logo on the front is not actually manufactured by Dell but by Sony, NEC, Nokia, or a no-name assembler of PC parts with a license and a big order to produce a lot of Dell-branded products.

The big PC makers do not make disk drives; they make a special deal to get a lot of drives from either of three or four different drive makers and then put their name on them. The PC maker makes more profit if they can “OEM” a cheaper but adequately performing disk drive.

If you are a do-it-yourself PC builder, you’ll also hear the term “OEM” in reference to some of the components that you can buy directly from an online retailer like Newegg (http://www.newegg.com). OEM parts typically come with nothing more than some packaging and a minimal warranty. Compare this to retail boxed versions that include fancy packaging, a longer warranty, and some extras. For example, a retail CPU will usually include a heat-sink/fan unit, while an OEM CPU includes nothing except the anti-static packaging.

Often the same basic drive mechanics and electronics are used across different models of disk drives to minimize manufacturing complexities. Then drives are tested to see if they meet maximum, intermediate, or minimal performance specifications, reprogrammed, and then labeled and sold accordingly. This is similar to the practice of CPU and memory makers that sell the same components at different performance and price points to maximize profits from their manufacturing processes (providing many opportunities to overclock and hack more performance from lesser-rated parts).

Disk drive models from the same manufacturer, in the same model series, differ either by programmed-in or actual speed and access-time limitations, amount of on-drive data buffering, and even total available drive capacity. Western Digital (http://www.wdc.com) openly lists “High-Performance EIDE,” “Mainstream EIDE,” and “Value EIDE” drive families with essentially the same capacities but different performance specifications. When you go to buy a disk drive, be sure to check specific model numbers and the labeling on the packaging to be sure you are getting the performance you expect. Unfortunately there are no known ways to hack into disk drives, change their firmware or operating parameters, and gain similar performance improvements as you have seen with hacking CPU and memory speeds.

A top-of-the-line model might be available with the following specifications:

  • Rotation speed (how fast the disk platter spins): 7,200 RPM

  • Buffer size (the amount of on-disk cache memory): 8 MB

  • Average latency (the average length of time it takes the drive electronics and mechanics to begin responding to a command to perform a function—seek, read, or write): 4.20 milliseconds

  • Average read-seek time (the average time it takes the read/write heads to find a specific disk track and be able to read data from it): 8.9 milliseconds

  • Average write-seek time (the average time it takes the read/write heads to find a specific disk track and be able to write to it): 10.9 milliseconds

  • Track-to-track seek time (the length of time it takes the read/write heads to travel from one data track on the disk platter to an adjacent track): 2.0 milliseconds

  • Full-stroke seek (the length of time it takes the read/write heads to travel from inside to outside of the disk surface): 21 milliseconds

  • Buffer-to-disk transfer rate (how fast the data gets written to disk from the on-disk cache): 737 megabits per second

The same drive maker’s value-line specifications read:

  • Rotation speed: 5,400 RPM (25% slower)

  • Buffer size: 2 MB (75% smaller)

  • Average latency: 5.00 milliseconds (20% slower)

  • Average read-seek time: 8.9 milliseconds

  • Average write-seek time: 10.9 milliseconds

  • Track-to-track seek time: 2.0 milliseconds

  • Full-stroke seek: 21 milliseconds

  • Buffer-to-disk transfer rate: 506 megabits per second (30% slower)

Even though the seek times are the same, and both drives support UDMA Mode 5 or ATA-100 I/O performance to the system interface, you can see from the rotation speed, buffer size, latency, and buffer-to-disk parameters that the value-line disk will be slower than the high-performance model.

Why would you want a slower drive in your system? Slower drives are a bit quieter. It’s cheaper to make slower drives and reduce the amount of buffer memory; the lower cost of the drive means your total system can be more affordable—but wouldn’t you like it to be faster ?

The performance of the disk drive makes a significant difference. The disk drive is the slowest critical component in your system. No matter how fast your CPU and RAM are, the system’s biggest bottleneck is the disk drive. A faster drive can make a system with a slow CPU speed bootup and work faster than one with a higher CPU speed (even with the same amount of RAM). Look to the specs and buy the best, especially when shopping for a value-priced PC.

If it’s time to upgrade the disk drive in your second PC, consider buying the best drive you can for your main PC and move its drive to the second PC or an external enclosure—no sense giving your old PC something better than your new one has!

Use an 80-Wire Cable

It’s not free, but upgrading your hard drive cable could be a very economical boost to your disk drive’s performance.

It’s all about the data, and in this case how reliably the data makes it between your disk drive and the interface on your system board—and that depends on the quality of the short ribbon cable interconnecting the two. The original IDE drive and 40-pin cable specifications were not too picky about the length and type of cable used, did not require nor provide shielding from other signals nearby, and could not deliver higher data transfer rates.

Almost every PC built in the last 3-4 years comes with a newer style 80-wire cable attached to 40-pin connectors at each end. In an 80-wire cable, 40 of the wires do the same things they always did: handle data and control signals and provide common ground for the signals. The additional 40 wires provide extra protection for the very fast, sensitive data signals traveling through the other 40 wires. The result is the ability to have and fully take advantage of the performance benefits of the fastest UDMA-/ATA-100 and UDMA-/ATA-133 disk drives and interfaces that would otherwise be impaired by noisy signals on 40-wire cables.

You don’t need to wait until you upgrade to a new PC or even a new disk drive to benefit from the new cable type. Most systems with UDMA-/ATA-66 disk drives and interfaces get a performance benefit from upgrading the interface cable from a 40-wire to an 80-wire cable because the new cable reduces performance-robbing noise for any disk drive, though not significantly enough to matter for ATA-33 and slower drives like CD-ROMs and much older disk drives (typically less than 500 megabytes as a general rule).

The 80-wire (Figure 6-1) enhanced IDE cable costs about $6 at most computer stores and is easily replaced in about 5 minutes. You’ll probably notice the system booting up faster right away.

Comparing a 40-wire (left) and an 80-wire (right) IDE cable
Figure 6-1. Comparing a 40-wire (left) and an 80-wire (right) IDE cable

Upgrade Your IDE Interface

Speed up your system with a turbocharged IDE interface.

If you are stuck with a slower ATA-33, ATA-66, or ATA-100 IDE interface on your system board and want to soup up the system with an ATA-133 drive, you can disable the built-in interface, install a new IDE interface board, connect your new super-fast drive with a shiny new 80-wire cable, and zoom ahead.

Promise Technology (http://www.promise.com) offers two replacement Ultra ATA adapters: the Ultra100 TX2 and the Ultra133 TX2. These interface cards and similar versions from other manufacturers like Belkin (http://www.belkin.com) are available through computer retailers for $50 and up.

The adapters can only enhance the performance of systems with a 66 MHz PCI bus, so the upgrade is not effective for users of Pentium I and some Pentium II system boards with only 33 MHz PCI speed.

To upgrade your present system with a faster EIDE add-in card, follow these steps:

  1. Following the add-on card manufacturer’s instructions, install the card and drivers.

  2. Install your hard drive and connections for data and power.

  3. Start up your PC and verify that the new drive interface and drive are identified and available for use.

  4. If you are going to use your new drive for data only, partition and format the drive using your operating system’s disk management tools or third-party utilities. If you are going to boot and run the operating system from the new drive, do the following:

    1. To preserve your current operating system, application programs, and data, use a disk-cloning program like Symantec’s Ghost [Hack #95] to copy your old drive to the new drive.

    2. After cloning, shut down the system and remove your old drive unless you are going to use it as an extra data drive. If you remove the old drive, restart the system and access your system BIOS menu to select which drive you want the BIOS to boot the system from. If the old drive is to remain as a spare data drive, you can either erase all of the old data or reformat the drive.

Kick It Up a Notch with Serial ATA

Upgrading to Serial ATA will stomp all over UDMA-5’s 133 MBps performance.

Disk drives using the new Serial ATA (SATA) data interface could deliver data throughput performance enhancements 12%, 125%, and even 350% higher than today’s fastest UltraIDE-133 disk drives. We won’t see these phenomenal (+125-350%) improvements as long as SATA interfaces on the system board continue to use the lagging PCI bus, but some motherboards with built-in SATA interfaces provide an alternative bus for higher performance. You can get that extra 12% boost today with Serial ATA-150 adapters, like Promise Technologies’s SATA150 TX4 and SATA150 TX2Plus.

Tip

Newer chipsets, such as the Intel 865PE, provide a separate data bus dedicated to faster storage devices. (For example, the 865PE provides a 150 MBps bus for Serial ATA.)

Serial ATA devices have spindle speeds and access times similar to the drives we’re already used to—7,200 RPM and 8.5 milliseconds. As drive manufacturers adapt their faster 10,000 and 15,000 RPM SCSI or Fibre Channel drive products with 4.7 and 3.6 millisecond access times to SATA, we begin to see a true performance enhancement for storage on everyday desktop systems. Still, various performance tests would lead us to believe that we could already achieve a 20% performance boost in data reading by switching to SATA—an improvement worthy of serious consideration.

The best way to achieve a storage speed boost using SATA drives today is to use them in a RAID-1 through RAID-5 configuration, which SATA is ideal for. SATA drives can be hot-plugged (connected and disconnected), just like you may be used to with your USB camera or FLASH-drive/memory stick, under Windows XP (Windows 2000 does not support hot-plugging these devices and complains when you disconnect them), so swapping out a failed drive can be done without a lengthy system reset or power down.

For those who like to trick out their PC cases with lights and cool-looking cables, SATA’s seven-wire data cable will help put an end to ribbon-cable-clutter. The connectors measure just 8 mm wide, and the cables can be up to a meter (39”) long, allowing for more flexible drive placement than is possible with parallel ATA.

Keep SATA in mind, look for system boards with true SATA interfaces for eventually faster performance rather than limiting SATA with a sluggish PCI-based SATA interface board, and give your data a test-drive. To upgrade a non-SATA system to a SATA drive, you’ll need to follow these steps:

  1. Check your system board maker’s web site to see if there are any issues with their BIOS and supporting SATA add-in cards (and get an upgrade if there is one to fix any SATA problems).

  2. Obtain a PCI-to-SATA interface board, with any required driver software included (but always check the manufacturer’s web site for updates).

  3. Get a SATA cable.

  4. Get a SATA power cable (to get power from the interface board) or an adapter to get power from a standard 4-pin-drive power connector.

  5. With the PC power turned off, follow the instructions to install the interface board—but install the drivers first if required, then power off and install the board. Make sure Windows recognizes the new board with the Add New Hardware wizard when you start up again.

  6. Shut down the system (power off) and install the new disk drive. Make sure Windows recognizes the new drive with the Add New Hardware wizard when you start up again.

  7. For Windows 95/98/Me, partition and format the disk with FDISK and FORMAT in DOS. For Windows 2000 and XP, use the Disk Management tools in Control Panel/Administrative Tools/Computer Management.

Get the Fastest IDE Driver for Intel Chipsets

The proper driver for your Intel is the key to top drive performance for free.

The Integrated Drive Electronics (IDE) interface ports that your hard drive and CD-ROM drive are connected to are basically standard across every PC system; they have to be for any operating system to recognize the ports and drives at startup. Once the operating system loads up, the IDE port can either languish in a low-performance state or be revved up to maximum potential with the right driver software.

If your system board uses an Intel chipset, there’s a good chance that the bundled IDE driver is not the latest and greatest, so go to Intel’s web site (http://downloadfinder.intel.com) and locate and download the IDE Bus Master driver that matches your chipset; in most cases one driver covers your system. If your system does not use an Intel chipset [Hack #63] , the driver will not install, so you’re safe from corrupting the system.

To identify if you have an Intel chipset and which one, go to http://www.intel.com/support/chipsets/sb/cs-009245.htm for tips on how to identify your chipset or get the Intel chipset identifier utility from http://downloadfinder.intel.com/scripts-df/Product_Filter.asp?ProductID=861. You can also determine if your operating system includes or needs Intel software by the charts at http://www.intel.com/support/chipsets/inf/sb/CS-009270.htm. The System Devices section in Windows Device Manager may also list Intel devices to help you narrow down what type of chipset you have.

Tip

A system information utility such as SiSoft’s Sandra, available at http://www.sisoftware.net, can provide a wealth of information about chipsets, system settings, and IDE drive modes.

Get the Fastest IDE Driver for Via Chipsets

Optimize your hard drive parameters for their best performance.

System boards that use Via chipsets (http://www.viatech.com) come with drivers for the many features of these boards, but one small program, known as the IDETool by Via, is often missing. IDETool is not a device driver but works with the Via chipset driver. IDETool runs in Windows and lets you view and reconfigure the I/O performance capabilities of your hard drives and CD-ROM drives. If you are using a current AMD CPU your system probably has a Via chipset, and there are Via chipsets for some Intel CPUs as well. The System Devices section in Windows Device Manager may also list Via devices to help you narrow down what type of chipset you have.

A typical Windows and driver installation will not have recognized and enabled advanced features such as the fastest DMA or multiword DMA performance levels the IDE interface and drives are capable of. Finding Via’s IDETool is not easy, and it is not provided with every version of Via chipset drivers, so you need to visit the following URLs to find it:

IDETool installs as a small resident program, giving you access to and ensuring the performance settings you want when Windows is running. Figure 6-2 shows IDETool in operation, indicating all of the possible I/O modes and other parameters of the disk drive and the current operating mode.

Via’s IDETool unlocks drive performance
Figure 6-2. Via’s IDETool unlocks drive performance

Speed It Up with RAID

If one fast drive is good, then five working together is surely better.

Redundant Array of Inexpensive Disks (RAID) technology has been a significant lifesaver and performance boost for file servers. RAID can be set up in different configurations to provide systems with fault-tolerance or performance enhancements that are crucial to keeping data safe. It can be applied to personal desktop systems to provide significant disk drive performance enhancement.

RAID-0 (zero) is the most basic and highest performing RAID configuration. Portions of data normally stored on one disk drive are spread out across multiple drives, and those drives are accessed in parallel to deliver the data faster, because each drive does not have to access all of the data before it can be delivered. RAID-0 is unfortunately and by nature the least reliable in terms of data integrity, because a failure in any single drive renders all of the data useless.

In contrast to RAID-0, in a RAID-1 configuration all of the data is stored equally on two drives, in parallel. This slows the storage and reading performance but almost guarantees that the data remains intact even if one of the drives fails.

RAID-5 is somewhat a mix of RAID-0 and RAID-1, striping data across multiple drives but also adding error correction information across the drives, providing the advantages of parallel drives and a high degree of ability to recover data if one drive should fail.

Another hybrid implementation of RAID that is very affordable and intended for desktop system is RAID-0+1. The Promise Technology (http://www.promise.com) FastTrak TX4000 RAID controller card is specifically meant for desktop users with an appetite for high-performance disk systems. Performance enhancements of up to 30% are possible. Upgrading with top-performing disk drives and putting them into a RAID configuration just might knock the dust bunnies out of your keyboard.

The basic steps to install a RAID configuration on your PC are listed below. Be aware that the specific steps will be unique to the RAID controller (system board or add-in card type), your system BIOS, and RAID configuration software. After installation, the RAID configuration should appear to your operating system as a single-disk volume.

  1. You need a RAID controller or RAID capabilities built into your system board. Promise Technologies is one of the most popular brands of add-in RAID controllers for IDE drives.

  2. Have at least two identical disk drives on hand for RAID-0 and 1. Configuration of a simple RAID is a lot easier if the drives are identical: there will be no wasted space, and they should mirror each other and perform equally well. RAID 0+1 will require at least four disks.

  3. If necessary, make a bootable DOS diskette with any necessary drivers or configuration program for your RAID controller. For BIOS-based RAID setups, familiarize yourself with the RAID setup screens and options in BIOS. It is likely you will have to connect the RAID drives to different IDE connections than the normal non-RAID IDE interfaces.

  4. With the system powered down, install and connect the drives to the RAID controller interface connectors.

  5. Start the system and either boot with the DOS diskette containing the RAID controller configuration program or get into the BIOS setup to access the RAID configuration screens.

  6. Select the type of RAID you will be creating—typically 0, 1, or 0+1.

  7. Partition the drives with the configuration program or BIOS screens. This process establishes how the RAID controller views and uses the drives.

  8. When RAID controller configuration and disk partitioning is complete, you will either FORMAT the drives under DOS or start the installation of your operating system onto the new RAID system as the primary boot drive.

  9. (RAID 1 and higher only) To test your configuration after installing your operating system, shut down and disconnect one of the RAID drives, then restart to verify that indeed the RAID system actually mirrors data to one of the drives.

Speed Up DOS with SMARTDRV

You can add a boost to disk performance with the DOS SmartDrive program.

Caching or reading data from a hard drive and storing it in RAM is one method to speed up disk drive performance. Most disk drives have at least some RAM dedicated to buffering data between the disk and the data cable, some disk drive interface cards and chips provide data caching, and even DOS and Windows provide disk caching. DOS’s own SmartDrive program, SMARTDRV.EXE, provides a tremendous performance boost for DOS systems. (If you install SMARTDRV for a Windows 95-98 system, Windows unloads SMARTDRV at startup. With or without SMARTDRV for DOS, Windows provides its own disk caching driver, VCACHE, to speed up disk performance [Hack #66] . For Windows Me and later, the device drivers and VCACHE provide disk caching.)

Loading SMARTDRV in DOS before running any DOS program or manually installing Windows will speed up the process tremendously.

SmartDrive provides a number of options for you to configure it, but as often as not, the simplest invocation is the best—it just works. SMARTDRV’s command line can look pretty convoluted with all these options, as shown and listed below, but the final examples shown are more than adequate for most of us:

SMARTDRV [/X] [[drive[+|-]]...] [/U] [/C | /R] [/F | /N] [/L] 
[/V | /Q | /S] [InitCacheSize [WinCacheSize]] 
[/E:ElementSize] [/B:BufferSize]

The available parameters for SmartDrive are:

/X

Disable write-behind caching for all drives.

drive

Sets caching options on specific drive(s). Takes the form of a single letter followed immediately by + or -. The specified drive(s) will have write-caching disabled unless you add +.

/U

Doesn’t load the CD-ROM caching module.

/C

Writes all information currently in write-cache to hard disk.

/R

Clears the cache and restarts SmartDrive.

/F

Writes cached data before the command prompt returns (default).

/N

Doesn’t write cached data before the command prompt returns.

/L

Prevents SmartDrive from loading itself into upper memory.

/V

Displays SmartDrive status messages when loading.

/Q

Does not display status information.

/S

Display status of read cache, write cache, and buffering for all drives.

InitCacheSize

Specifies XMS memory (KB) for the cache.

WinCacheSize

Specifies XMS memory (KB) for the cache with Windows. If this option is not specified, SMARTDRV will default the WinCacheSize to the amount of extended memory available.

/E:ElementSize

Specifies how many bytes of information to move at one time.

/B:Buffersize

Specifies the size of the read-ahead buffer.

Tip

To use SMARTDRV.EXE, you must have HIMEM.SYS loaded in your CONFIG.SYS file. To do this, add the line DEVICE= PATH TO HIMEM.SYS, as in DEVICE=C:DOSHIMEM.SYS.

To implement SmartDrive, follow this example:

  1. Open your C:AUTOEXEC.BAT file using Windows Notepad, the DOS Edit program, or another plain-text editor program.

  2. Insert either of the following lines near the top of the AUTOEXEC.BAT file, before the CD driver, MSCDEX, is loaded:

    c:dossmartdrv.exe /x

    which loads SMARTDRV, caches everything, using all available memory as needed, and writes data immediately to disk, or:

    c:dossmartdrv.exe C+ 1024 512

    which loads SMARTDRV, caches everything, and uses a megabyte of RAM for DOS but only 512 KB of RAM under Windows; data written to drive C: is cached/delayed for faster performance.

  3. Save the newly edited C:AUTOEXEC.BAT file and then restart your system. Alternatively, you can launch SMARTDRV from the DOS prompt with the desired arguments.

Speed Up Windows with VCACHE

If you absolutely must stick with Windows 9x or Me the least you can do is give your system this free performance-boosting tweak to your Windows disk cache.

The Windows operating system creates and maintains its own read-ahead disk-caching service to help speed things up, but Windows itself does not give you any direct control over VCACHE. Instead, you have to dig into the C:WINDOWSSYSTEM.INI file with a text editor to set the caching service to your liking.

When setting a value for disk caching, you have to balance the amount of RAM to be used for programs and data with the RAM set aside for disk caching. If a lot of RAM is assigned to disk caching, that leaves less for programs and data and Windows will use the swapfile more, which will slow things down. If you assign too little RAM for disk caching, disk operations may be a bit slower but Windows may use the swapfile less, thus keeping performance up a bit.

There is also another balancing act going on here: do you let Windows waste time looking in the cache for data that is not there, which can happen if the cache is too large, or give it less space to look through so it can get directly to the disk drive as quickly as possible? The best approach is to have just enough memory allocated for some caching benefit and not so much that we cheat our programs and Windows.

Fortunately most disk drives have between 256 KB and 8 MB of cache dedicated to data caching to and from the disk drive interface. So, as long as the IDE, SCSI, or SATA interface can keep up, the disk drive will not be a significant data bottleneck (beyond being hundreds of times slower than CPU and I/O bus speeds). With that in mind, you should not have to assign a lot of RAM to Windows disk caching.

Tip

Windows 98 has a known problem with VCACHE consuming all or nearly all available memory on systems with more than 512 MB of RAM, causing out-of-memory errors or crashes. Setting the parameters for VCACHE manually is the official fix for this problem.

To keep Windows from stealing too much RAM for VCACHE, you can add two lines to the SYSTEM.INI file to nail the disk caching down, following these steps:

  1. Using Notepad or DOS EDIT, open the C:WINDOWSSYSTEM.INI file, locate the section labeled [vcache], and insert two new lines:

    [vcache]
    minfilecache=256
    maxfilecache=256
  2. Save the file, close the editor, and then restart Windows for the changes to take effect.

I chose to give the cache only 256 KB of RAM because I’ve found that more is not always better. If you have a lot of RAM in your system, you may certainly use 512 or 1,024 KB, but you may not see a significant performance boost because of all of the overhead of Windows and drivers between the disk and the CPU.

Tip

Microsoft recommends that VCACHE not be set over 40 MB (40,000), which is a significantly high amount of RAM to leave for possible disk caching.

At most, matching the amount of cache on your hard drive—256 KB to 8 MB—may be the best balance between RAM consumption and drive performance.

Linux’s Drive Performance Booster

To be on the safe side, your new Linux installation starts up with the least common denominator of disk drive performance capabilities—typically DMA-33—robbing you of 50-150% of your potential performance. Once Linux is installed, you are free and encouraged to start tweaking the configuration of your disk drive and its interface to squeeze the most of them.

Warning

Setting HDPARM parameters too aggressively—that is, in excess of the disk controller or drive capabilities—can lead to data loss.

It is best to test HDPARM settings on a fresh installation of the operating system before committing any applications or programs to the drive and prepare to back down on the settings and reinstall the OS if the drive is unstable or the HDPARM tests show erratic results or fail.

The tool needed, HDPARM, is included with the operating system (or available from your package manager). It can be adjusted manually and then put into a startup script to make your chosen settings effective every time the system starts up.

HDPARM is a command-line utility that provides powerful control over your hard drive parameters (HD PARaMeters). It can also tell you a lot about your disk drive. Everything you do with HDPARM, until you make a script for it, will be done at the command line.

Tip

You must be logged in as root to run HDPARM. You can also use the sudo command to run the command as root if you have sufficient privileges.

Assume /dev/hda is the designation for your hard drive. (This is the default for the first IDE drive; a SATA drive may appear as /dev/hde if your motherboard also has IDE interfaces.) Run the following command:

            hdparm -i /dev/hda

You should get some info like the following:

/dev/hda:
Model=QUANTUM FIREBALLlct, FwRev=APL.1234, SerialNo=1234567
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs } 
RawCHS=16383/16/63, TrkSize=32256, SectSize=21298, ECCbytes=4 
BuffType=DualPortCache, BuffSize=418kB, MaxMultSect=8, MultSect=off
CurCHS=16383/16/63, CurSects=-66060037, LBA=yes, LBAsects=39876478
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120} 
PIO modes: pio0 pio1 pio2 pio3 pio4 
DMA modes: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5 
AdvancedPM=no 
Drive Supports : ATA/ATAPI-5 T13 1321D revision 1 : ATA-1 ATA-2 
ATA-3 ATA-4 ATA-5

This tremendous amount of data provided tells you:

MaxMultSect

The maximum number of sectors your hard disk can read at a time.

MultSect

The current number of sectors being read at a time.

PIO modes and DMA modes

The modes supported by your hard drive. The one marked with an asterisk (*) is the one currently set.

AdvancedPM

Indicates whether or not your hard drive supports Advanced Power Management.

Another command:

            hdparm /dev/hda

reveals the following information:

/dev/hda: 
multcount = 0 (on) 
I/O support = 0 (16-bit) 
unmaskirq = 0 (off) 
using_dma = 0 (off) 
keepsettings = 0 (off) 
nowerr = 0 (off) 
readonly = 0 (off) 
readahead = 8 (on) 
geometry = 2482/255/63, sectors = 39876480, start = 0

The items of interest are:

multcount

The number of sectors being read at a time.

I/O support

The operating mode of your hard disk (16/32/32sync).

using_dma

Whether or not the drive is using the DMA feature. This may be on by default if your version of Linux properly detects and supports your chipset and drive’s DMA capabilities.

keepsettings

Whether the settings are kept after the drive resets (usually caused by errors).

readonly

Whether the drive is read-only. Normally set to 1 only for CD-ROMs.

readahead

How many sectors ahead will be read when you access the hard drive.

The HDPARM program provides two performance-testing features that are crucial to letting you know whether or not you’re making improvements as you tweak along. The command:

            hdparm -Tt /dev/hda1

will show results such as the following before enhancing the performance:

/dev/hda1:
Timing buffer-cache reads: 128 MB in 5.97 seconds = 21.43 MB/sec
Timing buffered disk reads: 64 MB in 17.97 seconds = 3.56 MB/sec

and then results like these after enhancing the performance:

Timing buffer-cache reads: 128 MB in 0.91 seconds =140.66 MB/sec
Timing buffered disk reads: 64 MB in 3.78 seconds = 16.93 MB/sec

The goal of this hack is to see the time in seconds decrease and the MB/sec to increase. You can do that by using a variety of parameters, invoked one at a time, then rerunning the performance tests to see if things are improving or not.

Mistakes during the setup process may damage your filesystem and all of its data, so it’s best to do this after a fresh install of Linux or right after you’ve done a full backup.

Begin by setting the operating mode of the interface between the system and the disk drive using one of the following parameters:

            hdparm -c0 /dev/hda  #sets operating mode to 16-bits
hdparm -c1 /dev/hda  #sets operating mode to 32-bits
hdparm -c3 /dev/hda  #sets operating mode to 32-bits synchronized

Mode 1 (-c1) is used most often for best performance. Mode 3 (-c3) only is needed for some chipsets.

Next set the data transfer parameters, which you can determine from the output of the “-I” command shown earlier (in that case 8 is the maximum supported):

            hdparm -m8 /dev/hda

Next try activating DMA mode for your system interface:

            hdparm -d1

Then set the drive mode (a value of X32 is most common; UDMA-5 is X69):

            hdparm -X32 /dev/hda

or:

            hdparm -X69 /dev/hda

Finally, try setting the read-ahead value, which is typically set to the same value as multcount from earlier, or 8:

            hdparm -a8 /dev/hda

If any or all of these settings make incremental improvements in performance, remember them and create a script that sets them all sequentially or includes them all in one line. I prefer sequential lines to ensure the drive accepts each command separately and I do not lose a setting if another fails to take. From all of this, you might typically be using the following parameters:

            hdparm -c1
            hdparm -m8 /dev/hda
            hdparm -d1
            hdparm -X34 /dev/hda
            hdparm -a8 /dev/hda

Another single-command example that may work best for your system is:

            hdparm -X66 -d1 -u1 -m16 -c3 /dev/hda

Save either to a file and make the file a script to place in the directory for the runlevel at which you normally use Linux. For example:

  1. Using a text editor, create then save the script as /etc/init.d/hdparm.local.

  2. Configure it to start in runlevel 5 with the following command:

                      ln -s /etc/init.d/hdparm.local /etc/rc5.d/S20hdparm.local

The rc5.d part of the parameter string indicates runlevel 5, which is the normal operating mode for most Linux systems. To find out your default runlevel, examine /etc/inittab for the inittdefault entry, as in:

id:5:initdefault:

The next step is to keep an eye on dmesg and/or /var/log/syslog. In some cases, an error will cause the settings to be reset. So that’s where the -k (keep) flag comes in. If you’re 100% positive that these settings won’t corrupt your data, you can add -k to the script.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.165.247