Keeping a Raspberry Pi alive

Overview

http://raspberrypi.org is a great, cheap peice of hardware, but it has some limitations. Number one is the SD card. SD cards are not made for lots of rewrites to the same file.

Edit 20140109: If you wonder why SD cards suck, see http://www.youtube.com/watch?v=r3GDPwIuRKI.

Tricks to prolong the life of the SD-card:

  • Edit /etc/default/tmpfs and set: RAMTMP=yes. This will keep /tmp in memory.
  • Install fs2ram, version 0.3.12 or better. Earlier versions are broken in Debian. http://packages.debian.org/unstable/main/fs2ram. In its config it’s important to activate /var/log and /var/tmp. If you’re using any databases or other files that are written to often, make sure they’re on a tmpfs using fs2ram. If you keep /var/cache in memory, make sure to clear out apts cache often, as it can fill up: sudo apt-get clean
  • Disable swap: sudo dphys-swapfile swap off, and uninstall it: sudo apt-get remove --purge dphys-swapfile