Skip to content

Instantly share code, notes, and snippets.

@didyhu
Created May 20, 2019 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save didyhu/a0722d4f3e2bb4dacc7551c2c4bef18c to your computer and use it in GitHub Desktop.
Save didyhu/a0722d4f3e2bb4dacc7551c2c4bef18c to your computer and use it in GitHub Desktop.

Linux Swap

# 1. generate an empty file
$ dd if=/dev/zero of=/var/swapfile bs=1M count=1024
# 2. format it as swap
$ mkswap /var/swapfile 
# 3. turn on it
$ swapon /var/swapfile
# 4. make it works after boot
$ cat "/var/swapfile swap swap defaults 0 0" >> /etc/fstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment