-
listing enabled swaps
sudo swapon -s
-
check available space
df
-
create swap file (the following will create 1GB swap, modify count if needed)
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k
-
prepare the swap file by creating a linux swap area
sudo mkswap /swapfile
-
activate the swap file
sudo swapon /swapfile
-
ensure that the swap is permanent by adding it to the fstab file
sudo nano /etc/fstab
paste:
/swapfile none swap sw 0 0
-
set swappiness in the file to 10 so swap act as an emergency buffer
echo 10 | sudo tee /proc/sys/vm/swappiness echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
-
prevent the file from being world-readable
sudo chown root:root /swapfile sudo chmod 0600 /swapfile
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Rabu, 02 Juli 2014
Creating swapfile
source: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar