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.
相关问题
- Why is the JDK NIO using so many anon_inode file d
- Is it possible to recreate a file from an opened f
- How to obtain a pathname or dentry or struct file
- Can inode and crtime be used as a unique file iden
- How do I read a directory as a file in Unix?
相关文章
- Why is the JDK NIO using so many anon_inode file d
- Is it possible to recreate a file from an opened f
- How to obtain a pathname or dentry or struct file
- Can inode and crtime be used as a unique file iden
- How do I read a directory as a file in Unix?
- 为了了解在Ubuntu不同的对象相同的inode编号(To understand the same
- 执行“MV A B”:请问“索引节点”是否会改变?(Executing 'mv A B
- 是否有可能重新从打开的文件描述文件?(Is it possible to recreate a fi
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.
Since you mention Mac OS X, let's assume you mean to do this for HFS+ only. The Wikipedia page provides some information about possible ways to start, for instance it says this about the on-disk layout:
It becomes more complicated, after that. Read up on B* trees, for instance.
I'm no Mac OS user, but it would surprise me if there weren't already tools written to scan for deleted files, perhaps some are open source and could provide a more concrete starting point?