Skip to content

Instantly share code, notes, and snippets.

@kangarie
Created September 23, 2022 12:13
Show Gist options
  • Save kangarie/5bffe4ac8be98d5a9ec7f487c05198ce to your computer and use it in GitHub Desktop.
Save kangarie/5bffe4ac8be98d5a9ec7f487c05198ce to your computer and use it in GitHub Desktop.
Bash script to create swap file
dd if=/dev/zero of=/swapfile bs=2048 count=524288
chmod 0600 /swapfile
chown root:root /swapfile
mkswap /swapfile
swapon /swapfile
echo "/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