The conversion of a disk partition from the FAT file system to NTFSrequires a certain amount of free disk space be available in order to buildthe NTFS disk structures. This article provides a description of theprocess Convert.exe uses to convert FAT to NTFS and discusses the spacerequired for conversion.
FAT and NTFS use very different on-disk structures to represent theallocation of space for files. These structures are often referred to asmeta-data or file system overhead.
The FAT file system's meta-data consists of a boot sector, one or more FileAllocation Tables, a fixed-size root directory structure, and a variableamount of space for each sub-directory related to the number of files inthe sub-directory.
Another kind of overhead associated with both FAT and NTFS is related tothe fact that both file systems allocate disk space in clusters of a fixedsize. The exact size of these allocation units or clusters is determined atformat time, and the defaults are dependent on the size of the volume. Thedefault cluster size for NTFS is smaller than the default for FAT onsimilarly 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 aFAT volume. The NTFS case is similar, but slightly more complicated andwill not be covered in detail in this article.
Like FAT, NTFS has a certain amount of fixed size overhead and a certainamount of per-file overhead. In order to support the advanced features ofNTFS, such as recoverability, security, support for very large volumes, andso forth, the NTFS meta-data overhead is somewhat larger than the FAT meta-data overhead. On the other hand, because NTFS cluster overhead is smallerthan FAT cluster overhead, it is often possible to store as much, if notmore data on an NTFS volume as on a FAT volume, even without using NTFSfile compression.
In order to guard against the possibility of corruption caused by failureduring conversion, Convert.exe must build the NTFS meta-data using onlythat space which is considered free space by the FAT file system. In thisway, if the conversion fails to complete, the FAT representation of theuser files is still valid. Complicating this strategy is that one sector ofNTFS data must occupy a specific location on the disk, and a very limitednumber of other structures must occupy contiguous sectors.
The general outline of the conversion process is as follows:
- 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.
- 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.
- 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.
- 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.
- 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 aboveminimizes the chance of disk corruption.NOTE
: Almost all writes are to FAT free space, so a failure will preservethe FAT intact.
The only times at which we write to non-free space, for example, the timesat 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 fileson the FAT volume and size of the volume to figure out how much free spaceis required before starting the conversion process. For standard hardware(hard drives with 512 bytes per sector) the equation boils down to thefollowing:
- 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.
- Add to the above the size of the volume in bytes divided by 803.
- Add to the above the number of files and directories on the volume multiplied by 1280.
- Add to the above 196,096.
In addition to the above, if there is extended attribute information on theFAT volume, Convert.exe will take into account the additional space thatwill be required. Extended attribute information is normally not presentand would only be a consideration if the system had been running OS/2 andextended attributes were in use.
The above computation closely mirrors the computation performed byConvert.exe. The exact result obtained on a given system may differslightly.NOTE
: This is the free space required by Convert.exe before it will attempta conversion. The computation includes an allowance for the possibilitythat bad sectors may be encountered in the FAT free space. However, incases where a volume has just enough free space to begin the conversion,and a significant fraction of drive space is discovered to be unusable, theconversion process may fail. As discussed above, this should not result inany disk corruption. The volume should automatically fall back to beingrecognized as FAT.