Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jul 2011 14:28:57 +0200
From:      "DA Forsyth" <d.forsyth@ru.ac.za>
To:        freebsd-fs@freebsd.org
Cc:        freebsd-questions@freebsd.org
Subject:   How to fix bad superblock on UFS2?
Message-ID:  <4E257889.12343.39F99213@d.forsyth.ru.ac.za>

Next in thread | Raw E-Mail | Index | Archive | Help
Hi all

I had a drive let out smoke, it was part of a 4 drive RAID5 array on 
an intel Matrix motherboard controller (device ar).  Having fought 
various battles just to get the machine to boot again (had to upgrade 
to 7.4 from 7.2 to do it because of a panic in ataraid.c) I now have 
some partitions reporting superblock problems.   Havign googled 
around this topic for some hours now, and having tried copying one or 
more of the backup superblocks to the primary and secondary (at block 
160), I still get....

** /dev/ar0s1f
BAD SUPER BLOCK: VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST 
ALTERNATE
 
it then asks if it must look for alternates but claims 32 is not one 
and stops.  All my partitions are UFS2 so why doesn't it look at 
block 160, which 'newfs -N' finds correctly as the next superblock 
copy?

So, how do I fix this?

Also, why does fsck_ufs prompt to update the primary superblock when 
you give it an alternate with '-b xx', and then not do it?

I have now tried booting from the FreeBSD 8.2 live CD in the hopes 
that the most recent fsck will actually fix this, but it does not.

One thing I found in my web searching is that there is confusion over 
block sizes.  'newfs -N' appears to report sector counts as block 
addresses. 
Doing 
dd if=/dev/ar0s1fbs=512 skip=160 count=16 | hd -v | grep "54 19"
bears this out as the output does indeed contain the correct magic 
number.  'fsck_ufs -b 160 /dev...' also works as expected, but then 
you try 'fsck /dev/...' and it will report the bad superblock, and 
then fail to find any backup superblocks, which newfs managed just 
fine, and this might be because the disk thinks blocks are 16384 in 
size.

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





Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?4E257889.12343.39F99213>