2014年3月20日 星期四

Introduction



File Allocation Table (FAT) is a computer file system investigated in 1977 and utilized as industry standard file system. Since considering the limitation of computer performance, FAT was not complicated. Therefore, almost all PC operating systems have supports for it.


FAT file systems are not designed as transaction-safe file systems. The traditional FAT file system is easy to be corrupted from a torn write. For example, a write operation is interrupted by power loss or removal of storage media during a write transaction. As a result, the entire file system will be damaged, some data can get lost.


To duel with this problem and ensure the safety on transaction, Transaction-Safe FAT File System (TFAT) is used in Microsoft products by reducing risk of data loss due to the situations mentioned.

TFAT



Windows CE and Windows Mobile, the specific OSs released by Microsoft, are marketed towards the embedded or mobile platforms. For those platforms, to concern the risk of file system corruption is needed with unexpectedly situations. A transaction-safe FAT (TFAT) file system is a file system designed for transaction safe feature on storage devices, TFAT requires a hardware-specific driver designed for the type of media on which the TFAT volume will exist[2].TFAT is still based on the FAT file system, the main function of the TFAT is designed to reduce the probability that a computer file system becomes corrupted in the event of power loss during a write cycle[1]. TFAT is best applied in non-removable disk. Removable disk like USB flash device can also use TFAT but it cannot be hundred percent guaranteed to prevent data loss on removable disk.


How does the TFAT to prevent data loss on our computer?
When the user to operate a software(e.g. Microsoft Word ), the TFAT system will create two copies of the FAT table(FAT1 table and FAT0 table), a FAT1 table is operating and being conducted and the FAT0 table is the last copy of the FAT1 table, the record of the FAT0 table must be in stable condition.

If all elements are finished in the transaction successfully, at that time the FAT1 table will modifications to FAT0 table. In case of power loss or the application closed suddenly, TFAT system will keep updating the schedule to the FAT0 table[2], if the transaction fails, it will restart the schedule base on the FAT0 table. After completing the transaction, the FAT1 table will be copied to FAT0. If TFAT system is not available, computer will lose all of the data.

TexFAT

TexFAT (Transaction-Safe Extended File System) which is the extention of TFAT have a same function with TFAT. For Window CE 5.0 and Window Mobile 6.5, it uses TFAT. For Window CE6.0, it uses TexFAT. We can change to TexFAT by choosing the FAT version. The FAT version should be exFAT. We should also click TFAT box, After formating TexFAT , we use USB mass storage mode to connect to the computer. We use WinHex to open the driver. We can see that there is FAT and FAT2. If there is only exFAT, there is only one FAT. We can also use CeGetVolumeInfo() to check whether it is transaction safe or not. From dwFlags inside CE_VOLUME_INFO, we can see that it is transaction safe. We can see that  Writing speed into the driver for TexFAT is very low in NAND 2. However, Writing speed into the driver for exFAT is higher than that of TexFAT in NAND 2.



Due to sudden power loss or sudden removal of storage, TexFAT make the system more stable and ensures the file system is not corrupted when an interruption occurs.


File names are restricted to no more than 247 characters for TFAT and TexFAT. We attempts to use a file name or path that exceeds this restriction fail. TFAT and TexFAT is best suited for non-removable media, such as NAND and NOR flash memory. TexFAT is also suited for removable media but there is potential problem using TexFAT removable card on a Window Desktop OS.

TFAT / TexFAT Programming Considerations

To guarantee TexFAT transaction safe features, it need hardware and software interact on 3 essential components. Hardware-specific driver, atomic block I/O operation and attribute.[5]

TFAT(TexFAT) compare to original FAT files system has an extra stable copy of FAT table(FAT0), and work with atomic block I/O operations(succeed-or-fail definition).[6]To perform atomic operations is required a hardware-specific driver to allocate the block on the storage devices. OS requires to enable the atomic block  I/O operation by setting the attribute and sector writes to satisfy the transaction safe features.

TFAT / TexFAT File System Limitations

