On Sun, Aug 22, 2010 at 03:14:58PM +0100, Bruce Cran wrote:
> On Thu, 19 Aug 2010 22:17:00 +0200
> Roland Smith <[email protected]> wrote:
> 
> > 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
> 
> 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?  

It could be a use of ftruncate(2) on FreeBSD as well. As to ext4, I don't know.

> Does calling fsync on FreeBSD not ensure that even with SoftUpdates the data
> 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 lose
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
-- 
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)

Attachment: pgpPWF3nSVIs8.pgp
Description: PGP signature

Reply via email to