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: