Swap: Difference between revisions
Add swappiness, zswap, and updated opening statement |
document zram writeback functionality |
||
Line 47: | Line 47: | ||
See [https://search.nixos.org/options?query=zramSwap zramSwap] for a full list of available options and their descriptions. | See [https://search.nixos.org/options?query=zramSwap zramSwap] for a full list of available options and their descriptions. | ||
=== Zram writeback === | |||
Zram supports writeback functionality, allowing idle or incompressible pages to be moved to a backing storage device rather than keeping it in memory. Currently, writeback can only use block storage devices (such as partitions) and does not support swap files. The backing partition must be manually created first, but does not require formatting. | |||
An example configuration: | |||
{{file|/etc/nixos/configuration.nix|nix| | |||
<nowiki> | |||
zramSwap = { | |||
enable = true; | |||
writebackDevice = "/dev/sda1" | |||
</nowiki> | |||
}} | |||
To verify the block storage device is being used: | |||
<syntaxhighlight lang="bash"> | |||
cat /sys/block/zram0/backing_dev | |||
</syntaxhighlight> | |||
== Zswap swap cache == | == Zswap swap cache == |