Open Toomoch opened 6 months ago
I had the same issue with my home directory, and I ended up using fileSystems."/home".options = ["noauto"]
.
I tried remove mountpoint
(but keep options.mountpoint
) but it doesn't work very well because then it is not mounted by disko and so activation script can't access my home directory anymore.
An ideal solution is probably to change allow omitting mountpoint
when non-legacy mountpoint is used and still have disko mounting it. Then if someone would like to omit this from fileSystems
config, they can just not have mountpoint
option.
For anyone else hitting this issue and being confused about the solution:
When starting from the example above, you can change
data = {
type = "zfs_fs";
mountpoint = "/zstorage/data";
};
to
data = {
type = "zfs_fs";
options.mountpoint = "/zstorage/data";
};
this means disko will not add the options that will mount the datasets via systemd, but the zfs option mountpoint
will still be defined, and so if the zpool is imported, the dataset is automatically mounted. You might still have to add the pool manually by setting boot.zfs.extraPools = [ "zstorage" ];
(or whatever your pool name is).
The disadvantage of this is that it won't work if you need the dataset to be mounted immediately during the installation (like for /home
), in which case the noauto
flag as mentioned by @nbdd0121 would be the better solution.
However, if you're using datasets purely for data storage of other services, this won't be an issue, as systemd will make sure all mounts are completed before trying to start any userspace services.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
First, I created the following zpool:
Then ran the vm-test, and it gives the following error when booting:
It seems that the filesystem is being mounted twice, however, I haven't defined any fileSystems options in the NixOS configuration. If I add mountpoint="legacy" to all datasets, the issue goes away. Full configuration: https://github.com/Toomoch/nixos-config/blob/4cbacfebd7a2cc31af913fb51fc2a45d93e54cf0/system/machine/h81/disko.nix
EDIT: apparently systemd and zfs are trying to mount it, is there a way to stop systemd from mounting it using disko?