From owner-freebsd-fs@FreeBSD.ORG Thu Jul 29 01:15:26 2004 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B2CB716A4CF; Thu, 29 Jul 2004 01:15:26 +0000 (GMT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8AB7A43D2F; Thu, 29 Jul 2004 01:15:26 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.10/8.12.10) with ESMTP id i6T1F7OF001741; Wed, 28 Jul 2004 18:15:07 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.10/8.12.3/Submit) id i6T1F7IO001740; Wed, 28 Jul 2004 18:15:07 -0700 Date: Wed, 28 Jul 2004 18:15:07 -0700 From: Brooks Davis To: David Kreil Message-ID: <20040729011507.GB20909@Odin.AC.HMC.Edu> References: <200407290043.i6T0hTC26000@puffin.ebi.ac.uk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oLBj+sq0vYjzfsbl" Content-Disposition: inline In-Reply-To: <200407290043.i6T0hTC26000@puffin.ebi.ac.uk> User-Agent: Mutt/1.5.4i cc: freebsd-fs@freebsd.org cc: freebsd-questions@freebsd.org Subject: Re: How to recover/reinitialize a trashed /var partition? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2004 01:15:26 -0000 --oLBj+sq0vYjzfsbl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 29, 2004 at 01:43:29AM +0100, David Kreil wrote: >=20 > Hello, >=20 > I am writing in the hope that someone can give me a hint of how to either= =20 > recover or recreate a virgin FreeBSD /var partition in an otherwise=20 > (apparently) functioning system. >=20 > Probably in the process of a drive failure in our hardware raid our /var= =20 > volume got corrupted (yeah, I know this should not happen... sigh. I now = also=20 > understand why it is recommended having /var on a separate partition...). >=20 > I tried running fsck -y on /var after umount-ing it, which gives a=20 > segmentation fault (exit on signal 11) some way through the process after= =20 > displaying >=20 > ** Phase 2 - Check Pathnames > ROOT INODE UNALLOCATED > UNEXPECTED SOFT UPDATE INCONSISTENCY >=20 > ALLOCATE? yes >=20 > CG 0: BAD MAGIC FILE NUMBER > UNEXPECTED SOFT UPDATE INCONSISTENCY >=20 > Now I wonder > - is this beyond repair? I should much like to recover /var, > just to be able to have a look at the /var/logs to get an idea what > went wrong when. About 3.6GB are reported to be in use by df. I'm guessing it's beyond reasionable repair, but I'm not ufs expert. Unless you've got data on there that you really need and didn't have backed up, I'd just rebuild from acratch. > - If I cannot recover the /var partition, what is the canonical way of > recreating it? I suppose I can run newfs on it, but how do I create the > necessary subdir structure with the right file-permissions? Could > /stand/sysinstall do that? The short version is: # populate /var /usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var # add sendmail bits /usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / # create new syslog files /usr/sbin/newsyslog -CC # add a lastlog file /usr/bin/touch /var/log/lastlog I cribbed this from /etc/rc.d/var on current. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --oLBj+sq0vYjzfsbl Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFBCE+aXY6L6fI4GtQRArxCAKDJ/P9CAM3Y9K0C5Pc2zpSB2ODbjgCfSTmw CWTYfpxt0n9itJ0JMRA9DFI= =opSh -----END PGP SIGNATURE----- --oLBj+sq0vYjzfsbl--