blog/_posts/2015-04-22-reduce-the-writi...

1.6 KiB

title date url layout category
Reduce the writing rate on SD Card 2015-04-22 reduce-the-writing-rate-on-sd-card post Hacking

A missing blog post image

Firstly, I'd rather tell you that you should have only the boot system on the SD Card, and all the rest on an extern device in order to preserve your card.

But, when it's not possible, or not handy, you really should reduce the numbers of readings and writings on your device.

First of all, sometimes the Swap is enabled. We'll disable it :

# dphys-swapfile swapoff && dphys-swapfile uninstall

From now, the file :

/var/swap

... may no longer exists.


Now, we'll remove the permanent logs system writing, with Ramlog.

Let's install it in one line :

# apt-get install rsync lsof && wget http://www.tremende.com/ramlog/download/ramlog_2.0.0_all.deb && dpkg -i ramlog_2.0.0_all.deb

We'll add the launching and stopping of the script at the beginning and ending of your session. Edit :

/etc/init.d/rsyslog

... and add the content needed as the following :

# Required-Start: $remote_fs $time ramlog
# Required-Stop: umountnfs $time ramlog

Set the script at the boot and reboot the system now :

# insserv && reboot

Check if the program is running with :

# /etc/init.d/ramlog status

⚠️ If your system is shutting down, for example, due to a supply outage, you won't have any system log of your session saved ⚠️