Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Aug 2010 17:44:49 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        Bruce Cran <bruce@cran.org.uk>
Cc:        EforeZZ <eforezz@gmail.com>, freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: How to restore a text file from UFS??
Message-ID:  <20100822154448.GA45979@slackbox.erewhon.net>
In-Reply-To: <20100822151458.000044c9@unknown>
References:  <AANLkTi=vNyd=4sM=EgYpqzzBv-CQA=SuZRhu6YzxvCX5@mail.gmail.com> <20100819201700.GC33689@slackbox.erewhon.net> <20100822151458.000044c9@unknown>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <rsmith@xs4all.nl> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100822154448.GA45979>