UFS2 recovery tool?

Frank Mayhar frank at exit.com
Wed Jul 20 17:30:16 GMT 2005

Due to a series of circumstances involving a RAID controller and an
unclear user interface and an unfortunate use of "fsck -y", I managed to
hammer a couple of very large file systems.  (Fortunately I had a very
recent copy of /home backed up elsewhere, or I wouldn't be sending this

While I could live without the data on those file systems if I
absolutely had to, I know much of the data is recoverable with the right
tools.  In fact I found a whole intact subtree using fsdb.
Unfortunately the root directory was wiped.  While I can recover the
inode with fsdb, it doesn't allow me to allocate a new (free) block for
the directory contents.

What I need is either a way to set up the root directory so I can link
the subtrees that I find to it, or, alternatively, something like
ffsrecov that will just pull the subtree off the dead filesystem
directly, writing it to a _live_ filesystem.  Unfortunately, ffsrecov
hasn't yet been updated to support UFS2.

If I have to, I'll write the code myself, but I'm hoping here that
someone else has done so already.  (At the moment it's hard for me to
find the time for such relatively complex development that isn't
directly work-related.)

So, has anyone done this?  If someone even has code lying around that
understands UFS2 and can create directories and allocate blocks, even if
it's not suitable for inclusion in ports, that would be wonderful.  Drop
me email with a pointer to said code.

Alternatively, if you have (detailed, low-level) advice as to how to
write the code, feel free to chime in.  (Please, though, don't tell me
to look at fsck_ffs, fsdb and sys/ffs/*; that I know already and it will
be where I start if I end up writing this all myself.)

So here's hoping...
Frank Mayhar frank at exit.com     http://www.exit.com/
Exit Consulting                 http://www.gpsclock.com/

More information about the freebsd-hackers mailing list