[Nix-dev] NILFS2, NixOS, nixpart and Blivet

Tim Barbour trb at categorical.net
Tue Sep 30 13:08:41 CEST 2014


NILFS2 is a log-structured filesystem which is now in the Linux kernel source
tree, and supported by GRUB2. It should appeal to NixOS users because it
avoids destructive update ("changing" a file produces a new version of the
file).

I have installed NixOS with all filesystems on NILFS2, but encountered some
problems along the way.

The most serious problem is that NILFS2 needs to update /etc/mtab when
mounting a filesystem, so that it can store information about the
nilfs_cleanerd process associated with the mounted filesystem. If it cannot
write to /etc/mtab, it does not start nilfs_cleanerd, and thus does not do
garbage collection. In NixOS, /etc/mtab is just a symlink to /proc/mounts. I
have worked around this manually so far, by replacing the symlink with a copy
of /proc/mounts, then remounting all the NILFS2 filesystems. I am not sure how
to resolve this properly. It is possible to mount using the '-n' option, but
then NILFS2 will not start nilfs_cleanerd; it can be started later, but that
requires writing to /etc/mtab. Perhaps the right way would be to mount using
'-n', then start nilfs_cleanerd separately, but care would be necessary to
make sure that nilfs_cleanerd is started exactly once (per filesystem), and
shutdown appropriately at unmount.

Another problem is that nixpart does not work with NILFS2, because Blivet does
not support it. I modified Blivet (0.41) to support NILFS2, but the NixOS
Blivet packages use a very old version (0.17-1), so I cannot easily test my
change against the latest version of Blivet. I have back-ported it to 0.17-1,
and used that to setup partitions and filesystems for the above NixOS
installation. I noticed one problem: it did not label any of the volumes, not
even swap, even though I specified labels. I suspect this is a deficiency of
Blivet 0.17-1, and imagine it is already fixed in Blivet 0.41 .

I considered updating the NixOS Blivet package(s), but they do some
tricky-looking processing on the source code, and I doubt that I could update
that properly for the current source code. If the maintainer could update the
Blivet packages, then I would test my patch against the current Blivet, and
send it to the upstream maintainers.

I attach a tarball with patches for Blivet (note that the 0.41 patch is
untested).

Tim
---
GPG public key available at: 
	 http://phasechangeit.com/~trb/gpg-key  or 
	 http://subkeys.pgp.net:11371
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patches.tar.gz
Type: application/octet-stream
Size: 1504 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140930/1d1cc10a/attachment.obj 


More information about the nix-dev mailing list