[Nix-dev] The fsync issues with nix
Lluís Batlle i Rossell
viric at viric.name
Wed Mar 21 20:11:04 CET 2012
Hello,
talking with the btrfs people, they are specially aware of a problem related to
writing files to disk "properly".
I think 'nix' does not 'fsync' on every file it writes to the store; does it? in
non-chroot, it even isn't nix who puts the files in the store, so...
Without fsync, there is no guarantee that the files will be on place on a crash.
As the sqlite database cares on its fsync, the database will not be very correct
about the files in the store.
ext3 filesystem had a particular case of 'sync all before any mv', to guarantee the
'mv' atomic, but other filesystems don't sync all on mv.
Look at the "Delayed allocation and potential data loss" part of the article in
http://en.wikipedia.org/wiki/Ext4
So, user tools have to be written properly, so they fsync data before 'mv'.
Of course I mention all this because I have my /nix/store with zero-length
files, most of them related to upstart, which rendered my system quite unusable
for the recent nixos generations.
Shouldn't we have proper fsyncs (even syncs maybe) to guarantee the database to
map well with the store?
Or we have an "ext3-conditions-only" package manager? :)
If anyone knows the issue better, perfect. I'm just writing this as I already
have a dozen of broken files in the store.
Regards,
Lluís
More information about the nix-dev
mailing list