51 lines
1.6 KiB
Markdown
51 lines
1.6 KiB
Markdown
---
|
|
title: "Reduce the writing rate on SD Card"
|
|
date: 2015-04-22
|
|
url: reduce-the-writing-rate-on-sd-card
|
|
layout: post
|
|
category: Hacking
|
|
---
|
|
|
|
[![A missing blog post image](/img/blog/reduce-the-writing-rate-on-sd-card.jpg)](/img/blog/reduce-the-writing-rate-on-sd-card.jpg)
|
|
|
|
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](http://www.wikiwand.com/en/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](http://www.tremende.com/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`
|
|
|
|
**:warning: If your system is shutting down, for example, due to a supply outage, you won't have any system log of your session saved :warning:**
|