Skip to content

Improve SD Card’s lifespan

☣┌͜∩͜┐͜(͜◣͜_͜◢͜)͜┌͜∩͜┐☣ edited this page Feb 22, 2024 · 7 revisions

Install Log2Ram

One of the most significant advantages of offloading your RAM is that it improves your SD Card’s potential lifespan. Log files are one of the things written to most by the various pieces of software you install. By pushing the files to your RAM, you can control how often they are written to the SD Card. You will still be able to access these files on the RAM as if they sat on your SD Card.

Add repo source(auto update)(recommended)

echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ bookworm main" | sudo tee /etc/apt/sources.list.d/azlux.list
sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg  https://azlux.fr/repo.gpg
sudo apt update
sudo apt install log2ram

or

Manually

curl -L https://github.com/azlux/log2ram/archive/master.tar.gz | tar zxf -
cd log2ram-master
chmod +x install.sh && sudo ./install.sh
cd ..
rm -r log2ram-master

Check status

systemctl status log2ram

p

Warning

If outputs error ERROR: RAM disk for "/var/hdd.log/" too small. Can't sync on Raspberry Pi OS.
To fix, open:

sudo nano /etc/log2ram.conf 

and change SIZE=40M to 80 or higher