PDA

View Full Version : How data is stored on a card


alan sh
17th of December 2004 (Fri), 10:04
Just FYI and so you understand how and when you can "rescue" a photo, this is the way data gets stored on a card. Applies to all FAT and FAT32 systems. This is over siimplified, but may help you if you think you have deleted files accidently.

You have 3 areas to consider: the directory, the FAT (File Allocation Table) and data.

The directory holds the file name and a pointer to the FIRST entry in the FAT.

The FAT holds pointers to the data. Each entry in the FAT points to the next sector - a FF means no more. So, if you know where to start from, then you can trace the data through to the end.

The data is stored in sectors. Not necessarily next to each other.

So, a file gets stored. The name gets added to the directory (along with its size and date) and the first free sector is found. This sector number is stored at the end of the directory name. Each extra sector which is used will cause an entry in the FAT.

A file gets deleted. All that happens is that the first character of the filename gets changed and the entry in the FAT gets changed to a zero. THATS IT. No data is deleted.

So, to recover it, you just go to the deleted file, make a guess as to the first character. Youknow how big the file is (that is also stored in the directory) so, you can just follow the FAT chain and reclaim the data.

BUT - if you have written more files, then the FAT and/or the actual sectors may have been overwritten.

If you format the hard disk in the camera (quick format), the FAT is cleared out. The data is left and it is possible to use the directory information to walk through all entries in the directory and recover the data.

I hope this helps a bit. Just remember, if you accidently delete files, do NOT use the card again and you stand a very good chance of recovering the files.

Alan

ArtierSquare
17th of December 2004 (Fri), 11:08
Thanks Alan...

It clears things up for me!!!

defordphoto
17th of December 2004 (Fri), 11:10
Works the same way on the cards as it does on your PC. In fact, Canon uses a mini version of PC-DOS as an OS.