New catastrophic HAMMER filesystem recovery tool in HEAD

Matthew Dillon dillon at apollo.backplane.com
Tue Aug 17 10:16:02 PDT 2010


    I've made a good first attempt at writing a HAMMER filesystem
    recovery directive to the hammer utility.  It is now in HEAD.
    It works on the filesystem image (similar to the 'show' directive):

	hammer -f <device> recover <empty_target_dir>

    This is not a fsck.  The filesystem image is only scanned, not modified.
    The reconstructed filesystem is stored in the target directory.

    Currently the directive has some limitations.  It does require the
    volume header to be intact, it doesn't deal with hardlinks (only
    one namespace will be restored), and it does not try to recover
    the uid, gid, modes, or times.  Only files and directories are
    recovered.  Softlinks are ignored at the moment.  Data CRCs are not
    validated at the moment.  Most of these limitations can be overcome
    with more work.

    --

    The actual operation of the recover directive is very cool.  Apart
    from the needing the volume header it just scans the image straight
    out looking for blocks that contain B-Tree nodes.  It then scans
    those nodes looking for inode, directory-entry, and file-data
    records and creates them on the fly (piecemeal) in the <target_dir>.

    Files and directories are initially named after their object id
    but as the operation continues and more fragmentory information
    is recovered the program can reconstruct the actual file and
    directory names and the actual directory hierarchy, which it
    does by renaming the temporarily named and placed files and
    directories as appropriate, on the fly.

    HAMMER might never have an fsck command but we do now have a 'recover'
    feature and I expect it will get better and better as time passes.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>





More information about the Users mailing list