Raspberry Pi – MicroSD Card Life Saving Trick

If you have spent enough time with Raspberry Pi then you may know that Micro SD Card gets corrupted too early which is related to number of writes your operating system made on to the MicroSD Card. Number of applications are writing to log file frequently and hence participate in major share in depleting write capacity. Log2Ram offers storing log data to RAM by mounting /var/log  into RAM which is stored in MicroSD card before safely shutting down the system. Follow the instructions below to install Log2Ram in to Raspberry Pi;

  • Fetch the installation from GitHub repository

curl -Lo log2ram.tar.gz https://github.com/azlux/log2ram/archive/master.tar.gz
tar xf log2ram.tar.gz
cd log2ram-master

  • Giving execution rights to script

chmod +x install.sh

  • Run the install script

sudo ./install.sh

  • Remove the installation files

cd ..
rm -r log2ram-master

  • Reboot the Pi

sudo reboot

Disk Write Setting:

By default Log2Ram writes to the HardDisk every hour. If you think this is too much, you can make the write every day by moving the cron file to daily.

sudo mv /etc/cron.hourly/log2ram /etc/cron.daily/log2ram
sudo reboot

Install Successful:

After reboot, you can check if mount is successful or not

df -h

log2ram

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x