Ubuntu Memory swap

We can see if the system has any configured swap by typing:

You can verify that there is no active swap using the free utility:

Check Available Space on the Hard Drive Partition:

Create a Swap File, an amount equal to or double the amount of RAM on your system is a good starting point.

We can verify that the correct amount of space was reserved by typing:

Enabling the Swap File, Make the file only accessible to root:

Make the Swap File Permanent, enable swap at every reboot:

Adjusting the Swappiness Property:

At the bottom of the /etc/sysctl.conf file , you can add:

Adjusting the Cache Pressure Setting:

At the bottom, add the line that specifies your new value:

Reference

how-to-add-swap-space-on-ubuntu-16-04

Leave a Reply