Skip to content

Instantly share code, notes, and snippets.

@learntheropes
Last active July 5, 2023 03:37
Show Gist options
  • Save learntheropes/365edf08b47ff0c4d65e8a991539388d to your computer and use it in GitHub Desktop.
Save learntheropes/365edf08b47ff0c4d65e8a991539388d to your computer and use it in GitHub Desktop.
Ubuntu set swap on a zfs drive
# https://askubuntu.com/questions/1198903/can-not-use-swap-file-on-zfs-files-with-holes/1198916#1198916
sudo zfs create -V 8G -b $(getconf PAGESIZE) -o logbias=throughput -o sync=always -o primarycache=metadata -o com.sun:auto-snapshot=false rpool/swap
sudo mkswap -f /dev/zvol/rpool/swap
sudo swapon /dev/zvol/rpool/swap
# Make the swap persistent after reboot
# https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04#step-5-making-the-swap-file-permanent
echo '/dev/zvol/rpool/swap none swap sw 0 0' | sudo tee -a /etc/fstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment