Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Adding Swap Memory to Raspberry Pi

These are notes on how to bump up the swap memory on a Raspberry Pi B+ v3 to 2GB. That means it will have 1GB of RAM and 2GB of swap memory on the SD card. Best to use a class 10 SD card for this. Raspbian uses dphys-swapfile, which is a swap-file based solution instead of the "standard" swap-partition based solution. It is much easier to change the size of the swap.

The configuration file is:

/etc/dphys-swapfile The content is very simple. By default my Raspbian has 100MB of swap:

CONF_SWAPSIZE=2000 If you want to change the size, you need to modify the number and restart dphys-swapfile:

sudo /etc/init.d/dphys-swapfile restart Edit: On Raspbian the default location is /var/swap, which is (of course) located on the SD card. I think it is a bad idea, so I would like to point out, that the /etc/dphys-swapfile can have the following option too: CONF_SWAPFILE=/media/btsync/swapfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment