Question about swap space

meaw229a

Member

Reaction score: 20
Messages: 30

I'm planing a new FreeBSD setup next week. The system will be FreeBSD 13 release and has a single 500 GB pci ssd.
Ram size is 16 GB. I'm planing to go with UFS. How much swap space you recommend. I know in the Unix world there
is the saying just double of your ram. Is this old rule still valid. Does a modern Unix in these days still need so much swap
or is something like matching the installed ram is enough. This setup will just be a desktop system, no server.
Hibernating will most likely not work on the desktop so no swap needed for that. I'm planing for sleep S3 instead of S4.
I know most people here in the forum swear on ZFS but I like to keep it simple for a desktop system and like to go with UFS.

Thanks for some answers!
 

mark_j

Daemon

Reaction score: 795
Messages: 1,371

Swap is not necessarily fixed. You can use a partition on the disk and/or a file. So planning for swap is not really essential. However if you want an approximation then: how long is a piece of string?

It also depends on the usage of your machine. Swap will become necessary when building something vast, generally.
So, pick a figure, say 4gb and create a partition. That will be available immediately. Then if you need more create a file to swap into as well.

There's nothing wrong with ufs, it's a perfectly fine file system, just limited compared to zfs. However you can still raid it, encrypt it etc, so as I said it's a perfectly fine ffs.
 

mark_j

Daemon

Reaction score: 795
Messages: 1,371

Just try running mysql on a raspberry pi with a few other things and get back to me on how overrated swap is. (Speaking of rpi3b and earlier and from experience). Doing port builds will also require it. It's either oom killing/slaughter or bust. ;)
 
OP
M

meaw229a

Member

Reaction score: 20
Messages: 30

Thanks everyone for some suggestions. I just writing this message on a workstation I set up around a year ago. It has
8 GB Ram and I gave it 8 GB swap. It hardly uses any swap. It uses up to all it's ram but usually no swap. I have seen it very few
times using a few MB of swap but never anything like a GB or more.
From there I think I do the same with the new setup and just match the available ram.
If it turns out later on that it's not enough I can still add a swap file as mark_j suggested or just add another ssd and put more
swap on there.

Thanks for all answers.
 

tgl

Member

Reaction score: 40
Messages: 99

Hi guys, I am planning to install FreeBSD for the very first time on a real hardware, I generally (on linux) don't reserve anymore space for swap since I prefer using a swapfile.

I have the same concerning and I am glad to have found this topic already opened. My point is I'd like to use zfs_on_root but I am concerned that the automated paritioning won't me allow to use zfs_on_root without creating a swap partion, I surely check this out though!
 

bakul

Active Member

Reaction score: 90
Messages: 164

I am concerned that the automated paritioning won't me allow to use zfs_on_root without creating a swap partion, I surely check this out though!
I haven't tried this in a very long time but I am sure you can do a manual partitioning. A swap partition is handy if you want to save coredump after a crash. Swapping on a NVME drive or SSD is not too bad so if you have a large enough disk, the swap partition can be of use. But strictly not required.
 

macondo

Active Member

Reaction score: 106
Messages: 206

I got an i3 with 12 GB of ram, I use UFS with 1 GB of swap, works fine.
 

T-Daemon

Daemon

Reaction score: 988
Messages: 1,885

I'd like to use zfs_on_root but I am concerned that the automated paritioning won't me allow to use zfs_on_root without creating a swap partion

If you insist on a system without a swap partition, set "Swap Size" to 0 in the "ZFS Configuration" dialog menu of the installer image.
 
Top