TFAT Overview
4/8/2010
The original file allocation table (FAT) file system enabled file modification operations to be interrupted before completion. In this way, actions such as sudden power loss or sudden removal of a storage card frequently resulted in data loss and file system corruption. By making file operations transaction-safe, TFAT stabilizes the file system and ensures that the file system is not corrupted when an interruption occurs.
TFAT works with two copies of the FAT table, a FAT1 table in which current operations are being conducted and a FAT0 table that is a stable copy of the last known good FAT. Modifications to FAT0 are not committed until all elements in a transaction have completed successfully. If a transaction fails to complete properly, the disk is set in the same state as it was before the transaction began. After all transactions are successfully completed, the FAT1 table is copied to FAT0.
The theoretical limit for TFAT is 2 TB, with 512 byte sectors. File systems up to about 500 GB have been tested.
By default, only modifications to a directory and the FAT are backed up during a transaction using TFAT. To back up modifications to the data of a file, you must set the TransactData registry key to 1. If you set this value and also set the ForceWriteThrough value to 1, all successful write operations are committed.
To modify existing files, TFAT allocates a new cluster for the modified bits and reroutes the FAT chain for a file to include the new cluster. This is to ensure that if the transaction fails to complete successfully, the original copy of the file is left untouched.
The TFAT file system is best suited for non-removable media, such as NAND and NOR flash memory. Removable media can also use TFAT, but there are potential issues when attempting to use a TFAT removable card on a Windows desktop OS. Because there is no implementation of TFAT on Windows desktop OSs, Windows handles the removable media as if it were a FAT file system. If the card is removed during a critical operation, the Windows desktop OS may not correctly recognize the volume. If a directory is created on the removable media using a Windows desktop OS, and then used with TFAT in Windows Embedded CE, operations on files in that directory may not be transaction-safe. In addition, TFAT directories cannot be deleted using a Windows desktop OS.
Note
the additional copy operations inherent in TFAT handling cause a decrease in performance.