I just migrated my old installation to new one on zfs.
Old- ext4, new zfs pool with dedup=on and compression=on
old:
du -sh /nix/store : 46GB
new (after only copying /nix/store, not actual installation):
➤ sudo zfs get all tank/nix | grep compress
tank/nix compressratio 1.84x -
tank/nix compression on local
tank/nix refcompressratio 1.84x -
➤ sudo zpool get all tank | grep dedup
tank dedupditto 0 default
tank dedupratio 1.70x -
➤ zpool list tank
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
tank 113G 17.1G 95.9G - - 10% 15% 1.69x ONLINE -
Goes without saying that dedup is pretty useful (only if you don’t use store optimization, if you do use store optimization then dedup wins you nothing). That said, my computer was unusable for 3 hours for just 46 GB. It’s an old machine but I think I regularly get 100 MB/s copying on my HDD. Since /nix/store is ready-heavy, I guess I won’t mind the occasional slowdown …
Note also that copying stores is probably not the right approach since it means that your sqlite db is not built which means everything is at risk for garbage collection. I did this only for testing … (see: Rebuild sqlite db from scratch? · Issue #3091 · NixOS/nix · GitHub)