How to expand/add an additional swap memory on Raspberry PI with Raspbian

To improve memory management on your Raspberry PI you may need to add an additional swap space. In this config you will learn how to add additional swap memory to your Raspberry PI with Raspbian.

First, you need to create a swap space eg. 500MB

dd if=/dev/zero of=/swap bs=1M count=512

Format your new swap space:

# mkswap /swap

What has left is to enable your new /swap space:

# swapon /swap

To make your new swap space enabled permanently even after reboot you need to add a following line to your /etc/fstab file:

/swap          none  swap sw       0 0