How to restore a text file from UFS??
rsmith at xs4all.nl
Sun Aug 22 15:44:53 UTC 2010
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 at xs4all.nl> 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.
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20100822/48a88578/attachment.pgp
More information about the freebsd-questions