Swap: Difference between revisions

From NixOS Wiki
imported>Yuu
m Isa moved page Disable Swap on NixOS to Swap: few content, so better to unify in a Swap article
imported>Yuu
No edit summary
Line 1: Line 1:
== Disable swap ==
Swap on NixOS is set with the option: <code>swapDevices</code>. This will be in hardware-configuration-nix.
Swap on NixOS is set with the option: <code>swapDevices</code>. This will be in hardware-configuration-nix.
To remove all swap devices from NixOS  you must therefore set
To remove all swap devices from NixOS  you must therefore set

Revision as of 17:09, 8 July 2021

Disable swap

Swap on NixOS is set with the option: swapDevices. This will be in hardware-configuration-nix. To remove all swap devices from NixOS you must therefore set

swapDevices = lib.mkForce [ ];

This will remove the swap partition/file from being included in /etc/fstab

If you are using GPT partitioning tables systemd-gpt-auto-generator(8) will still mount your swap partition automatically.

You must therefore turn on attribute 63 on your partition in the partition table.

This can be done with gptfdisk or similar:

gdisk /dev/sda
x
a
<partition number>
63
<enter>
w