Microsoft KB Archive/156560

= Free Space Required to Convert FAT to NTFS =

Article ID: 156560

Article Last Modified on 2/23/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * 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 Q156560





SUMMARY
The conversion of a disk partition from the FAT file system to NTFS requires a certain amount of free disk space be available in order to build the NTFS disk structures. This article provides a description of the process Convert.exe uses to convert FAT to NTFS and discusses the space required for conversion.



MORE INFORMATION
FAT and NTFS use very different on-disk structures to represent the allocation of space for files. These structures are often referred to as meta-data or file system overhead.

The FAT file system's meta-data consists of a boot sector, one or more File Allocation Tables, a fixed-size root directory structure, and a variable amount of space for each sub-directory related to the number of files in the sub-directory.

Another kind of overhead associated with both FAT and NTFS is related to the fact that both file systems allocate disk space in clusters of a fixed size. The exact size of these allocation units or clusters is determined at format time, and the defaults are dependent on the size of the volume. The default cluster size for NTFS is smaller than the default for FAT on similarly sized volumes.

Because space for file data can only be allocated in whole cluster amounts, even a one byte file will end up using a cluster's worth of disk space on a FAT volume. The NTFS case is similar, but slightly more complicated and will not be covered in detail in this article.

Like FAT, NTFS has a certain amount of fixed size overhead and a certain amount of per-file overhead. In order to support the advanced features of NTFS, such as recoverability, security, support for very large volumes, and so forth, the NTFS meta-data overhead is somewhat larger than the FAT meta- data overhead. On the other hand, because NTFS cluster overhead is smaller than FAT cluster overhead, it is often possible to store as much, if not more data on an NTFS volume as on a FAT volume, even without using NTFS file compression.

In order to guard against the possibility of corruption caused by failure during conversion, Convert.exe must build the NTFS meta-data using only that space which is considered free space by the FAT file system. In this way, if the conversion fails to complete, the FAT representation of the user files is still valid. Complicating this strategy is that one sector of NTFS data must occupy a specific location on the disk, and a very limited number of other structures must occupy contiguous sectors.

The general outline of the conversion process is as follows:
 * 1) Create holes (that is, relocate FAT clusters) for the fixed-location NTFS structure and other contiguous data (if necessary) and save the new FAT. If the necessary sectors cannot be made available due to being unreadable, for example, the conversion process will fail and the FAT volume will remain in the same state it was in before the attempted conversion.
 * 2) Create NTFS elementary data structures in FAT free space. These are the fixed-size tables and structures common to any NTFS volume. The size of these tables may vary depending on the size of the volume, but do not depend on the number of files on the volume.
 * 3) Create the NTFS master file table and directory listings in the FAT free space. The space required for this step is variable and depends on the total number of files on the FAT volume.
 * 4) Mark as free in the NTFS bitmap those NTFS clusters being used by FAT- specific structures. After the conversion is complete, the FAT meta-data overhead can be reclaimed as free space to NTFS.
 * 5) Write NTFS boot sector. This is the final action that causes the volume to be recognized as NTFS rather than FAT. If the conversion fails at any step prior to this, the volume will still be a valid FAT volume and will be recognized as such.

Because a crash can occur at any time, the process described above minimizes the chance of disk corruption.

NOTE: Almost all writes are to FAT free space, so a failure will preserve the FAT intact.

The only times at which we write to non-free space, for example, the times at which a failure might cause problems are:
 * At the end of step 1, when CONVERT overwrites the FAT. The algorithm for relocating clusters guarantees that if a failure does take place during this stage, CHKDSK will be able to fix the disk without any loss of data.
 * In step 5, while writing the boot sector. If a failure occurs during this step, and the volume being converted is the system partition (the active, primary partition used to boot the system) there is a chance that the system could be left in a state where it would not start. In the unlikely event that this takes place, it should still be possible to start the system using a boot floppy disk.

Convert.exe performs a computation based on the number of preexisting files on the FAT volume and size of the volume to figure out how much free space is required before starting the conversion process. For standard hardware (hard drives with 512 bytes per sector) the equation boils down to the following:
 * 1) Start by taking the size of the volume, in bytes, and dividing by 100. If this value is less than 1,048,576, use 1,048,576. If it is larger than 4,194,304, use 4,194,304.
 * 2) Add to the above the size of the volume in bytes divided by 803.
 * 3) Add to the above the number of files and directories on the volume multiplied by 1280.
 * 4) Add to the above 196,096.

In addition to the above, if there is extended attribute information on the FAT volume, Convert.exe will take into account the additional space that will be required. Extended attribute information is normally not present and would only be a consideration if the system had been running OS/2 and extended attributes were in use.

The above computation closely mirrors the computation performed by Convert.exe. The exact result obtained on a given system may differ slightly.

NOTE: This is the free space required by Convert.exe before it will attempt a conversion. The computation includes an allowance for the possibility that bad sectors may be encountered in the FAT free space. However, in cases where a volume has just enough free space to begin the conversion, and a significant fraction of drive space is discovered to be unusable, the conversion process may fail. As discussed above, this should not result in any disk corruption. The volume should automatically fall back to being recognized as FAT.

Keywords: kbenv KB156560

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.