Swap: Difference between revisions

Malix (talk | contribs)
Undo revision 30906 by Malix (talk) ; confused zswap and zram swap
Tag: Undo
 
(3 intermediate revisions by 2 users not shown)
Line 23: Line 23:
swapDevices = [{
swapDevices = [{
   device = "/var/lib/swapfile";
   device = "/var/lib/swapfile";
   size = 16*1024; # 16 GB
   size = 16*1024; # 16 GiB
}];
}];
</nowiki>
</nowiki>
}}
}}


This will create a 16GB swapfile at <code>/var/lib/swapfile</code>. The <code>size</code> value [https://search.nixos.org/options?show=swapDevices.*.size is specified in megabytes]. This will cause a swap file to be generated and an entry to be set up in <code>/etc/fstab</code>.
This will create a 16GB swapfile at <code>/var/lib/swapfile</code>. The <code>size</code> value [https://search.nixos.org/options?show=swapDevices.*.size is specified in mebibytes]. This will cause a swap file to be generated and an entry to be set up in <code>/etc/fstab</code>.


== Swap partition ==
== Swap partition ==
Line 218: Line 218:
You can see your current swappiness level by <code>cat /proc/sys/vm/swappiness</code>. The lowest accepted value is 0 while the maximum value is 200. The lowest sane value is 1 (0 causes the system to not scan for unused anonymous pages, i.e. memory freed by processes, at all).
You can see your current swappiness level by <code>cat /proc/sys/vm/swappiness</code>. The lowest accepted value is 0 while the maximum value is 200. The lowest sane value is 1 (0 causes the system to not scan for unused anonymous pages, i.e. memory freed by processes, at all).


For more on tuning the swap, start with [https://wiki.archlinux.org/title/Swap#swappiness ArchWiki]'s description.
For more on tuning the swap, start with [https://wiki.archlinux.org/title/Swap#Swappiness ArchWiki]'s description.


== ZFS and swap ==
== ZFS and swap ==