Recovering Trashed Filesystems

Roland Smith rsmith at xs4all.nl
Fri Jul 31 10:52:44 UTC 2009


On Thu, Jul 30, 2009 at 11:46:50PM -0700, Crist J. Clark wrote:
> I have two file systems in very sad shape that I would like
> to retrieve some files from. I've net booted the sick box
> and can access the two bad UFSs. One file system, the root
> file system, isn't too bad off. However, the usr directory
> is messed up.
<snip>
> Now I can "mount -r /dev/ad0s1a /mnt" to get the above results,
> but "fsck /dev/ad0s1a" returns,
> 
>   # fsck /dev/ad0s1a
>   ** /dev/ad0s1a
>   BAD SUPER BLOCK: VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE
> 
>   LOOK FOR ALTERNATE SUPERBLOCKS? [yn] y
> 
>   32 is not a file system superblock
>   SEARCH FOR ALTERNATE SUPER-BLOCK FAILED. YOU MUST USE THE
>   -b OPTION TO FSCK TO SPECIFY THE LOCATION OF AN ALTERNATE
>   SUPER-BLOCK TO SUPPLY NEEDED INFORMATION; SEE fsck(8).

Try 'fsck_ffs -b 160 /dev/ad0s1a' assuming you're using a UFS2 filesystem.
If that doesn't work, try adding the '-D' flag, but heed the warning in
fsck_ffs(8). Only run fsck_ffs when the filesystem is not mounted!

If you can, make a copy of the damaged fs and save it to another disk or
another machine. Then try to repair the copy. If it fails, you haven't
lost your original data.

Roland
-- 
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- 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-questions/attachments/20090731/c63c0762/attachment.pgp


More information about the freebsd-questions mailing list