Vm.swap_enabled sysctl

  • In this message https://forum.pfsense.org/index.php?topic=85175.msg467405#msg467405 it says there is an option in the System, Advanced, System Tunables tab, an option to switch off the swap file in version 2.1.x.

    I dont see this option in 2.2 RC, has it been removed or changed, or is there another/better way to switch off swap?

    My swap is currently sized at 16GB with 8GB of ram, and use on avg about 6% of the ram.

  • That wasn't saying it was there in the list, rather noting it can be added there. Not really any reason to disable it, unless you really want the system to crash if it'd get to a point where it needs swap. It won't touch it unless it's needed.

    So you can add it there, but you most likely don't want to.

  • I did add it after posting to see what would happen, it still shows the swap in the status page, but I also wondered whether using
    vm.swappiness=0 would be a better compromise to reduce disk writes instead, although I prefer a range of vm.swappiness=10 to vm.swappiness=40 on some Linux.


    This option kern.ipc.shm_use_phys=1 will make shared memory not swap if the swap file has not been disabled, used by Postgres SQL amongst others, but apparently this will also stop shared memory regions from being included into a coredump, which might also be a feature if they get included in the system crash reports?

  • That doesn't make the swap go away, just prevents it from being used (though that might require a reboot). vm.swappiness is a Linux thing that doesn't exist on FreeBSD.

    Unless you're actually hitting swap, in which case you should have more RAM, whether or not swap is enabled has no impact on disk writes as it won't be touched.

  • It sounds like freebsd works the opposite way to the windows swap files, in that windows will use swap irrespective of ram, but with freebsd it sounds like its used only when physical ram is exceeded, and Linux does a bit of both with the swappiness option.

    Just wanted to make sure I was not inadvertently prematurely ageing my firewall.

    Thanks for the info.

Log in to reply