Log2RAM – SD Card Savior

While setting up our Raspberry Pis, one of the things that we usually setup is Log2Ram. The entire goal of this project is to extend the SD storage life.

By default Raspberry Pi stores logs on the SD card, however SD cards have limited write cycles due to being FLASH based storage. Once this limit has been reached, it will fail. Log2Ram forces logs to be stored in memory (RAM) by changing /var/log to a RAM disk and once every day to reduce writing and increase lifespan of the SD card.

Highly recommend for any environment running off of an SD card, along with configuration and sending logs to a central logging system such as syslog. We won’t be covering the central logging, but recommended for production environments.

Installation is pretty straight forward.

git clone https://github.com/azlux/log2ram.git
cd log2ram
chmod +x install.sh
sudo ./install.sh

Usually I edit /etc/log2ram.conf to set size to 128 MB instead of default 40MB by using sudo nano /etc/log2ram.conf

SIZE=128MB

Then a restart would be need to be done to make this become in effect by sudo reboot

With future updates, I suggest following the advice that is in the README file. Usually, we would need to manually stop the service prior to running the update.

How useful was this post?

Click on a star to rate it!

No votes so far! Be the first to rate this post.

Nate15329's Blog