大网数据广告活动
服务器运维问答

How to measure total writes performed to SSD in Linux?

· 52CE 我爱测

I've searched the internet to find a tool/utility which can tell me the total writes performed to an SSD (or a normal disk). The output should look something like this: SSD Intel 320S :- Total data written until now -- 2Tb Total …

问题原文

原帖链接 · And Or · CC BY-SA 3.0

I've searched the internet to find a tool/utility which can tell me the total writes performed to an SSD (or a normal disk). The output should look something like this:

SSD Intel 320S :- 
Total data written until now -- 2Tb
Total data read until now -- 4Tb
power on Hours -- 1234 Hrs
etc.

But I haven't found one. Is anyone aware of such a tool?

I know the SSDLife tool on Windows does this, but I am specifically looking to do this on Linux.


I looked up the smartctl command from smartmontools suggested by Selivanov. His post has been very helpful. I am going to add more info here which I came across after digging the internet.

I found the gsmartcontrol (gui version of smartctrl) especially helpful. For more information about these class of tools check Smartmontools -- Community Ubuntu Documentation. This link has examples for smartctl.

To understand what each SMART attribute means check this Intel S.M.A.R.T Attributes. These attributes are specific to Intel SSDs, but nevertheless gives an idea, what kind of information SMART attributes convey. Some specific parameters may differ between different SSDs. Is LBA size one of them?, I don't know.

Another excellent information source is How to determine number of write cycles or expected life for SSD under Linux? - Server Fault. Here, the best answer shows the SMART Attribute Id 225 stands for the total write I/O in size of 32MiBs performed to the SSD until now. However, this applies to Intel X25-M. Other SSDs, may use other SMART attributes to convey total data written to disk.

Especially, for Samsung 840 Pro (and may be even for other Samsung SSDs?) SMART Attribute Id 241 -- Total LBAs Written conveys this information. My guess for the LBA size is 512bytes, but I am not sure? Some experiments I ran by writing set amount of data to the SSD and measuring this attribute's value indicates it is 512bytes.

社区高分解答

原帖链接 · Selivanov Pavel · CC BY-SA 4.0

This values are hold in S.M.A.R.T attributes. You cat use smartctl command from smartmontools to get them.

UPD smartctl -A /dev/sda | grep -i 'media_wearout_indicator' | tr -s ' ' | cut -d' ' -f4-5 will output VALUE,WORST and THRESHOLD for Media_Wearout_Indicator. Note: for your device the attribute may have different name and threshold value, or may be unavailable at all. Depends on device vendor.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-02-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。