Swap: Difference between revisions
Phanirithvij (talk | contribs) m minor edit #2 |
Phanirithvij (talk | contribs) m minor edit #3 |
||
| Line 62: | Line 62: | ||
[https://github.com/Tookmund/Swapspace Swapspace] is a dynamic swap space manager for GNU/Linux. i.e. it allows unused disk space to be utilised as swap to handle the occasional memory-intensive task, and frees the disk space once done. | [https://github.com/Tookmund/Swapspace Swapspace] is a dynamic swap space manager for GNU/Linux. i.e. it allows unused disk space to be utilised as swap to handle the occasional memory-intensive task, and frees the disk space once done. | ||
Enable it via <code>services.swapspace.enable = true;</code> in your nixos configuration. | Enable it via <code>services.swapspace.enable = true;</code> in your nixos configuration. And after switching, check that <code>systemctl status swapspace.service</code> is green, that's all, swapspace will auto manage swap for you. | ||
See all the options it supports here, [https://search.nixos.org/options?query=swapspace search.nixos.org] | See all the options it supports here, [https://search.nixos.org/options?query=swapspace search.nixos.org] | ||
You can also use zramSwap along with this service. | |||
See your active swap partitions/files with | |||
{{warning|Do not run the following without swapspace active + | See your active swap partitions/files with <code>swapon</code>. For eg. | ||
{{warning|Do not run the following without swapspace active + more than 34GB free disk space (assuming 8GB ram) OR without 42GB+ ram to spare.}} | |||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
# Read the WARNING above, | # Read the WARNING above, and adjust 2, 20GB according to your free space | ||
$ # nix shell nixpkgs#stress.out -c stress --vm 2 --vm-bytes 20G | $ # nix shell nixpkgs#stress.out -c stress --vm 2 --vm-bytes 20G | ||
$ swapon | $ swapon | ||