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

From Compulab Mediawiki
Jump to: navigation, search
imported>Igor.vaisbein
imported>Uri.mashiach
Line 23: Line 23:
 
To mount logging as tmpfs add the following entry into the system '''/etc/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 '''/etc/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>
  

Revision as of 15:34, 7 October 2020

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

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:

vm.swappiness=10

Disabling swap usage should be done with following command:

vm.swappiness=0

Use SquashFS

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