HAMMER Utility - Add catastrophic recovery feature
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 17 Aug 2010 06:49:16 +0000 (23:49 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 17 Aug 2010 06:49:16 +0000 (23:49 -0700)
commitb9107f58ed117184a899e7d65ffd8038f2f6ee52
tree29f72ce6e8c2db38724268460929e3112b64885a
parent24c8374a23b091f1eef91c6cf508ad88dfa99440
HAMMER Utility - Add catastrophic recovery feature

* hammer -f <devices> recover <empty_target_dir>

* Add a catastrophic recovery feature.  A HAMMER filesystem image is
  scanned (using the -f <blockdevs> specification).  Any buffer which
  looks like a B-Tree node is then sub-scanned for inode, directory, and
  data records and the filesystem is reconstructed in the specified
  target directory.

* The files and directories are initially named after the object id
  and are renamed and moved as directory entries are found to resolve
  the fragmentory information.

* File writes strip trailing 0's (data records are not limited to the
  file EOF), but will properly truncate the file if/when the related
  inode record is found.

* Currently no attempt is made to restore owner, group, file modes,
  softlinks, or hardlinks (only one link will be restored).

TODO: Currently a valid volume header is required, but the only thing
      we actually need from it is the vol_buf_beg field.  This field
      could be guessed or passed in on the command line in a future
      update to the recovery code.
12 files changed:
sbin/hammer/Makefile
sbin/hammer/blockmap.c
sbin/hammer/cmd_recover.c [new file with mode: 0644]
sbin/hammer/cmd_show.c
sbin/hammer/hammer.8
sbin/hammer/hammer.c
sbin/hammer/hammer.h
sbin/hammer/hammer_util.h
sbin/hammer/ondisk.c
sys/vfs/hammer/hammer.h
sys/vfs/hammer/hammer_cursor.c
sys/vfs/hammer/hammer_reblock.c