swap to a sparse file

Victor Sudakov vas at mpeks.tomsk.su
Thu Oct 11 01:47:07 UTC 2018


Dear Colleagues,

I've inherited a swapless FreeBSD 11.2 host with no unused disk space.
I would like to add some swap to be on the safe side: in case there is
a memory leak etc.

On the other hand, I don't like to waste several gigabytes on a
precious SSD because perhaps the system will never need this swap
space anyway.

The FreeBSD Handbook prescribes creating a swap file with "dd if=/dev/zero ..."
which would waste the space.

Is there any good reason I can't just "truncate -s2G /swap0" and
make the swap a sparse file? 

Thanks in advance for any input.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49 at fidonet http://vas.tomsk.ru/


More information about the freebsd-questions mailing list