How to fix bad superblock on UFS2?

DA Forsyth d.forsyth at ru.ac.za
Wed Jul 20 08:54:59 UTC 2011


On 20 Jul 2011 , Maxim Konovalov entreated about
 "Re: How to fix bad superblock on UFS2?":

> Try to use tools/tools/find-sb to locate superblocks.

Thankyou Maxim
I may yet need to use that on another partition, but last night I 
achieved some success by hacking fsck_ffs to display what it is 
doing.  By doing this I found that it considers the 'first alternate' 
superblock to be the one in the LAST cylinder group.

So, by using dd to copy a working superblock to block 128 and to the 
last one listed by 'newfs -N', fsck_ffs could then actually recover 
some files.  Since I probably broke more things on this partition 
than were broken by the 'disk smoke event', I was not surprised when 
only about half the drives files showed up in lost+found and the 
primary folder is now empty (the whole drive is a Samba share with 
quotas, so I create a folder to share so that users cannot mess with 
the quota.* files).   Not a problem for this partition as I have a 
full level 0 dump.

I now have 2 more partitions to resurrect....
both report 'Cannot find file system superblock' though 'newfs -N' 
shows a sensible list of them, so I have hope.

But, further thanks to you for pointing out find-sb, because in 
googling for that I found various other very useful things, including
http://www.chakraborty.ch/tag/raid-filesystem-partition-recovery-ufs-
freebsd/
which at the least, points out things to avoid doing (-:

thanks

--
       DA Fo rsyth            Network Supervisor
Principal Technical Officer -- Institute for Water Research
http://www.ru.ac.za/institutes/iwr/




More information about the freebsd-questions mailing list