"Cannot find file system superblock" error - how to recover?

Ion-Mihai Tetcu itetcu at apropo.ro
Wed Dec 3 05:38:11 PST 2003


On Wed, 3 Dec 2003 00:06:12 -0800 (PST)
"Scott I. Remick" <scott at sremick.net> wrote:

> Running 5.1-REL on a system w/ 2 drives. Was saving a file to 2nd drive
> (mounts as /data) and system suddenly froze then rebooted. Never good. Fsck
> barfed on startup telling me I had to run it manually. The error I'm stuck
> with is:
> 
> /dev/ad6s1c
> Cannot find file system superblock
> /dev/ad6s1c: NOT LABELED AS A BSD FILE SYSTEM
> 
> Searching on this error hasn't been very productive. Some people talk about
> a "LOOK FOR ALTERNATE SUPERBLOCKS?" question that I'm not getting when I run
> fsck. There's also mention of an undocumented -b option to fsck for fixing
> this. 

FSCK_FFS(8)             FreeBSD System Manager's Manual            FSCK_FFS(8)

NAME
     fsck_ffs, fsck_ufs -- file system consistency check and interactive
     repair

SYNOPSIS
     fsck_ffs [-BFpfny] [-b block#] [-c level] [-m mode] filesystem ...


-b      Use the block specified immediately after the flag as the super
        block for the file system.  Block 32 is usually an alternate
        super block.

The key world is usually.

> Then there's some scary manual method using dd:
> 
> dd if=/dev/ad6s1c skip=32 of=/dev/ad6s1c seek=16 bs=512 count=16

Try doing a newfs -N and see if using some of the alternatives
super-blocks in fsck_ufs will help. Note that the alternate superblock
is no longer always at 32, it depends on the size of the file system.

http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/ufs/ffs/fs.h?rev=1.39&content-type=text/x-cvsweb-markup

* Depending on the architecture and the media, the superblock may
 * reside in any one of four places. For tiny media where every block 
 * counts, it is placed at the very front of the partition. Historically,
 * UFS1 placed it 8K from the front to leave room for the disk label and
 * a small bootstrap. For UFS2 it got moved to 64K from the front to leave
 * room for the disk label and a bigger bootstrap, and for really piggy
 * systems we check at 256K from the front if the first three fail. In
 * all cases the size of the superblock will be SBLOCKSIZE. All values are
 * given in byte-offset form, so they do not imply a sector size. The
 * SBLOCKSEARCH specifies the order in which the locations should be searched.
 */
#define SBLOCK_FLOPPY     0
#define SBLOCK_UFS1  8192
#define SBLOCK_UFS2 65536
#define SBLOCK_PIGGY262144
#define SBLOCKSIZE  8192
#define SBLOCKSEARCH \
{ SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }

-- 
IOnut
Unregistered ;) FreeBSD user


More information about the freebsd-questions mailing list