One for those running #ZFS on #Linux systems. I realise that you can’t have hibernate aka suspend to disk on a swap in the encrypted zpool but if you don’t use hibernation then is it OK to use swap using the likes of the command example below to set it up in the encrypted pool?
I should point out that I’m thinking of switching from my current Void Linux luks lvm setup to Void with fully encrypted zpool and zfsbootmenu on my ThinkPad P14s AMD Gen 1which has 16Gb ram that I may upgrade to 40Gb. It also has a 1Tb nvme.
zfs create -V “${v_swap_size}G” -b “$(getconf PAGESIZE)” -o compression=zle -o logbias=throughput -o sync=always -o primarycache=metadata -o secondarycache=none -o com.sun:auto-snapshot=false “$v_rpool_name/swap”
I haven’t used swap on zvol myself, but I’ve read about issues in low-memory situations, like this one: https://github.com/openzfs/zfs/issues/7734
To write to swap, zfs needs to allocate ARC memory. But to do that, it would need to write to swap…
Consider using zramswap, that’s probably the easiest solution.
You shouldn’t use swap on zvol in Linux at all. It will lead to dead lock when high memory pressure. See also https://github.com/openzfs/zfs/issues/7734