Skip to content

Instantly share code, notes, and snippets.

@robertopc
Last active August 17, 2019 21:50
Show Gist options
  • Save robertopc/0cf094a6ca60773a60da10b6aceeba1f to your computer and use it in GitHub Desktop.
Save robertopc/0cf094a6ca60773a60da10b6aceeba1f to your computer and use it in GitHub Desktop.
Make a swap of 1GB in Linux
#!/bin/sh
sudo su
dd if=/dev/zero of=/swapfile bs=1024 count=1024k
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
# add line in fstab to auto mount swap in startup
echo "/swapfile none swap sw 0 0" >> /etc/fstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment