Last active
August 29, 2015 14:05
-
-
Save charlespeach/58ec85ed1761cfd40b11 to your computer and use it in GitHub Desktop.
Linux Cheat Sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add Swap | |
First check to see if you have swap enabled first `sudo swapon -s`, if not then: | |
``` | |
sudo dd if=/dev/zero of=/swapfile bs=1024 count=256k | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo "/swapfile none swap sw 0 0 " | sudo tee --append /etc/fstab | |
echo 10 | sudo tee /proc/sys/vm/swappiness | |
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf | |
sudo chown root:root /swapfile | |
sudo chmod 0600 /swapfile | |
``` | |
Change the count to your desired level of swap. Ie: | |
512gb swapfile - change the count to: `count=512k` | |
1gb swapfile - change the count to: `count=1M` or `count=1024k` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment