From owner-freebsd-questions Tue May 28 15:11:52 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id PAA06530 for questions-outgoing; Tue, 28 May 1996 15:11:52 -0700 (PDT) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id PAA06504 for ; Tue, 28 May 1996 15:11:47 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by who.cdrom.com (8.6.12/8.6.11) with ESMTP id KAA06677 for ; Tue, 28 May 1996 10:23:49 -0700 Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id KAA11319; Tue, 28 May 1996 10:19:39 -0700 From: Terry Lambert Message-Id: <199605281719.KAA11319@phaeton.artisoft.com> Subject: Re: Ist there a way to easily reconstruct partition/slice tables? To: ost@comnets.rwth-aachen.de Date: Tue, 28 May 1996 10:19:39 -0700 (MST) Cc: freebsd-questions@freebsd.org In-Reply-To: <199605280810.KAA23103@smeagol.comnets.rwth-aachen.de> from "Martin Ostermann" at May 28, 96 10:10:36 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > last night I cleared the first few blocks on my FreeBSD disk. It had > nothing particular important on it, which wasn't backup'd, but > contained some configuration data that would take me a while to > restore. > > Is it possible to automatically identify the beginning and endings of > the UFS file systems, and thus construct a new partition table or > label? It doesn't need to be perfect, just enough to copy the relevant > information. In /usr/src/sys/ufs/ffs/fs.h: #define FS_MAGIC 0x011954 /* the fast filesystem magic number */ 1) Look for this value (McKusick's birthday 8-)) as a longword value. At the offset you find the value, minus: ((int)&((struct fs *)0)->d_magic) You will find the start of the superblock for the FS. Look at the first one of these minus 8k minus the size of the disklabel for the start of the partition (assuming reserved space for boot blocks). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.