Install log2ram and Save Your SSD (Linux)

How to Install log2ram (and Save Your SSD)

If you’re running Linux on a consumer SSD, you’ve probably heard that constant log writes can wear it out faster than you’d like. Every service on your system writes logs to /var/log all day long, and each of those writes is a small hit to your drive’s lifespan.

log2ram fixes this by moving /var/log into RAM (tmpfs) instead of writing directly to disk. Logs get written to memory throughout the day, then synced back to your disk just once a day. Way fewer writes, way less wear on your SSD — especially worth doing if you’re running off a smaller or lower-endurance consumer drive rather than an enterprise SSD.

This tutorial installs log2ram using git, which pulls the latest version directly from the developer’s repository.

Step 1: Update your system

apt update && apt upgrade -y

This makes sure your system is current before you install anything new.

Step 2: Install prerequisites

apt install -y git rsync

git lets you download the log2ram project, and rsync is what log2ram uses behind the scenes to sync your RAM logs back to disk. Note that rsync often comes preinstalled on many systems (including Proxmox), so this step may just confirm you already have it.

Step 3: Clone the log2ram repository

git clone https://github.com/azlux/log2ram.git
cd log2ram

This downloads the official log2ram project into a new log2ram folder and moves you into it.

Step 4: Run the installer

chmod +x install.sh
./install.sh

This installs the systemd service, sets up the config file, and configures /var/log to mount as a RAM-based filesystem.

Step 5: Reboot

reboot

log2ram needs a reboot to actually take over /var/log as a RAM mount.

Step 6: Verify it’s working

After your system comes back up, run:

df -h | grep log2ram

You should see something like:

log2ram    128M   25M  104M  20%  /var/log

That confirms /var/log is now living in RAM instead of writing straight to your SSD.

Step 7 (optional): Clean up

Once it’s installed and verified, you can safely delete the folder you cloned:

cd ..
rm -R log2ram

The installer already copied everything log2ram needs into the system — the cloned folder was just there to run the install script once.

A few extra tips

  • Force an early sync: run log2ram write anytime you want logs written to disk right away, instead of waiting for the daily sync.
  • Check the sync schedule: run systemctl list-timers | grep log2ram to see exactly when the next sync to disk will happen.
  • Adjust the RAM size: if your logs are heavier than 128M a day, edit /etc/log2ram.conf and increase the SIZE= value, then run systemctl restart log2ram.
  • Know the tradeoff: if your system loses power before the daily sync, you’ll lose whatever logs were sitting in RAM. For most home labs and personal servers this is a fair tradeoff for the extra SSD lifespan you get in return.

That’s it, your system is now writing logs to RAM instead of hammering your SSD every time something logs an event.