From owner-freebsd-fs@FreeBSD.ORG Mon Mar 28 12:54:54 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA5B2106566B for ; Mon, 28 Mar 2011 12:54:54 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from fallbackmx09.syd.optusnet.com.au (fallbackmx09.syd.optusnet.com.au [211.29.132.242]) by mx1.freebsd.org (Postfix) with ESMTP id 5EDAA8FC12 for ; Mon, 28 Mar 2011 12:54:53 +0000 (UTC) Received: from mail17.syd.optusnet.com.au (mail17.syd.optusnet.com.au [211.29.132.198]) by fallbackmx09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p2SB0X2H022298 for ; Mon, 28 Mar 2011 22:00:33 +1100 Received: from server.vk2pj.dyndns.org (c220-239-116-103.belrs4.nsw.optusnet.com.au [220.239.116.103]) by mail17.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p2SB0TgB007893 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Mar 2011 22:00:29 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.4/8.14.4) with ESMTP id p2SB0SpN011447; Mon, 28 Mar 2011 22:00:28 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.4/8.14.4/Submit) id p2SB0RFi011437; Mon, 28 Mar 2011 22:00:27 +1100 (EST) (envelope-from peter) Date: Mon, 28 Mar 2011 22:00:26 +1100 From: Peter Jeremy To: Anders Andersson Message-ID: <20110328110026.GA96624@server.vk2pj.dyndns.org> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cWoXeonUoKmBZSoM" Content-Disposition: inline In-Reply-To: X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-fs@freebsd.org Subject: Re: Recover a ufs2 filesystem from a reformat with another ufs2 filesystem X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Mar 2011 12:54:55 -0000 --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2011-Mar-26 15:27:09 +0100, Anders Andersson wrote: >Perhaps it would be beneficial if some of this information was spread >out at random for recover purpose, although I don't know what bad side >effects this would create. Well, the backup superblocks have to be at known locations so that fsck and/or the user can find them. Traditionally, they were offset by a track more than an integral number of cylinders so the loss of an entire platter wouldn't destroy all superblocks - the code still does this but CHS values are no longer meaningful. Much of the UFS code works on the assumption that cylinder groups and inodes are located at regular locations through the disk so they can be located using simple arithmetic - check out the various macros in . About the best you can do is to build your filesystems with non-default parameters so that if you accidently newfs it with default parameters, it won't overwrite all the superblock copies. Of course, it will write superblocks all over your data. OTOH, since UFS2 doesn't pre-allocate inodes, if you newfs with the same parameters, you have destroyed the CG-level metadata but the majority of the inodes and all of the data will remain untouched. They can't be recovered by fsck but a custom process that looked at all the potential inodes associated with a cylinder group would find most of the files. --=20 Peter Jeremy --cWoXeonUoKmBZSoM Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iEYEARECAAYFAk2QakoACgkQ/opHv/APuIfa1QCgpOT42OneHllPLO5I8m8uEBmJ 8iEAoJXP/y3SZRAHpHQY/0GdeF3FA7x5 =Puup -----END PGP SIGNATURE----- --cWoXeonUoKmBZSoM--