Swap file automatic loading in Linux

Solution 1:

As root in the command line:

echo "/dev/sda5 swap swap defaults 0 0" >> /etc/fstab

To have the change above take effect, run this command (still as root):

swapon -a

Alternatively: You can also open the file /etc/fstab in your favorite text editor (also as root) and add the following line to a new line at the bottom of that file:

/dev/sda5 swap swap defaults 0 0

Explanation

See this documentation on fstab.