From 8a9763f69a3efea099cfe210e5092c2bf36258bb Mon Sep 17 00:00:00 2001 From: Benoit Donneaux <benoit@leastauthority.com> Date: Mon, 4 Dec 2023 16:08:40 +0100 Subject: [PATCH] Enable minimal swapping for all systems Signed-off-by: Benoit Donneaux <benoit@leastauthority.com> --- morph/grid/hro-cloud/storage001-hardware.nix | 1 + morph/grid/hro-cloud/storage002-hardware.nix | 2 +- morph/grid/hro-cloud/storage003-hardware.nix | 1 + morph/grid/testing/testing001-hardware.nix | 1 + morph/lib/hardware-vagrant.nix | 2 +- morph/lib/issuer-monitoring-ovh.nix | 4 ++-- morph/lib/issuer-payments-ovh.nix | 2 ++ 7 files changed, 9 insertions(+), 4 deletions(-) diff --git a/morph/grid/hro-cloud/storage001-hardware.nix b/morph/grid/hro-cloud/storage001-hardware.nix index 37d04225..b2ebd742 100644 --- a/morph/grid/hro-cloud/storage001-hardware.nix +++ b/morph/grid/hro-cloud/storage001-hardware.nix @@ -12,6 +12,7 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; fileSystems."/" = { device = "/dev/disk/by-uuid/d0837e6f-72cb-4ffa-85ba-fd57bbbd9a97"; diff --git a/morph/grid/hro-cloud/storage002-hardware.nix b/morph/grid/hro-cloud/storage002-hardware.nix index c011e02f..15cdbba3 100644 --- a/morph/grid/hro-cloud/storage002-hardware.nix +++ b/morph/grid/hro-cloud/storage002-hardware.nix @@ -12,7 +12,7 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - boot.kernel.sysctl = { "vm.swappiness" = 0; }; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; fileSystems."/" = { device = "/dev/disk/by-uuid/c8d29070-c5d3-4cfb-9bb2-c14d3727c45b"; diff --git a/morph/grid/hro-cloud/storage003-hardware.nix b/morph/grid/hro-cloud/storage003-hardware.nix index 3e4d5d8b..1a4bc3f7 100644 --- a/morph/grid/hro-cloud/storage003-hardware.nix +++ b/morph/grid/hro-cloud/storage003-hardware.nix @@ -12,6 +12,7 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; fileSystems."/" = { device = "/dev/disk/by-uuid/8f88c0f1-3aef-41ec-bfd7-55b4ba6c1341"; diff --git a/morph/grid/testing/testing001-hardware.nix b/morph/grid/testing/testing001-hardware.nix index 5dceb16a..3e6b85aa 100644 --- a/morph/grid/testing/testing001-hardware.nix +++ b/morph/grid/testing/testing001-hardware.nix @@ -1,4 +1,5 @@ { + boot.kernel.sysctl = { "vm.swappiness" = 1; }; boot.supportedFilesystems = [ "zfs" ]; networking.hostId = "10000000"; diff --git a/morph/lib/hardware-vagrant.nix b/morph/lib/hardware-vagrant.nix index c13cef85..10c198a1 100644 --- a/morph/lib/hardware-vagrant.nix +++ b/morph/lib/hardware-vagrant.nix @@ -20,7 +20,7 @@ boot.loader.grub.device = "/dev/vda"; boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "virtio_blk" "sd_mod" "sr_mod" ]; - boot.kernel.sysctl = { "vm.swappiness" = 0; }; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; boot.kernelParams = [ "console=tty0" "console=ttyS0,115200" ]; # remove the fsck that runs at startup. It will always fail to run, stopping diff --git a/morph/lib/issuer-monitoring-ovh.nix b/morph/lib/issuer-monitoring-ovh.nix index 51a51afd..45e6c80f 100644 --- a/morph/lib/issuer-monitoring-ovh.nix +++ b/morph/lib/issuer-monitoring-ovh.nix @@ -4,9 +4,9 @@ boot.loader.grub.device = "/dev/sda"; boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" ]; boot.initrd.kernelModules = [ "nvme" ]; - fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; }; - + boot.kernel.sysctl = { "vm.swappiness" = 1; }; + fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; }; swapDevices = [ { device = "/var/swapfile"; diff --git a/morph/lib/issuer-payments-ovh.nix b/morph/lib/issuer-payments-ovh.nix index 64086450..7b13ac0f 100644 --- a/morph/lib/issuer-payments-ovh.nix +++ b/morph/lib/issuer-payments-ovh.nix @@ -2,6 +2,8 @@ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; boot.loader.grub.device = "/dev/sda"; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; + fileSystems."/" = { device = "/dev/sda3"; fsType = "ext4"; }; swapDevices = [ { -- GitLab