Menu

Swap File

Anonymous Peppermint OS
There is a newer version of this page. You can find it here.

Addendum 15 June 2023: cavypmos video guide: https://www.youtube.com/watch?v=Bf3j0QlrSs8

How to create a swap file, open a terminal and enter (best to copy and paste) the following commands individually.

Do not use this method if you already have a functional machine set up with a swap partition. I do not include a swap partition with my install, favouring a swap file post install during the configuration of my computer.

Be warned if you intend to use the hibernate function, you must have a swap partition to mirror your ram. For example if your machine has 16GB it will require a 16GB swap partition.

sudo swapon --show

There should be no printout, if there is. Stop! Do not proceed any further, you will destroy your system

sudo fallocate -l 4G /swapfile

sudo chmod 600 /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile

sudo nano /etc/fstab

Add the following text to the /etc/fstab file under the last entry, should be /or the /home depending on your schema.

/swapfile swap swap defaults 0 0

sudo swapon --show

NAME      TYPE SIZE USED PRIO
/swapfile file   4G   0B   -2

sudo update-grub

Now the important bit reboot your machine

systemctl reboot

To check if the swap functions correctly

sudo swapon --show

Don't forget to adjust your swappiness to the value of 10 at: https://sourceforge.net/p/peppermintos/pepwiki/Configure%20PeppermintOS/


MongoDB Logo MongoDB