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”
ZFS is a large consu6 of RAM. I would think putting swap in ZFS is a terrible idea. I have not checked current recommendations.
OK I’ve only come across the command in the example twice whilst looking.
And here where they say it does work ?
https://www.reddit.com/r/zfs/comments/psr6bp/comment/hdrk237/
You might try adding a cache drive instead. It can help lessen the memory usage zfs needs to maintain speed. My server is spinning rust with an ssd drive attached to the pool as cache.
Command would be “zpool add pool_name cache /dev/sdX” where pool_name is the pool you want the cache on, and /dev/sdX is the empty drive you want to use with it (or partition). Make sure to encrypt this drive before setting this up, my knowledge is zfs doesn’t do that for you.
see here for a bit more information on caching.
.
It’s 512GB of ssd cache plus 128GB of ram, so for now that’s been enough
Ah sorry I responded to the wrong post somehow. Meant that for OP
ZFS was built initially for large SANs so it’s very cache driven. You should get two SSDs and add both for cache.
I don’t have the source right now, but I had the same idea not long ago, and the tl;dr is swap on a zvol is a very bad idea. If your system ever runs low on memory and actually needs to do heavy swapping, you’re setting yourself up for a catastrophe.