Add the "./createSwapStorage.sh" script.
This commit is contained in:
parent
7b7dd59b57
commit
fcd80a8f3f
|
@ -0,0 +1,25 @@
|
|||
# This script adds swap in the System.
|
||||
|
||||
# Info found in: https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04
|
||||
|
||||
|
||||
# Creating a Swap File with 2 Gb
|
||||
sudo fallocate -l 2G /swapfile
|
||||
ls -lh /swapfile
|
||||
|
||||
# Enabling the Swap File
|
||||
sudo chmod 600 /swapfile
|
||||
ls -lh /swapfile
|
||||
sudo mkswap /swapfile
|
||||
sudo swapon /swapfile
|
||||
sudo swapon --show
|
||||
free -h
|
||||
|
||||
# Making the Swap File Permanent
|
||||
sudo cp /etc/fstab /etc/fstab.bak
|
||||
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
|
||||
|
||||
# Adjusting the Swappiness Property
|
||||
cat /proc/sys/vm/swappiness
|
||||
sudo sysctl vm.swappiness=10 # Setting it closer to 0, makes the swaps more rare. (10 %)
|
||||
echo "vm.swappiness=10" | sudo tee -a /etc/sysctl.conf # Append it to that file in order for the custom "swappiness" to be available on restart.
|
Loading…
Reference in New Issue