BTRFS swap file

This commit is contained in:
Daniel Langbein 2023-08-28 15:50:16 +02:00
parent 073c854660
commit 3952094233
2 changed files with 20 additions and 1 deletions

View File

@ -98,6 +98,19 @@ Use the corresponding branch:
# TODO (!) # TODO (!)
``` ```
## BTRFS Swap file
* https://nixos.wiki/wiki/Btrfs#Swap_file
* https://wiki.archlinux.org/title/btrfs#Swap_file
Summary:
* Create subvolume `@swap` directly below top-level subvolume.
* Mount at `/swap`
* Create swapfile: `sudo btrfs filesystem mkswapfile --size 8g --uuid clear /swap/swapfile`
* Regenerate hardware-configuration: `sudo nixos-generate-config --dir yodaTab`
* Add `swapDevices = [ { device = "/swap/swapfile"; } ];` to hardware configuration and run `nixos-rebuild switch` (see above).
## Automount Encrypted Drive ## Automount Encrypted Drive
* Generate and add keyfile to LUKS device * Generate and add keyfile to LUKS device

View File

@ -35,7 +35,13 @@
boot.initrd.luks.devices."512gb".device = "/dev/disk/by-uuid/03d4ac28-2c81-463e-b615-fb623d40b6fa"; boot.initrd.luks.devices."512gb".device = "/dev/disk/by-uuid/03d4ac28-2c81-463e-b615-fb623d40b6fa";
swapDevices = [ ]; fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/f87e6b3c-12f2-4fda-92b3-06b07bdad58f";
fsType = "btrfs";
options = [ "subvol=@swap" ];
};
swapDevices = [ { device = "/swap/swapfile"; } ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's