查看emmc健康度的两种方式


eMMC 存储在 linux 上被挂载为块设备,一般通过 /dev/mmcblk* 访问。

1. mmc-utils 工具

$ mmc extcsd read /dev/mmcblk2
=============================================
  Extended CSD rev 1.8 (MMC 5.1)
=============================================

...
$ mmc extcsd read /dev/mmcblk2 | grep -iE 'life|eof'
eMMC Life Time Estimation A [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]: 0x01
eMMC Life Time Estimation B [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]: 0x01
eMMC Pre EOL information [EXT_CSD_PRE_EOL_INFO]: 0x01


2. /sys/class/block 源文件

Android 上可能没有 mmc 工具,可以通过 /sys/class 查询设备的各种信息。

# 需要 root 权限
$ cat /sys/class/block/mmcblk2/device/pre_eol_info
0x01
$ cat /sys/class/block/mmcblk2/device/life_time
0x01 0x01


关键字段\_健康度
---------

1. DEVICE\_LIFE\_TIME\_EST\_TYP

越小越好,分为 A/B 字段,代表 SLC/MLC 寿命。

| Value | Description |
| --- | --- |
| 0x00 | Not defined |
| 0x01 | 0%~10% device life time used |
| 0x02 | 10%~20% device life time used |
| 0x03 | 20%~30% device life time used |
| 0x04 | 30%~40% device life time used |
| 0x05 | 40%~50% device life time used |
| 0x06 | 50%~60% device life time used |
| 0x07 | 60%~70% device life time used |
| 0x08 | 70%~80% device life time used |
| 0x09 | 80%~90% device life time used |
| 0x0A | 90%~100% device life time used |
| 0x0B | Exceeded its maximum estimated device life time |
| Others | Reserved |

2. PRE\_EOL\_INFO

| Value | Pre-EOL Info | Description |
| --- | --- | --- |
| 0x00 | Not defined | |
| 0x01 | Normal | Normal |
| 0x02 | Warning | Consumed 80% of reserved block |
| 0x03 | Urgent | |
| 0x04~0xFF | Reserved | |


#tech #linux
 
 
Back to Top