Microsoft KB Archive/314875

From BetaArchive Wiki

Article ID: 314875

Article Last Modified on 12/1/2007



APPLIES TO

  • Microsoft Windows XP Home Edition
  • Microsoft Windows XP Professional
  • Microsoft Windows XP Professional x64 Edition



This article was previously published under Q314875


SUMMARY

This article provides a description of the process that Convert.exe uses to convert a disk partition from file allocation table (FAT) to the NTFS file system. The article also discusses the space that is required for conversion.

MORE INFORMATION

The conversion of a disk partition from FAT to NTFS requires a certain amount of free disk space for building the NTFS disk structures. FAT and NTFS use very different on-disk structures to represent the allocation of space for files. These structures are often referred to as "metadata" or "file system overhead."

FAT and NTFS Overhead

FAT metadata consists of a boot sector, one or more file allocation tables, a root directory structure of fixed size, and a variable amount of space for each subdirectory. The space for each subdirectory is related to the number of files that are in the subdirectory.

Another kind of overhead is associated with both FAT and NTFS. 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. On volumes of similar size, the default cluster size for NTFS is smaller than the default cluster size for FAT.

Because space for file data can be allocated only in whole cluster amounts, even a 1-byte file uses a whole cluster's worth of disk space on a FAT volume. (Space usage issues for NTFS are similar but slightly more complicated, and those issues are not covered in detail in this article.)

Like FAT, the NTFS file system has a certain amount of fixed-size overhead and a certain amount of per-file overhead. NTFS also has several advanced features, including recoverability, security, and support for very large volumes. Because of these advanced features, the NTFS metadata overhead is somewhat larger than the FAT metadata overhead. On the other hand, because NTFS cluster overhead is smaller than FAT cluster overhead, it is often possible to store at least as much on an NTFS volume as on a FAT volume, even without using NTFS file compression.

The Conversion Process

To guard against corruption that can be caused by failure during conversion, the Convert.exe utility must build the NTFS metadata by using only the space that the FAT file system considers to be free space. That way, if the conversion does not succeed, the FAT representation of the user files is still valid.

A complicating factor for 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 adjacent sectors.

In the conversion process, Convert.exe performs these tasks:

  1. Convert.exe relocates FAT clusters to create space for the fixed-location NTFS structure and other adjacent data, and then saves the new FAT. If the necessary sectors cannot be made available (for example, if the sectors are unreadable), the conversion process stops. The FAT volume is in the same condition as before the attempted conversion.
  2. In the free space in the FAT volume, Convert.exe creates the elementary NTFS data structures, that is, the fixed-size tables and structures that are common to any NTFS volume. The size of these tables depends on the size of the volume but does not depend on the number of files on the volume.
  3. Convert.exe creates the NTFS master file table and directory listings in the free space on the FAT volume. The space required for this step is variable and depends on the total number of files on the FAT volume.
  4. In the NTFS bitmap, Convert.exe marks as "free" those NTFS clusters that are being used by FAT-specific structures. After the conversion is complete, NTFS can reclaim the FAT metadata overhead as free space.
  5. Finally, Convert.exe writes the NTFS boot sector. This final action causes the volume to be recognized as NTFS rather than FAT. (If the conversion fails at any earlier step, the volume is still recognized as a valid FAT volume.)

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

Almost all of the writes are to free FAT space, so failure preserves the FAT intact. The only times when Convert.exe writes to space that is not free--that is, the times at which a failure can cause problems--are:

  • At the end of step 1, when Convert.exe overwrites the FAT.


The algorithm for relocating clusters guarantees that if a failure does take place during this stage, Chkdsk can fix the disk with no loss of data.

  • In step 5, when Convert.exe writes the boot sector.


The system partition is the active, primary partition that starts the computer. If a failure occurs while the system partition is being converted, there is a chance that the computer could be unable to start. It is not likely that such a failure will occur, but if it does occur, you can still use a (floppy) boot disk to start the computer.

The Computation Process

Before starting the conversion process, Convert.exe performs a computation to figure out how much free space is required, based on the number of preexisting files on the FAT volume and on the size of the volume. For standard hardware (a hard drive that has 512 bytes per sector), the computation is done like this:

  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 the value is larger than 4,194,304, use 4,194,304.
  2. Add the size of the volume in bytes, divided by 803.
  3. Add the number of files and directories that are on the volume, multiplied by 1,280.
  4. Add 196,096.

If there is extended attribute information on the FAT volume, Convert.exe also considers the additional space that is required. (Extended attribute information is normally not present. It is a consideration only if the computer had been running OS/2 and extended attributes were in use.)

The computation that is described closely approximates the computation that Convert.exe performs. The exact result on any given system may differ slightly.

The computation yields the amount of free space that Convert.exe requires before attempting a conversion. The computation includes an allowance for the possibility of encountering bad sectors in the free space in the FAT volume.

If a volume has just enough free space to begin the conversion, and if a significant fraction of drive space is discovered to be unusable, the conversion process may fail. However, because the design is for the volume to automatically fall back to being recognized as FAT, failure does not necessarily produce any disk corruption.

Special Considerations

If you use the Convert.exe command, be aware of these considerations:

  • You must specify that the drive is to be converted when the computer restarts. Otherwise, you cannot convert the current drive.
  • If Convert.exe cannot lock the drive (for example, the system volume or the current drive), Convert.exe offers to convert the drive next time the computer restarts.
  • The location of the master file table (MFT) is different on volumes that have been converted from previous versions of NTFS, so volume performance might not be as good on volumes that are converted from Windows NT.
  • Compared with volumes that are initially formatted with NTFS, volumes that are converted from FAT to NTFS lack some performance benefits. On converted volumes, the MFT can become fragmented. In addition, on converted boot volumes, NTFS permissions are not applied after the volume is converted.


Keywords: kbenv kbinfo KB314875