From aced495844ee447ff03d7e422c6d4628271022a7 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 11 Sep 2022 17:00:33 +0000 Subject: deploy: de78630d8ac5a474768de7f6aaa1843b6195e04b --- linux/coredump.html | 2 +- linux/cryptsetup.html | 6 +- linux/index.html | 3 +- linux/ptrace_scope.html | 2 +- linux/swap.html | 221 ++++++++++++++++++++++++++++++++++++++++++++++++ linux/systemd.html | 2 +- 6 files changed, 229 insertions(+), 7 deletions(-) create mode 100644 linux/swap.html (limited to 'linux') diff --git a/linux/coredump.html b/linux/coredump.html index 957d1f1..f864058 100644 --- a/linux/coredump.html +++ b/linux/coredump.html @@ -75,7 +75,7 @@ diff --git a/linux/cryptsetup.html b/linux/cryptsetup.html index 0824407..d9c26c9 100644 --- a/linux/cryptsetup.html +++ b/linux/cryptsetup.html @@ -75,7 +75,7 @@ @@ -217,7 +217,7 @@ sudo cryptsetup close loop0 -
@@ -229,7 +229,7 @@ sudo cryptsetup close loop0 - diff --git a/linux/index.html b/linux/index.html index 1afccc2..612f70d 100644 --- a/linux/index.html +++ b/linux/index.html @@ -75,7 +75,7 @@ @@ -143,6 +143,7 @@
  • coredump
  • ptrace_scope
  • cryptsetup
  • +
  • swap
  • diff --git a/linux/ptrace_scope.html b/linux/ptrace_scope.html index 8ed72d6..c7baa57 100644 --- a/linux/ptrace_scope.html +++ b/linux/ptrace_scope.html @@ -75,7 +75,7 @@ diff --git a/linux/swap.html b/linux/swap.html new file mode 100644 index 0000000..85011fa --- /dev/null +++ b/linux/swap.html @@ -0,0 +1,221 @@ + + + + + + swap - Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + + +
    +
    +

    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
    +
    +
    + +
    + + +
    +
    + + + +
    + + + + + + + + + + + + diff --git a/linux/systemd.html b/linux/systemd.html index 1dfaea2..3b9c431 100644 --- a/linux/systemd.html +++ b/linux/systemd.html @@ -75,7 +75,7 @@ -- cgit v1.2.3