Skip to content

Instantly share code, notes, and snippets.

@christroutner
Created February 1, 2019 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christroutner/bd76785627925746b7105f13d5f735fc to your computer and use it in GitHub Desktop.
Save christroutner/bd76785627925746b7105f13d5f735fc to your computer and use it in GitHub Desktop.
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.

https://raspberrypi.stackexchange.com/questions/70/how-to-set-up-swap-space 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