Part 1 | Part 2
If you look at the various components in your computer, the hard disk is typically the slowest. This means that disk I/O can become a major bottleneck in the system's overall performance. When you combine slow hardware with inefficiencies in the file system, these delays can quickly become very noticeable. Fortunately, you can do several things to improve the efficiency of NTFS beyond occasionally defragmenting the volume.
Back in the days of DOS, the file system of choice was FAT (file allocation table). The FAT file system limited the length of a filename to eight characters plus a three character extension. Newer file systems such as FAT32 and NTFS allow the use of long filenames, but they also retain a FAT-style filename for backward compatibility purposes.
This filename alias can cause performance problems in a couple of different ways. First, the process of writing the filename alias consumes disk I/O cycles. Also, the filename alias forces the operating system to stop and calculate what the abbreviated filename should be.
That in itself incurs a minor performance hit. The real problem, though, is in the way that the filename alias is calculated. To create a filename alias, Windows looks at the first six characters of the original filename and then derives the alias from those six characters. Typically, the alias consists of the first six characters of the filename, a ~ sign and a number. A number is used at the end of the filename because it's possible that multiple files within a folder will have filenames in which the first six characters are identical.
Herein lies the problem. If you have a few files in which the first few characters of the filename are identical, it isn't really a big deal. However, when you start having large numbers of files in which the initial portion of the filenames are identical, Windows begins to spend more and more time trying to figure out what the filename alias should be. Once a directory contains a few thousand files with these characteristics, performance can really begin to suffer. According to some sources, if a folder contains 300,000 or more files that have identical initial portions of the filename, contradictions can begin to occur because Windows exhausts its pool of aliases for those files.
Today, the old "eight-dot-three"-style filenames are rarely necessary. Almost everyone uses FAT32 or NTFS as their file system, and backward compatibility with the FAT file system is seldom an issue anymore. That being the case, you might consider completely disabling support for backward compatibility. Doing so can greatly improve the file system's performance.
To disable backward compatibility, you can use a tool that was included with the Windows Resource Kit called Fsutil. Fsutil is a command-line tool designed to modify the behavior of the file system. The command for disabling backward compatibility is:
Fsutil behavior set disable8dot3 1
If you need to retain backward compatibility with the FAT file system, then you can improve performance by being careful how you name files. You should avoid placing large numbers of files into a single folder whenever possible. However, if you must place a lot of files into a folder, try structuring the filenames so that the first few characters of each filename are different, as opposed to making the last part of the filename the differentiating factor. Remember that Windows looks at the first six characters of a filename when creating an alias.
Resize the master file table
Another way to improve performance is to adjust the size of the master file table. The master file table is similar to the File Allocation Table used by the FAT file system. It is essentially a directory of all of the files and folders found on the hard disk volume. For this reason, it is critical to the volume's performance that the master file table remains as unfragmented as possible. As such, Microsoft has designed the NTFS so that 12.5% of the volume's disk space is reserved for the master file table.
Normally, this works out OK, but if the volume contains a large number of files (not necessarily large files), the amount of space reserved for the master file table can become inadequate. Likewise, if the volume starts to become low on disk space, Windows may start placing some of the smaller files into the area reserved for the master file table in an effort to avoid running out of disk space.
Either of these situations can cause performance problems. Fortunately, you can adjust the amount of disk space that is reserved for the master file table by using the fsutil command. The actual command is shown below:
Fsutil behavior set mftzone 1
You might have noticed that the command above ends with a "1." The number at the end of the command tells fsutil how much disk space to reserve. The "1" indicates that 12.5% of the total capacity will be reserved. In addition, a "2" reserves 25% of the disk's capacity, while a "3" reserves 37.5% and a "4" reserves 50%.
ABOUT THE AUTHOR
Brien M. Posey, MCSE, has received Microsoft's Most Valuable Professional Award four times for his work with Windows Server, IIS and Exchange Server. He has served as CIO for a nationwide chain of hospitals and healthcare facilities, and was once a network administrator for Fort Knox. You can visit his personal Web site at www.brienposey.com.