From owner-freebsd-stable Wed Jul 26 22:23:37 2000 Delivered-To: freebsd-stable@freebsd.org Received: from KIWI-Computer.com (kiwi-computer.com [63.224.10.3]) by hub.freebsd.org (Postfix) with ESMTP id A5F1437B72F for ; Wed, 26 Jul 2000 22:23:33 -0700 (PDT) (envelope-from freebsd@KIWI-Computer.com) Received: (from freebsd@localhost) by KIWI-Computer.com (8.9.3/8.9.3) id AAA39974; Thu, 27 Jul 2000 00:22:56 -0500 (CDT) (envelope-from freebsd) From: FreeBSD Message-Id: <200007270522.AAA39974@KIWI-Computer.com> Subject: Re: URGENT: bad superblock In-Reply-To: <200007270244.TAA23441@freeway.dcfinc.com> from "Chad R. Larson" at "Jul 26, 2000 07:44:10 pm" To: chad@DCFinc.com Date: Thu, 27 Jul 2000 00:22:56 -0500 (CDT) Cc: Gerhard Sittig , stable@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL61 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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