How to Install dphys-swapfile in Ubuntu 18.04

Install dphys-swapfile by entering the following commands in the terminal:

sudo apt update
sudo apt install dphys-swapfile


Autogenerate and use a swap file

This init.d script exists so one does not need to have a fixed size swap partition. Instead install without swap partition and then run this, with file size (re-)computed automatically to fit the current RAM size. . By default (and hence on installation) it creates swapfile twice as big as the present RAM amount with an upper limit of 2 GB. . It's also very helpful when included in SD card, USB stick or disk images which are distributed and run on many machines with different amount of RAM, e.g. different models of the Raspberry Pi or cloud images.


Version: 20100506-3

Section: universe/admin