RaspberryPI life extender: tmpfs

To increase performance and SD life of your raspberry PI 2/3, you can follow my first article on this subject.

You can easily increase even more the SD life if you can trade a bit of RAM.

The key idea is to take advantage of tmpfs, which can be resized on the fly too.

Masterplan

  1. Mount /tmp and /var/log on tmpfs. I gave vert little to /var/log (about 5MB) whereas /tmp must have at least 200MB if you plan to compile some stuff (it is used by the compiler toolchain, so you can frick a bit of pain if you have it too small).
    To enable /tmp, you must hack the tmpfs under /etc/default/, tuning the two lines…

    RAMTMP=yes
    TMP_SIZE=22%VM
  2. Consider defining a /workarea of about 1Mb of space for temp workarea (like compilations and so on).
    You can resize it on the fly to match your requirements. Even bigger stuff like postgresql need about 200MB of disk space for compiling (binary&source included!).

Example of fstab:

# Resize on demand:
tmpfs   /home/pi/workarea       tmpfs   defaults,nosuid,auto,uid=1000,size=1m   0       0
# Reduce logging stress:
tmpfs    /var/log    tmpfs    defaults,noatime,nosuid,mode=0755,size=5m    0 0
# extra: usb stick mounted under /mnt and assigned to pi (1000) user
/dev/sda1       /mnt            vfat    auto,defaults,uid=1000  0       0

 

Leave a Reply