Dump FAT (Filesystem)

Posted: July 2007


This program is based on and written to confirm information from Wikipedia's FAT page. dump_fat will dump headers from FAT (MSDOS to WINDOWS98) file systems. Currently it dumps the boot sector and directory information from the root directory. There is a second program here based on dump_fat that will recover JPEGs from a formatted FAT device (such as a flash memory card from a digital camera).

FAT, for the most part, is fairly simple to implement so far. The biggest problems I see are redundant fields and hackish things to make an archaic filesystem modern. The whole VFAT filename thing is absolutely disgusting. But this kind of garbage is pretty typical in a Microsoft file format :(. Unfortunately FAT is a pretty common filesystem still. Flash cards/drives (MMC/SD/CompactFlash, etc) are still formatted for FAT by default and cameras and mp3 players and such (minus the iPod which uses Apple's HFS by default on Macs). This is a really bad filesystem for flash memory since flash starts to wear out and fail as you write/rewrite blocks. Unless you mount your file system read-only (or noatime) which I don't think is an option on Windows as it is on Unix/Linux, every time you look at a file its access time will get updated and thus ruin your device fast. A better filesystem for flash memory would be jffs. Owell :(.

Update April 5, 2008 - I added a utility called recover_fat_jpegs. If you had a memory card for maybe a digital camera and you accidently formatted it, this program can recover all the jpegs off of it. To build it type: make recover. To run it, get a copy of your flash drive image and run the recover_fat_jpegs on it. An example would be this:

dd if=/dev/sda of=backup.img
./recover_fat_jpegs backup.img

This will scan the image for jpegs and rebuild them renaming them 1.jpeg, 2.jpeg, etc. This should be done immediately after formatting. If you write any more to the drive, you will start losing images one by one. If you ever deleted images, this might fail too... use at your own risk.

Update November 21, 2007 - I have almost all my code written to read an SD card from an Atmel Atmega168. I updated dump_fat just now so it can recognize if the first sector is a MBR with a partition table and find the first partition to read, or if it's just a single partition disk (like a floppy).

Related Projects

File Parsers: print_pe, magic_elf, dump_fat, amiga_recovery, dump_d64, java class



Copyright 1997-2024 - Michael Kohn