如何恢复Linux上删除的文件 (6)

http://tech.ddvip.com   2008年04月15日    社区交流

内容摘要:reiserfs 对于小文件的存取速度非常高,这取决于它所采用的精美的设计:reiserfs 文件系统就是一棵动态的 B+ 树,小文件和大文件的尾部数据都可以通过保存到叶子节点中而加快存取速度。本文将探讨 reiserfs 的设计和实现内幕,并从中探讨恢复删除文件的可能性。

  stat 数据(TYPE_STAT_DATA)非常类似于 ext2 中的索引节点,其中保存了诸如文件权限、MAC(modified、accessed、changed)时间信息等数据。在3.6 版本的 reiserfs 中,stat 数据使用一个stat_data 结构表示,该结构大小为 44 字节,其定义如清单 7 所示:

  清单7. stat_data 结构定义

835 /* Stat Data on disk (reiserfs version of UFS disk inode minus the
836  address blocks) */
837 struct stat_data {
838     __le16 sd_mode;     /* file type, permissions */
839     __le16 sd_attrs;    /* persistent inode flags */
840     __le32 sd_nlink;    /* number of hard links */
841     __le64 sd_size;     /* file size */
842     __le32 sd_uid;     /* owner */
843     __le32 sd_gid;     /* group */
844     __le32 sd_atime;    /* time of last access */
845     __le32 sd_mtime;    /* time file was last modified */
846     __le32 sd_ctime;    /* time inode (stat data) was last changed */
                  /* (except changes to sd_atime and sd_mtime) */
847     __le32 sd_blocks;
848     union {
849         __le32 sd_rdev;
850         __le32 sd_generation;
851         //__le32 sd_first_direct_byte;
852         /* first byte of file which is stored in a
853          direct item: except that if it equals 1
854          it is a symlink and if it equals
855          ~(__u32)0 there is no direct item. The
856          existence of this field really grates
857          on me. Let's replace it with a macro
858          based on sd_size and our tail
859          suppression policy? */
860     } __attribute__ ((__packed__)) u;
861 } __attribute__ ((__packed__));
862 //
863 // this is 44 bytes long
864 //

来源:ibm    作者:冯锐 丁成    责编:豆豆技术应用

正在加载评论...