Skip to content

Instantly share code, notes, and snippets.

@autodidacticon
Created September 20, 2014 02:35

Revisions

  1. autodidacticon created this gist Sep 20, 2014.
    7 changes: 7 additions & 0 deletions swapfile.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    sudo install -o root -g root -m 0600 /dev/null /swapfile
    dd if=/dev/zero of=/swapfile bs=1k count=2048k
    mkswap /swapfile
    swapon /swapfile
    echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab
    sudo sysctl -w vm.swappiness=10
    echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf