Recovering Trashed Filesystems
Crist J. Clark
cristclark at comcast.net
Mon Aug 3 06:49:24 UTC 2009
On Fri, Jul 31, 2009 at 12:00:46PM +0200, Polytropon wrote:
> On Thu, 30 Jul 2009 23:46:50 -0700, "Crist J. Clark" <cristclark at comcast.net> wrote:
> > We see "usr" is messed up. And what I'd like to recover are
> > files up in usr/local/etc.
> > 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).
> You could try do locate superblocks using this command:
Err... Hmmm. Seems to be something missing here?
> Install the port ffs2recov and use its -s and -p options. Refer
> to the excellent manpage.
I got ffs2recov(1) and it would seem to be exactly what I need,
but it's not working so well for me. I ran it with "-s" and it found
superblock: 116113408(byte), 226784(block), cg: 116129792(byte), 226816(block), 10(nth), fs begin: 18446744073706014720(block), primary sb at: 18446744073706014848(block)
superblock: 147439616(byte), 287968(block), cg: 147456000(byte), 288000(block), 2(nth), fs begin: 18446744073709086720(block), primary sb at: 18446744073709086848(block)
superblock: 308805632(byte), 603136(block), cg: 308822016(byte), 603168(block), 11(nth), fs begin: 18446744073706014720(block), primary sb at: 18446744073706014848(block)
superblock: 340131840(byte), 664320(block), cg: 340148224(byte), 664352(block), 3(nth), fs begin: 18446744073709086720(block), primary sb at: 18446744073709086848(block)
But if I try to access that superblock as specified in the
net5501# ffs2recov -o 226784 -p /dev/ad0s1f
get_sblock: Bad magic (0)
It doesn't work, but if I try it with bytes rather than blocks,
net5501# ffs2recov -o 116113408 -p /dev/ad0s1f
magic 19540119 (UFS2) time Fri Jun 27 20:36:13 2008
superblock location 65536 id [ 4865b1ad c24cb822 ]
ncg 21 size 1970116 blocks 1907915
That makes me nervous.
Anyway, I don't seem to be getting very far. ffs2recov(1) would seem
to be exactly the thing I need, but it's not finding any files.
> Finally, may I ask if you have any ideas about what caused this problem?
Oh, yeah. The file systems reside on flash memory. I've been
having issues with it for some time. It was bad enough that I
couldn't get good dump(8)s of the file system for quite a while
and running stuff like that made it more unstable. I did manual
backups periodically of files that were more important, but of
course, it failed right before I was due to make backups but
after I had made a few changes earlier in the week.
Once I recover all I can, I'll go spend another whopping $20
on a few gig of flash at Fry's. Right now, I'm net booting the
sick little box in question.
Crist J. Clark | cjclark at alum.mit.edu
More information about the freebsd-questions