On one laptop, I have two swap devices (because of reusing historical partitioning / zfs pool):
swapDevices = [
{
device = "/dev/disk/by-id/nvme-T[...]-part2";
randomEncryption = {
enable = true;
allowDiscards = true;
};
priority = 1;
discardPolicy = "both";
}
{
device = "/dev/zvol/rpool/SWAP";
priority = 0;
discardPolicy = "both";
}
];
It’s using zfs encryption for the pool contents, so I don’t have a separate random encryption requirement there.
This all works fine, except there is a pause during boot, waiting for the zvol device to appear, even after the zfs encryption passphrase has been entered. It’s not unbearably long, maybe 20s or so, but it’s by far the longest pause in the boot process, aside from the passphrase prompt. But it’s annoying, and totally unnecessary: there’s plenty of RAM, another swap device already online (with higher priority), and neither gets used often unless certain heavier workloads get run long after boot.
What I’d like is an option to tell systemd that there’s no need to wait for this swap device to be online, and just let it complete in the background asynchronously. That probably means getting swap.target
to not wait on it.
There doesn’t seem to be a nix option for it. This gets written out to an fstab file, for systemd generator to parse and make the individual services from, and in turn I can’t see an fstab option for it either. There’s a nofail
option but that’s not quite what I want.
Does anyone have any ideas how to do this?