TFAT(TexFAT) are implemented on FAT(exFAT) [7] and due to the extra overhead size, that limited the maximum length of a filename to 247 of UTF-16 code characters (which FAT is 255). Otherwise, the transaction safe features will not be able to restore the corrupted file.[8]


For any computer file system, root directory has a unique path name and fixed location. The I/O operation on the root directory as critical operation interrupted, the system can be corrupted.[9] Therefore, only removable storage devices recommend to use TexFAT on Windows Phone 7 . Due to the transaction safe features is rely to OS, TFAT(TexFAT) compatibility with desktop OS is not as well as original FAT file system. TFAT(TexFAT) will not be guaranteed the recognize the volume size and transaction safe on new created files, also delete any files is not allowable  on desktop OS platform .[4]

Summary:



  • TFAT are designed for removable storage devices on embedded/mobile platforms..
  • TFAT is implemented on FAT file system with transaction safe features.
  • TFAT created two table, FAT1 and FAT0. FAT1 is current operation, FAT0 is stable copy of FAT1.


  • TexFAT is extend of TFAT, which base on exFAT to resolve the limitation from FAT.
  • TexFAT has scalability on file size, and include UTC support


  • 3 essential components is needed to ensure the transaction safe features work: Hardware-specific driver, atomic block I/O operation and attribute.
  • TFAT(TexFAT) transaction safe features are limited on the length of filename and directories.
  • TFAT(TexFAT) not compatible with cross-platform,Desktop OS.

Reference:



[1].Transaction-safe FAT File System
Malueg, Michael D. "Transaction-safe FAT File System." Transaction-safe FAT File System. Microsoft Corporation, 5 July 2003. Web. 10 Mar. 2014. <http%3A%2F%2Fwww.patentstorm.us%2Fpatents%2F7174420%2Fdescription.html>.

[2].Transaction-Safe FAT File System (Windows CE 5.0)
"Transaction-Safe FAT File System (Windows CE 5.0)." Transaction-Safe FAT File System (Windows CE 5.0). 2014 Microsoft, 2006. Web. 20 Mar. 2014. <http://msdn.microsoft.com/en-us/library/aa516909.aspx>.

[3].How to set up TexFAT in Window CE6.0
WinCE6.0实现TexFAT的注意点. We-hjb, n.d. Web. 20 Mar. 2014. <http://www.cnblogs.com/we-hjb/archive/2010/11/06/1870597.html>.

[4].TexFAT Overview (Windows Embedded CE 6.0)
"TexFAT Overview (Windows Embedded CE 6.0)." TexFAT Overview (Windows Embedded CE 6.0). N.p., n.d. Web. 20 Mar. 2014. <http://msdn.microsoft.com/en-US/library/ee490643.aspx>.

[5].TexFAT Programming Considerations (Windows Embedded CE 6.0)
"TexFAT Programming Considerations (Windows Embedded CE 6.0)." TexFAT Programming Considerations (Windows Embedded CE 6.0). 2014 Microsoft, 1 June 2010. Web. 2014. <http://msdn.microsoft.com/en-US/library/ee490359.aspx>.
[6].Support for atomic block I/O operations
Corbet, Jonathan. "Support for Atomic Block I/O Operations." [LWN.net]. 2013, Eklektix, Inc, 6 Nov. 2013. Web. 2014. <http://lwn.net/Articles/573092/>.
[7].TFAT Overview
"TFAT Overview." TFAT Overview. 2014 Microsoft, 4 Aug. 2010. Web. 2014. <http://msdn.microsoft.com/en-us/library/aa915463.aspx>.

[8].Extended FAT File System - Paradigm Solutions Blog
Hamm, Jeff. "Extended FAT File System." Paradigm Solutions. Paradigm Solutions, 2009. Web. 2014. <http://paradigmsolutions.files.wordpress.com/2009/12/exfat-excerpt-1-4.pdf>.

[9].TexFAT File Naming Limitations
"TexFAT File Naming Limitations (Windows Embedded CE 6.0)." TexFAT File Naming Limitations (Windows Embedded CE 6.0). 2014 Microsoft, 1 June 2010. Web. 2014. <http://msdn.microsoft.com/en-US/library/ee490563.aspx>.