OPNsense Forum

Archive => 18.1 Legacy Series => Topic started by: dcol on February 06, 2018, 10:16:23 pm

Title: Yay, no more swap file
Post by: dcol on February 06, 2018, 10:16:23 pm
Did a fresh install of 18.1 and saw a guided install option to not use a swap file. Finally, us SSD users have been vindicated! LOL. Makes it worth while to reinstall on major releases. Next reinstall for me will be ZFS.

Anyone with opinions on why I would ever need a swap file with OPNsense?
Title: Re: Yay, no more swap file
Post by: mausy5043 on February 07, 2018, 05:06:45 pm
Anyone with opinions on why I would ever need a swap file with OPNsense?

Only an opinion to the contrary. You do not need a swap file if you have enough RAM.

Swap space is merely a hedge against running out of memory. By adding swap space, you extend the amount of memory the system can use before processes start to fail for lack of it. If you have more RAM than you ever use, then swap is pointless.
Title: Re: Yay, no more swap file
Post by: dcol on February 07, 2018, 06:03:45 pm
Correct about memory available. IMO if you are under 25% of memory usage then you are safe. But the removal of the swap files lets us use smaller SSD drives.
Title: Re: Yay, no more swap file
Post by: franco on February 07, 2018, 06:23:48 pm
Well, it was a feature request so it was implemented. :)

Swap is needed on low memory systems as mentioned earlier.

But there is also an anecdote about our early days and VM installations...

The installer had an opportunistic feature to mount a swap drive on the target disk prior to install. It would include this swap partition into the running system. Needless to say that was removed mostly because if we install to small cards we don't bootstrap a swap partition so what's the use, right.

VM users in particular were stumbling over failing installs for a while. It turned out that 500 MB RAM for the VM was both a little cheap and not an essential amount to install the system.

What happened? Two things:

1. Our package ecosystem grew as we embraced pkgng all the way back in 15.1, which also meant we no longer selectively installed files, no, we pushed the vanilla packages into the system to be compatible with FreeBSD. At one point Perl and Python followed. Suricata and Squid in core also grew the image. Our installation went from < 100 MB to around 700 MB, which barely fit a CD-ROM.

2. All tools that extract or clone a directory structure on FreeBSD have a fatal issue when not enough RAM and Swap is available: it ends the operation with a fatal error, because it thinks there is not possibly enough space to hold all the files.

Now put those two issues together and you get a failing installation and baffled users and developers. Since we have added a RAM warning in the installer as it *really* needs 1GB to install the system cleanly in case there is no swap around.

It's also why we only recommend Nano for low memory systems. At some point we added a swap file option for those to give those setups a little push in the right direction.


Cheers,
Franco