From owner-freebsd-questions@FreeBSD.ORG Sun Aug 22 15:44:53 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 B951210656A9 for ; Sun, 22 Aug 2010 15:44:53 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr2.xs4all.nl (smtp-vbr2.xs4all.nl [194.109.24.22]) by mx1.freebsd.org (Postfix) with ESMTP id 341D68FC1F for ; Sun, 22 Aug 2010 15:44:52 +0000 (UTC) Received: from slackbox.erewhon.net (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr2.xs4all.nl (8.13.8/8.13.8) with ESMTP id o7MFinVB083000; Sun, 22 Aug 2010 17:44:49 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.erewhon.net (Postfix, from userid 1001) id 183B7BAA0; Sun, 22 Aug 2010 17:44:49 +0200 (CEST) Date: Sun, 22 Aug 2010 17:44:49 +0200 From: Roland Smith To: Bruce Cran Message-ID: <20100822154448.GA45979@slackbox.erewhon.net> References: <20100819201700.GC33689@slackbox.erewhon.net> <20100822151458.000044c9@unknown> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="W/nzBZO5zC0uMSeA" Content-Disposition: inline In-Reply-To: <20100822151458.000044c9@unknown> 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: EforeZZ , 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: Sun, 22 Aug 2010 15:44:53 -0000 --W/nzBZO5zC0uMSeA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 22, 2010 at 03:14:58PM +0100, Bruce Cran wrote: > On Thu, 19 Aug 2010 22:17:00 +0200 > Roland Smith wrote: >=20 > > 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 webpage; > > http://www.xs4all.nl/~rsmith/unix/configfiles.html >=20 > This failure, where files are truncated to 0 bytes after an unclean > shutdown isn't the same way ext4 was truncating files when using editors > which overwrite files in-place (as opposed to writing to a temporary > file then renaming) is it? =20 It could be a use of ftruncate(2) on FreeBSD as well. As to ext4, I don't k= now. > Does calling fsync on FreeBSD not ensure that even with SoftUpdates the d= ata > is on the disk before the editor has exited? I think so, to the extent that FreeBSD is able. Disks usually cache writes internally, so if the system crashes before that cache is flushed, you'll l= ose data. You can disable the write cache for ad(4) by setting the sysctl hw.ata.wc to 0 at boot time, but this will impact performance. 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) --W/nzBZO5zC0uMSeA Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkxxRfAACgkQEnfvsMMhpyUNugCfSKOe8UA4hVsxBEMmyedDvt2v ZA4AoJG7LCBbbgXj41cF2loQTx9A3gjv =ZpJ8 -----END PGP SIGNATURE----- --W/nzBZO5zC0uMSeA--