Microsoft KB Archive/174619

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


How NTFS reserves space for its Master File Table (MFT)

Article ID: 174619

Article Last Modified on 9/4/2007



APPLIES TO

  • Microsoft Windows 2000 Professional Edition
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Datacenter Server
  • Microsoft Windows NT Workstation 4.0 Developer Edition
  • Microsoft Windows NT Server 4.0 Standard Edition



This article was previously published under Q174619

Important This article contains information about how to modify the registry. Make sure that you back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows registry


SUMMARY

The NTFS file system contains at its core, a file called the master file table (MFT). There is at least one entry in the MFT for every file on an NTFS volume, including the MFT itself.

Because utilities that defragment NTFS volumes cannot move MFT entries, and because excessive fragmentation of the MFT can impact performance, NTFS reserves space for the MFT in an effort to keep the MFT as contiguous as possible as it grows.

MORE INFORMATION

NTFS uses MFT entries to define the files to which they correspond. All information about a file, including its size, time and date stamps, permissions, and data content is either stored in MFT entries or in space external to the MFT but described by the MFT entries.

(Directory entries, external to the MFT, also contain some redundant information regarding files. But a full discussion of all the structures on NTFS is beyond the scope of this article.)

As files are added to an NTFS volume, more entries are added to the MFT and so the MFT increases in size. When files are deleted from an NTFS volume, their MFT entries are marked as free and may be reused, but the MFT does not shrink. Thus, space used by these entries is not reclaimed from the disk.

Because of the importance of the MFT to NTFS and the possible impact on performance if this file becomes highly fragmented, NTFS makes a special effort to keep this file contiguous. NTFS reserves 12.5 percent of the volume for exclusive use of the MFT until and unless the remainder of the volume is completely used up. Thus, space for files and directories is not allocated from this MFT zone until all other space is allocated first.

Note You can change the NtfsMFTZoneReservation registry key to increase the volume in Windows NT 4.0 Service Pack 4.

For more information about the MFT, please see the "Key elements in the disk defragmentation process" section of the following Microsoft Technet Web site:

Depending on the average file size and other variables, either the reserved MFT zone or the unreserved space on the disk may be used up before the other as the disk fills to capacity.

Volumes with a small number of relatively large files exhaust the unreserved space first, while volumes with a large number of relatively small files exhaust the MFT zone space first. In either case, fragmentation of the MFT starts to take place when one region or the other becomes full. If the unreserved space becomes full, space for user files and directories starts to be allocated from the MFT zone competing with the MFT for allocation. If the MFT zone becomes full, space for new MFT entries is allocated from the remainder of the disk, again competing with other files.

A new registry parameter was introduced in Service Pack 4 for Windows NT 4.0 that can increase the percentage of a volume that NTFS reserves for its master file table. NtfsMftZoneReservation is a REG_DWORD value that can take on a value between 1 and 4, where 1 corresponds to the minimum MFT zone size and 4 corresponds to the maximum. If the parameter is not specified or an invalid value is supplied, NTFS uses a default value of 1 for this parameter. The exact ratios that correspond to each setting are undocumented because they are not standardized and may change in future releases. In order to know what setting is best for your environment, it may be necessary to experiment with different values.

To determine the current size of the MFT on a Windows NT-based computer, type the dir /a $mft command on an NTFS volume.

To determine the current size of the MFT on a Microsoft Windows 2000-based computer, use Disk Defragmenter to analyze the NTFS drive, and then click View Report This displays the drive statistics, including the current MFT size and number of fragments.

The Windows 2000 version of Disk Defragmenter displays "green" for what is called "system files" and on an NTFS formatted volume this is simply the combination of the MFT, pagefile.sys (if one exists on this volume) and what is called the "MFT Zone" or reserved space for "MFT Expansion". The defragmentation report only displays information about the pagefile and MFT; it does not mention the MFT Zone because it does not effect in any way disk utilization or capacity.

The MFT Zone is not subtracted from available (free) drive space used for user data files, it is only space that is used last. When the MFT needs to increase in size, for example, you created new files and directories, it is taken from the MFT Zone first, thus decreasing MFT fragmentation and optimizing MFT performance.

The default MFT Zone is calculated and reserved by Ntfs.sys when it mounts the volume, and is based on volume size. You can increase the MFT Zone by means of the registry entry documented below, but you cannot make the default MFT Zone smaller than what is calculated by Ntfs.sys. Increasing the MFT Zone does not decrease in any way disk space that can be used by users for data files.

Note The results returned by the dir command may not be current. The size reported by the dir command may reflect cached data that reflects the size of the MFT at the time the system was started following an orderly shutdown.

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To add this value, perform the following steps:

  1. Run Registry Editor (Regedt32.exe), and go to the following subkey:

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem

  2. From the Edit menu, click Add Value.
  3. Type the following information in the dialog box:

    Value Name: NtfsMftZoneReservation
    Data Type : REG_DWORD
    Data : (valid range is 1-4)

  4. Quit Registry Editor and restart your computer.

Note This is a run-time parameter and does not affect the actual format of a volume. Rather, it affects the way NTFS allocates space on all volumes on a given system. Therefore, to be completely effective, the parameter must be in effect from the time that a volume is formatted and throughout the life of the volume. If the registry parameter is adjusted downward or removed, the MFT zone will be reduced accordingly, but this will not have any affect on MFT space already allocated and used.


Additional query words: mftzone

Keywords: kbhotfixserver kbqfe kbenv kbinfo KB174619