meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
raspberry [2016/03/30 08:09] – [Run fstrim weekly] niziakhome_automation:raspberry:card_wear [2016/11/15 06:43] – raspberry renamed to home_automation:raspberry:card_wear niziak
Line 1: Line 1:
-==== Reduce SD Card wearing ==== +====== Reduce SD Card wearing ====== 
-[[https://www.debian-administration.org/article/661/A_transient_/var/log|Transient log]] +[[https://www.debian-administration.org/article/661/A_transient_/var/log|Transient log]] \\ 
-[[https://wiki.gentoo.org/wiki/SDCard|Finding SD card erase size]]+[[https://wiki.gentoo.org/wiki/SDCard|Finding SD card erase size]] \\
  
 +===== Check who is writing =====
 +Start logging disc access and kernel log:
 +<code bash>
 +sysctl vm.block_dump=1
 +dmesg -e -T -w 
 +</code>
  
-<code>apt-get remove anacron</code> +Stop logging
- +<code bash
-Remove syslog +sysctl vm.block_dump=0
-<code>dpkg --purge rsyslog</code> +
- +
-Use syslog from busybox package with circular log buffer in RAM+
-<code> +
-apt-get install busybox-syslogd+
 </code> </code>
  
-Use journald and configure it to use RAM + 
-<file | /etc/systemd/journald.conf+===== Set noop elevator ===== 
-Storage=volatile +<file | /etc/rc.local
-Compress=yes+... 
 +echo noop > /sys/block/mmcblk0/queue/scheduler 
 +exit 0
 </file> </file>
  
 +===== Use tmpfs =====
 <file | /etc/fstab> <file | /etc/fstab>
-tmpfs           /tmp            tmpfs   defaults,nosuid,nodev,mode=1777,size=10%        0       0+tmpfs   /tmp                     tmpfs   defaults,nosuid,nodev,mode=1777,size=10%        0       0 
 +tmpfs   /var/tmp                 tmpfs   defaults,nosuid,nodev,mode=1777,size=10%        0       0 
 +tmpfs   /var/cache/apt/archives  tmpfs   defaults,nosuid,nodev,mode=1777,size=80%        0       0
 </file> </file>
  
-Move some volatile dirs to tmp folder+Move some volatile dirs to tmp folder:
 <code bash> <code bash>
 rm -rf /var/run /var/lock rm -rf /var/run /var/lock
Line 37: Line 43:
 </code> </code>
  
-==== Run fstrim weekly ====+ 
 +===== Disable logging to disc ===== 
 + 
 +<code bash> 
 +systemctl stop mosquitto 
 +systemctl disable mosquitto 
 +</code> 
 + 
 +<code>apt-get remove anacron</code> 
 + 
 +Remove syslog 
 +<code>dpkg --purge rsyslog</code> 
 + 
 +Use syslog from busybox package with circular log buffer in RAM: 
 +<code> 
 +apt-get install busybox-syslogd 
 +</code> 
 + 
 +Use journald and configure it to use RAM: 
 +<file | /etc/systemd/journald.conf> 
 +Storage=volatile 
 +Compress=yes 
 +</file> 
 + 
 + 
 +===== Run fstrim weekly ====
 +Check TRIM support 
 +<code>sudo hdparm -I /dev/sda | grep "TRIM supported"</code> 
 <file | /etc/systemd/system/fstrim.service> <file | /etc/systemd/system/fstrim.service>
 [Unit] [Unit]
Line 64: Line 98:
 systemctl enable fstrim.timer systemctl enable fstrim.timer
 </code> </code>
-==== Broken SD Card ====+ 
 +===== Broken SD Card =====
 Bad magic number in super-block Bad magic number in super-block