From aced495844ee447ff03d7e422c6d4628271022a7 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 11 Sep 2022 17:00:33 +0000 Subject: deploy: de78630d8ac5a474768de7f6aaa1843b6195e04b --- print.html | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'print.html') diff --git a/print.html b/print.html index 8de9266..5a70cb5 100644 --- a/print.html +++ b/print.html @@ -76,7 +76,7 @@ @@ -3192,6 +3192,7 @@ def sum(a: int, b: int) -> int:
  • coredump
  • ptrace_scope
  • cryptsetup
  • +
  • swap
  • systemd

    systemctl

    @@ -3412,6 +3413,48 @@ sudo umount <mntpoint> # Close (re-encrypt) LUKS device. sudo cryptsetup close loop0 +

    swap

    +

    List active swap areas

    +
    # procfs
    +cat /proc/swaps
    +
    +# cli tool
    +swapon --show
    +
    +

    Manual swapfile setup

    +
    # One time:
    +#   Create and initialize swapfile.
    +#   mkswap will initialize swap area over full filesize by default.
    +sudo dd if=/dev/zero of=/swapfile bs=1G count=1
    +mkswap /swapfile
    +
    +# Enable swap file (until next reboot).
    +swapon /swapfile
    +
    +# Persistent setup of swap file.
    +echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
    +
    +# Disable swap file (until next reboot).
    +swapoff /swapfile
    +
    +
    +

    Recommended file permissions 0600 and file owner uid=0 (root).

    +
    +

    Using dphys-swapfile service.

    +

    Dynamically computes size of swap file based on installed RAM.

    +
    # Setup and enable swap based on /etc/dphys-swapfile.
    +dphys-swapfile setup
    +dphys-swapfile swapon
    +
    +# Disable swap on configured file.
    +dphys-swapfile swapoff
    +
    +
    +

    Usually comes with a script to be automatically run at system startup and shutdown. +For example as systemd service:

    +
    systemctl status dphys-swapfile
    +
    +

    Network