Difference between revisions of "Application Notes: eMMC lifetime optimization"

From Compulab Mediawiki
Jump to: navigation, search
imported>Igor.vaisbein
 
imported>Uri.mashiach
(Do not use swap space)
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:
 
===Use tmpfs===
 
===Use tmpfs===
 
Use tmpfs to store temporary files. Tmpfs is a temporary file storage facility on Unix-like systems stored in RAM. It helps to reduce unnecessary writes to the eMMC.</br>
 
Use tmpfs to store temporary files. Tmpfs is a temporary file storage facility on Unix-like systems stored in RAM. It helps to reduce unnecessary writes to the eMMC.</br>
To mount temporary directories as tmpfs add the following entries into the system '''/etf/fstab''':
+
To mount temporary directories as tmpfs add the following entries into the system '''/etc/fstab''':
 
<pre>
 
<pre>
 
tmpfs  /tmp      tmpfs  defaults,noatime,mode=1777  0 0
 
tmpfs  /tmp      tmpfs  defaults,noatime,mode=1777  0 0
Line 14: Line 14:
 
</pre>
 
</pre>
  
===Turn off logging===
+
===Turn off logging - Legacy Systems===
 
Turn off or reduce logging. Writing or removing big amounts of data on a regular basis significantly decreases eMMC lifetime.<br>
 
Turn off or reduce logging. Writing or removing big amounts of data on a regular basis significantly decreases eMMC lifetime.<br>
 
Turning off the syslog on boot should be done with following command:
 
Turning off the syslog on boot should be done with following command:
Line 21: Line 21:
 
</pre>
 
</pre>
  
To mount logging as tmpfs add the following entry into the system '''/etf/fstab''':
+
To mount logging as tmpfs add the following entry into the system '''/etc/fstab''':
 
<pre>
 
<pre>
tmpfs   100M  596K  100M  1% /var/log
+
tmpfs     /var/log           tmpfs      defaults,size=128M    0  0
 
</pre>
 
</pre>
  
Turn off logging of read access times. To do this add the following entry into the system '''/etf/fstab''':
+
Turn off logging of read access times, by adding the '''noatime''' option to the rootfs line, in the '''/etc/fstab'''<br>
 +
For example:
 
<pre>
 
<pre>
/dev/sdxxxxxx / ext4 discard,noatime,errors=remount-ro 0 1
+
/dev/root  /                   auto      defaults,noatime     1  1
 
</pre>
 
</pre>
  
Line 37: Line 38:
 
Decreasing swap usage should be done with following command:
 
Decreasing swap usage should be done with following command:
 
<pre>
 
<pre>
vm.swappiness=10
+
sysctl vm.swappiness=10
 
</pre>
 
</pre>
  
 
Disabling swap usage should be done with following command:
 
Disabling swap usage should be done with following command:
 +
<pre>
 +
sysctl vm.swappiness=0
 +
</pre>
 +
 +
For permanent update, add the following line to the file {{filename|/etc/sysctl.conf}}:
 
<pre>
 
<pre>
 
vm.swappiness=0
 
vm.swappiness=0

Latest revision as of 08:34, 26 January 2021

Introduction

Flash memory devices have limited endurance that is measured in program-erase (P/E) cycles. P/E cycle is a sequence of events in which data is written to solid-state flash memory cell, then erased, and then rewritten. Typical eMMC endurance is 3000 P/E cycles. Problems with storage can negatively affect performance and reliability of the device. It is highly important to take into consideration eMMC endurance during embedded system development. Standard operating systems and file-systems typically are not configured for eMMC lifetime optimization. It is recommended to employ the techniques outlined below in order to configure the system for optimized eMMC usage.

Recommendations for eMMC lifetime optimization

Use tmpfs

Use tmpfs to store temporary files. Tmpfs is a temporary file storage facility on Unix-like systems stored in RAM. It helps to reduce unnecessary writes to the eMMC.
To mount temporary directories as tmpfs add the following entries into the system /etc/fstab:

tmpfs   /tmp       tmpfs   defaults,noatime,mode=1777   0 0
tmpfs   /var/tmp   tmpfs   defaults,noatime,mode=1777   0 0

Turn off logging - Legacy Systems

Turn off or reduce logging. Writing or removing big amounts of data on a regular basis significantly decreases eMMC lifetime.
Turning off the syslog on boot should be done with following command:

systemctl disable syslog

To mount logging as tmpfs add the following entry into the system /etc/fstab:

tmpfs      /var/log            tmpfs      defaults,size=128M     0  0 

Turn off logging of read access times, by adding the noatime option to the rootfs line, in the /etc/fstab
For example:

/dev/root  /                   auto       defaults,noatime      1  1

Do not use swap space

Do not use swap space. Swapping uses internal storage intensively and should be minimized or disabled to increase eMMC lifetime.

Decreasing swap usage should be done with following command:

sysctl vm.swappiness=10

Disabling swap usage should be done with following command:

sysctl vm.swappiness=0

For permanent update, add the following line to the file /etc/sysctl.conf:

vm.swappiness=0

Use SquashFS

SquashFS is a compressed file-system that is intended for read-only usage.