NTFS Performance Hacksby Mitch Tulloch
"Are we there yet?"
"Are we there yet?"
"Are we there yet?"
(Lock-Nah stabs a knife between Alex's fingers.)
"Wow, that's amazing! Perfect aim!"
"What are you talking about? I missed!"
That dialogue, between Alex O'Connell and Lock-Nah in The Mummy Returns, is a simple joke but still one of my favorites. It also reminds me of how impatient most of us are nowadays when it comes to how technology performs. And when it comes to computers, the questions often become Has it booted yet? Has it loaded yet? Has it finished searching yet?
One way of improving the performance of your Windows XP machine is to tweak the NTFS file system. In certain scenarios, simple changes can make a big difference; that's because hard disks are often a primary bottleneck in today's machines, which have fast processors and lots of memory. Let's look quickly at ten ways you can boost performance using NTFS (or not using NTFS) on Windows XP.
1. Disable Short Filenames
By default, NTFS creates an 8.3 filename every time it creates a long filename, which adds a bit of time to the file creation process. To speed things up, you can disable short filenames using the fsutil command:
fsutil behavior set disable8dot3 1
Restart your machine for this to take effect. A couple of caveats:
- You'll typically notice a performance difference only on drives that have a very large number of files (300,000 or more) but relatively few folders, and where a lot of your files have names that start similarly (for instance, NTFS Performance Hacks version 1.doc, NTFS Performance Hacks version 2.doc, and so on). That's because if you have a lot of files that start with the same characters in their filenames and occupy the same folder, NTFS has to work harder (and take more time) to generate unique 8.3 names for these files.
- If you have an older version of Microsoft Office or some older third-party apps, they may not work properly if 8.3 names are disabled. So test first before you mass-implement this hack.
2. Name Your Files Appropriately
Let's say you can't disable 8.3 filenames because of older software on your machine. You can still improve NTFS performance by choosing a naming scheme for your files so that files located in the same folder differ at the start of their names instead of at the end. So for example, instead of
NTFS Performance Hacks version 1.doc
NTFS Performance Hacks version 2.doc
and so on, you might name your files
1 NTFS Performance Hacks.doc
2 NTFS Performance Hacks.doc
and so on.
That way NTFS won't have to work so hard to generate a unique 8.3 name for each file in the folder.
3. Use More Folders
If you frequently need to open, close, create, or delete certain types of files, keep the number of such files in each folder small. In other words, if you have a lot of these files, create additional folders to spread them out between folders. If this isn't practical for some reason, then the first two hacks above can help compensate for having too many files in one folder.
4. Use More Partitions
In Windows 2000, when you partition a large disk (50GB or more, say) into several smaller NTFS volumes (10GB each), you can speed disk performance by up to 10 percent. NTFS on Windows XP has been improved to perform better overall, but you can still squeeze a percent or two of better performance out of a large disk by partitioning it into several smaller volumes.
5. Plan Your Cluster Size
The default cluster size on NTFS volumes is 4K, which is fine if your files are typically small and generally remain the same size. But if your files are generally much larger or tend to grow over time as applications modify them, try increasing the cluster size on your drives to 16K or even 32K to compensate. That will reduce the amount of space you are wasting on your drives and will allow files to open slightly faster.
Two caveats, though:
- If you want to compress older files to save disk space using NTFS compression, you have to leave the cluster size at 4K.
- The smaller your files (compared with the cluster size), the more fragmented your volume will tend to become over time.
The second caveat means that you should also ...
6. Defragment Regularly
Fragmented drives increase the time it takes for applications to open, close, create, or delete files. A good practice is to use Windows XP's Disk Defragmenter tool to defrag your drive at least once a week, especially if you run applications that frequently modify files and you have a lot of files on your drives. If you like, you can use the Scheduled Task Wizard to automate this process. See How to Automate Disk Defragmenter Using Task Scheduler Tool in Windows XP in the Microsoft Knowledge Base for instructions.
7. Reserve Space for the MFT
NTFS on Windows XP improves performance of the Master File Table (MFT) over Windows 2000 by not placing some of the MFT metadata files at the start of the disk. This enhancement alone can boost NTFS performance on Windows XP by up to 10 percent over Windows 2000. But you can squeeze out even better performance by ensuring that your drive has enough room for the MTF to grow if it has to. This will prevent the MTF from becoming fragmented, which is important because the Disk Defragmenter tool can't defragment the MFT.
By default, Windows XP reserves 12.5 percent of each NTFS volume (an area called the MFT zone) for exclusive use of the MFT. So if you plan to store tons of small files (under 8K, say) on your volume, your MFT may run out of space before your volume's free space does, and the result will be MFT fragmentation. To prevent this from happening, you can reserve additional space for the MFT using the fsutil command:
fsutil behavior set mftzone 2
This doubles the size of the reserved MFT zone to 25 percent of the volume. Of course, this means you lose 12.5 percent of the free space used to store files themselves, so there's a trade-off to consider when implementing this change. You can even make more aggressive changes using
set mftzone 3, which reserves 37.5 percent of the volume for the MFT, or
set mftzone 4, which reserves a whopping 50 percent. These extreme settings are only useful, however, if you have zillions of files, each smaller than about 1K.
To reset the MFT zone size according to your needs, do the following:
- Run the fsutil command as described previously.
- Reboot your system.
- Create the volumes you need.
To return to the default behavior of reserving 12.5 percent of each volume for MFT, use the fsutil behavior
set mftzone 1.
8. Disable Last Access Time
By default, each file and folder on an NTFS volume has an attribute called Last Access Time, which records the last time the file or folder was opened, read, or changed. This means even when you read a file on an NTFS volume, a write action occurs on that volume too. Normally this isn't a problem, but if you have an application that tends to frequently access files for short periods of time, this feature of NTFS can really slow performance. Fortunately, you can use fsutil to disable writing to the Last Access Time attribute:
fsutil behavior set disablelastaccess 1
Once this is done, the Last Access Time attribute for newly created files will simply be their File Creation Time.
One caveat: disabling Last Access Time may affect the operation of backup programs that use the Remote Storage service.
9. Turn Off (or On) the Indexing Service
Whether you enable or disable the Indexing Service on Windows XP depends on your needs. If you search for files on your hard drive only rarely, it's probably best to leave Indexing turned off, since it adds a slight overhead to NTFS operation and also uses up disk space to store the catalog. But if you search for files on your hard drive frequently (and need to search the contents of files as well) then turn Indexing on, as it will speed the search process considerably.
10. Use FAT32 for the Paging File
Finally, if you have a second physical disk in your machine, you can boost performance by moving your paging file (pagefile.sys) onto your second drive. To make this work best, do the following:
- Create a volume on your second drive, making sure the volume is big enough to hold your paging file. (Three times your RAM amount will be more than enough.)
- Format the new volume using FAT32 instead of NTFS, since FAT32 gives slightly better read performance on smaller volumes.
- Don't create any additional volumes on your second drive--that is, leave this drive for exclusive use by the paging file.
So in other words, our final NTFS tweak is to not use NTFS for your paging volume.
Return to the Windows DevCenter.