Skip to content

Instantly share code, notes, and snippets.

@samloh84
Created December 10, 2015 07:20
Show Gist options
  • Save samloh84/18d619be323aff11d24c to your computer and use it in GitHub Desktop.
Save samloh84/18d619be323aff11d24c to your computer and use it in GitHub Desktop.
Add Swap File Bash Script
#!/bin/bash
sudo dd if=/dev/zero of=/swapfile bs=1024 count=8G \
&& mkswap /swapfile \
&& swapon /swapfile \
&& chown root:root /swapfile \
&& chmod 0600 /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