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
raspberry [2016/04/19 21:13] niziakhome_automation:raspberry:card_wear [2018/09/10 14:36] (current) niziak
Line 1: Line 1:
 ====== Reduce SD Card wearing ====== ====== Reduce SD Card wearing ======
-===== noop elevator =====+[[https://www.debian-administration.org/article/661/A_transient_/var/log|Transient log]] \\ 
 +[[https://wiki.gentoo.org/wiki/SDCard|Finding SD card erase size]] \\
  
-===== Headline ===== +===== Check who is writing ===== 
-[[https://www.debian-administration.org/article/661/A_transient_/var/log|Transient log]] +Start logging disc access and kernel log: 
-[[https://wiki.gentoo.org/wiki/SDCard|Finding SD card erase size]] +<code bash> 
- +sysctl vm.block_dump=1 
- +dmesg -e -T -w  
-<code>apt-get remove anacron</code>+</code>
  
-Remove syslog +Stop logging
-<code>dpkg --purge rsyslog</code> +<code bash
- +sysctl vm.block_dump=0
-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 40: 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> 
 + 
 +<file /etc/default/busybox-syslogd> 
 +SYSLOG_OPTS="-C256 -L -R remote.host.org" 
 +KLOG_OPTS="" 
 +</file> 
 + 
 +Use journald and configure it to use RAM: 
 +<file | /etc/systemd/journald.conf> 
 +Storage=volatile 
 +Compress=yes 
 +</file> 
 + 
 + 
 +===== Run fstrim weekly =====
 Check TRIM support Check TRIM support
-<codE>sudo hdparm -I /dev/sda | grep "TRIM supported"</code>+<code>sudo hdparm -I /dev/sda | grep "TRIM supported"</code>
  
 <file | /etc/systemd/system/fstrim.service> <file | /etc/systemd/system/fstrim.service>
Line 71: Line 104:
 </code> </code>
  
-==== Broken SD Card ====+===== Broken SD Card =====
 Bad magic number in super-block Bad magic number in super-block