Freigeben über


Transaction-Safe FAT File System (Windows CE 5.0)

Send Feedback

A transaction-safe FAT (TFAT) file system is a file system designed specifically to provide transaction-safety for data stored on a disk. TFAT requires a hardware-specific driver designed for the type of media on which the TFAT volume will exist. Assuming that a transaction-safe hardware-specific block driver exists, and that the driver provides the standard FAT file system interfaces, TFAT can operate on removable media such as Compact Flash cards and secure digital cards, as well as non-removable media such as hard drives and NAND Flash.

By design, the FAT file system is not a transaction-safe file system. FATFS can be corrupted if a write operation is interrupted in the middle of a transaction. Interruptions occur due to power loss or the removal of the media. The FAT volume is corrupted when the content of the FAT table does not match the directory or data sections of the volume.

A TFAT file system ensures that the file allocation table (FAT) and directories remain intact if power loss occurs. In order to accomplish this, the FAT and directory data is either completely written or completely not written, per transaction. Because TFAT prevents the FAT and directory data from being inconsistent with each other, write operations cannot corrupt the main volume on a disk.

A TFAT driver is a superset of the FATFS driver, and supports both FAT and TFAT volumes. You do not need to include both a FATFS and a TFAT driver. Either include one driver or the other driver. TFAT handles a FAT volume identically to a FATFS driver, and the APIs exposed by TFAT are equivalent to those associated with FATFS.

When power loss occurs, an application handles any partially committed files. Anytime WriteFile or CloseHandle is called, the FAT volume is committed. This action may cause a file that is spanning multiple sectors or clusters to be partially committed if power is lost. To address this issue, an application can implement its own application-based transaction.

The TFAT file system ensures that the FAT table and directory structure are transaction-safe. However, default write operations for file data are not atomic and, as such, are not ensured to be transaction-safe. To be sure that file data is atomic, an application must implement application-based transactions.

**Note   **TFAT file system write operations are slower than FAT file system write operations. Take into account this performance decrease when you decide whether to use FAT or TFAT as your file system. Read operations should experience comparable performance in both the FAT and TFAT file systems.

TFAT Registry Settings

See Also

FAT File System | TFAT Registry Settings | WriteFile | CloseHandle | How to Configure a FAT File System

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.