I know that in Unix (specifically, Mac OS X) the superblock stores information about the layout of data on the disk, including the disk addresses at which the inodes begin and end. I want to scan the list of inodes in my program to look for deleted files. How can I find the disk address at which the inodes begin? I have looked at the statfs command but it does not provide this information.
A:
You'll have quite some trouble to find deleted files because there's not much left on the disk to find when you delete a file.
If you delete a file on a FAT (or UDF) file system, its directory entry simply gets marked as "deleted", with most of the dir entry still intact.
On HFS volumes, due to their use of B-Trees, deleted edits must be removed from the directory or else searching for items wouldn't work any more efficiently (well, this argument may be a bit weak, but fact is that deleted entries get removed and overwritten).
So, unless the deletion took place by writing over a directory sector by accident, or by re-initializing the volume, you'll not find much.
Thomas Tempelmann
2008-12-07 09:50:41