Recover a ufs2 filesystem from a reformat with another ufs2 filesystem

Peter Jeremy peterjeremy at acm.org
Mon Mar 28 12:54:55 UTC 2011


On 2011-Mar-26 15:27:09 +0100, Anders Andersson <pipatron at gmail.com> wrote:
>Perhaps it would be beneficial if some of this information was spread
>out at random for recover purpose, although I don't know what bad side
>effects this would create.

Well, the backup superblocks have to be at known locations so that
fsck and/or the user can find them.  Traditionally, they were offset
by a track more than an integral number of cylinders so the loss of an
entire platter wouldn't destroy all superblocks - the code still does
this but CHS values are no longer meaningful.  Much of the UFS code
works on the assumption that cylinder groups and inodes are located
at regular locations through the disk so they can be located using
simple arithmetic - check out the various macros in <ufs/ffs/fs.h>.

About the best you can do is to build your filesystems with non-default
parameters so that if you accidently newfs it with default parameters,
it won't overwrite all the superblock copies.  Of course, it will write
superblocks all over your data.

OTOH, since UFS2 doesn't pre-allocate inodes, if you newfs with the
same parameters, you have destroyed the CG-level metadata but the
majority of the inodes and all of the data will remain untouched.
They can't be recovered by fsck but a custom process that looked at
all the potential inodes associated with a cylinder group would
find most of the files.

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20110328/6dc06de7/attachment.pgp


More information about the freebsd-fs mailing list