Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jul 2000 00:22:56 -0500 (CDT)
From:      FreeBSD <freebsd@KIWI-Computer.com>
To:        chad@DCFinc.com
Cc:        Gerhard Sittig <Gerhard.Sittig@gmx.net>, stable@FreeBSD.ORG
Subject:   Re: URGENT: bad superblock
Message-ID:  <200007270522.AAA39974@KIWI-Computer.com>
In-Reply-To: <200007270244.TAA23441@freeway.dcfinc.com> from "Chad R. Larson" at "Jul 26, 2000 07:44:10 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> > Returning to the problem:  From L*'s ext2fs I know of a method to
> > fallback to the superblock's copies sprinkled all over the disk
> > (every 8192 blocks?) when the "first" one is damaged.  This info
> > could at least be used to restore the first one to make mount
> > work again.  Is there some similar mechanism for ffs/ufs?
> 
> The second one is always at block 32, I believe.
> 
> So, "fsck -b 32 [filesystem]" should do ya.

That is correct.  I just spent a few hours diving into FFS and I do believe
that block 32 (assuming you use 512-byte device "sectors" and that your FS
uses 1024-byte fragment "blocks") is the second super block.  According to
my analysis, the primary super block is always 8192 bytes from the start of
the filesystem,  which would make it block #16.  But chances are if your
primary was trashed because of hardware failure, that your secondary is
trashed also.

Manually, you can find a superblock by scanning certain sectors for the
super block magic number (which is little-endian 0x011954, located at byte
offset 0x55C into the super block).  You wouldn't have to scan every
sector, as super blocks usually are FS block #16 into each cylinder group.
Cylinder groups always fall on cylinder boundaries; I recommend checking
device sector #s: 65536n + 32, that is 65568, 131104, etc.  Or at worst,
1024n + 32...  By default newfs(1) creates a new cylinder group every 16
cylinders, so you could write up a quick script to grab the disklabel &
search for super-blocks.  Or scan every sector...  ;)

Reading through fsck(1)'s code, it looks like fsck tries its best to find a
usable super-block, so that may be enough for you.

-- Rick C. Petty


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007270522.AAA39974>