From owner-freebsd-questions@FreeBSD.ORG Thu Aug 19 20:17:02 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C31671065675 for ; Thu, 19 Aug 2010 20:17:02 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr6.xs4all.nl (smtp-vbr6.xs4all.nl [194.109.24.26]) by mx1.freebsd.org (Postfix) with ESMTP id 3E28E8FC18 for ; Thu, 19 Aug 2010 20:17:01 +0000 (UTC) Received: from slackbox.erewhon.net (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr6.xs4all.nl (8.13.8/8.13.8) with ESMTP id o7JKH1Xi077866; Thu, 19 Aug 2010 22:17:01 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.erewhon.net (Postfix, from userid 1001) id EFB5ABAA6; Thu, 19 Aug 2010 22:17:00 +0200 (CEST) Date: Thu, 19 Aug 2010 22:17:00 +0200 From: Roland Smith To: EforeZZ Message-ID: <20100819201700.GC33689@slackbox.erewhon.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Sr1nOIr3CvdE5hEN" Content-Disposition: inline In-Reply-To: X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: freebsd-questions Subject: Re: How to restore a text file from UFS?? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2010 20:17:02 -0000 --Sr1nOIr3CvdE5hEN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 19, 2010 at 09:07:51PM +0300, EforeZZ wrote: > I edited my 50Kb /etc/rc.conf, loaded a driver and.... got a kernel panic= !! > After reboot my /etc/rc.conf is 0 bytes (after automatic background fsck). > Which tool should I try now to restore any version of my rc.conf?.. The programs from sysutils/sleuthkit might help. > I think data should still be somewhere on the disk.... That depends on if the partition where /etc/rc.conf is located is read/write or read-only. In the latter case you are correct. In the former case part or all of the sectors could have been re-used for other files. For the best chance at recovery, make your root partition read-only _now_. For future reference; you should never edit files in /etc/ directly. If you want ot edit files in /etc or /usr/local/etc, first copy them to a directory in your $HOME, put them under revision control and then edit them and copy = the edited files to /etc. That way you always have a backup and you can even restore previous versions. I've documented the procedure I use on my webpag= e; http://www.xs4all.nl/~rsmith/unix/configfiles.html Roland --=20 R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) --Sr1nOIr3CvdE5hEN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkxtkTwACgkQEnfvsMMhpyW3FACgoVf7+N+iXiYnxDKfGHMzmBxv +z4AnjwqRqaYMybMGpGlI2cJTKY+mSgJ =MMIu -----END PGP SIGNATURE----- --Sr1nOIr3CvdE5hEN--