Friday, May 9, 2014

Understanding Windows Master File Table (MFT) Allocation and Fragmentation

Well when you format a new hard drive (or it's pre-formatted) you are instructing your operating system you want to organize that disk using a specific format like Fat, Fat32, and New Technology File System (NTFS) which is the default disk format for Windows 8.1, Server 2012.


But first, before you can format the disk you have to partition it. A partition contains a volume which can be formatted. Partition arouse to meet the requirement to split the a physical disk into many logical disk with other formats on them. 


A partition contains a Master Boot Record (MBR) and holds the information on how the logical partitions, containing file systems, are organized on that medium.



clip_image004

Sector zero will house the Master Boot Record (MBR), which contains the partition table.  The partition table will tell us where the partition will start and how big it is.  Once the partition is formatted a volume is created.  The volume starts at the first boot sector and ends at the last boot sector (aka backup boot sector). Now you can format the volume, in this case NTFS.

The Master File Table (MFT) executive private area responsible for organizing all you files on the disk, so they are accessed quickly and reliably on the disk.Sort of a database for files, which are stored in chunks called unit allocation size. This master "database" is called Master File Table (MFT).

That structure has a cost to it.

NTFS MFT Reservation ~ 12.5%


For NTFS, a slice of the HD that contains all file records i
s a called Master File Table (MFT).
Additionally, there are 
index and log files, that keep track of file changes on the disk, and is know as journaling file system. NTFS uses $LogFile to record metadata changes to the volume is is part of a whole slew of hidden NTFS meta-files.


By default NTFS reserves this zone, at 12.5%.


Please see How NTFS reserves space for its Master File Table (MFT) for full details, but states "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."

However, when, for example, a lot of files are placed to the drive, MFT can grow beyond the reserved zone and becomes fragmented. 



Another reason is when you delete file, NTFS does not always use its space in MFT to store new one, it just marks MFT entry as deleted and allocates new entry for the new file. It provides some performance and recovery benefits, however it forces MFT to be fragmented.


The more MFT fragmentation, the more the HDD heads movements to access the data, the less overall performance of file system. A great article "
The Four Stages of NTFS File Growth" details this in great detail ;)

Starting from Windows NT 4.0 SP4 you can define MFT Zone Reservation value through the Registry.


Registry Key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem


Value NtfsMftZoneReservation of DWORD type (1 to 4) 

allows you to specify MFT Zone for the newly created/formatted volumes(12.5 percent, 25 percent, 37.5 percent, 50 percent of NTFS volume accordingly). 


For futher read  see Optimizing NTFS

No comments:

Post a Comment