Skip to content

Instantly share code, notes, and snippets.

@Lzok
Created March 19, 2021 15:38
Show Gist options
  • Save Lzok/a08a51003b4080097c3c4d8ec9fc1841 to your computer and use it in GitHub Desktop.
Save Lzok/a08a51003b4080097c3c4d8ec9fc1841 to your computer and use it in GitHub Desktop.

check your swap

free

turn off swap

sudo swapoff /swapfile

To create the SWAP file, you will need to use this.

sudo fallocate -l 4G /swapfile # same as "sudo dd if=/dev/zero of=/swapfile bs=1G count=4"

Secure swap.

sudo chown root:root /swapfile sudo chmod 0600 /swapfile

Prepare the swap file by creating a Linux swap area.

sudo mkswap /swapfile

Activate the swap file.

sudo swapon /swapfile

Confirm that the swap partition exists.

sudo swapon -s

check your swap again

free

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment