How to configure swap?

nomenator

Cadet
Joined
Dec 18, 2021
Messages
6
I'm on a new scale installation, and right now I'm booting from an SSD that has sufficient size to dedicate all the swap space that I'll ever need. So I want to put all of the swap for the system on my boot drive in a single swap file. I can't figure out how to do it, though. Can anyone help out?


So far, I've done successfully the following things:

Used CLI to set
Code:
{"swapondrive":0}

Code:
dd if=/dev/zero of=/usr/swap0 bs=1M count=131072


I also failed the following things:
add swap record to fstab - the record appears there, but won't recognize,
Code:
swapon -aL
won't execute, providing -L with the appropriate location does not generate the appropriate result either
Code:
swapon /usr/swap0
- will not work, says "file has holes". The reasoning for failure is understandable, but why would the file have holes, and how to avoid them?
Code:
fallocate -l 120G /ur/swap0
- will not work, says "no space left on device" - the device clearly has over 200G of space available
Code:
mount boot partition on /mnt/root
- will not work, says "unknown filesystem type 'zfs_member'

Can anyone enlighten me, how exactly I should go about dedicating specific swap space for the system?
 
Top