希捷企业盘可靠性日志
大概是一个月左右,市面上逐渐出现了一批将二手希捷Exos清零作为新硬盘的卖家,其涉及范围涉及希捷的银河(Exos)系列,甚至IronWolf系列,清零方式主要是通过擦除SMART,篡改序列号或标签等手段。
如果使用普通的SMART工具软件是看不出来的,但是可以通过希捷企业盘的FARM功能读取内部数据来发现端倪。
首先清零盘这种已经是有悠久历史的东西了,只不过这一次发生在希捷的企业盘,消费级的SMART数据清零门槛是相对较低的,现在出现了清零的企业盘意味着相较于以前更值得注意。
不过相对于外观检查来发现使用痕迹,希捷企业盘还能通过FARM(Field Access Reliability Metrics, 现场可访问可靠性指标)来判断硬盘的深度信息,其效果相当于进阶版的SMART,面向用户提供了更丰富的磁盘内部信息,不过这种功能基本上只有Exos、IronWolf、IronWolf Pro和部分SkyHawk硬盘才有。
查看FARM最直接的就是使用官方的SeaChest Utilities来读取,不过这里将会才有smartctl这个开源工具来查询信息。
编译
SmartCtl工具来自SmartMonTools,官网下载见此
其官网提供了Windows预编译的版本,而Linux下需要自行编译,这里主要说明Linux下编译的情形
下载tar
格式的源代码后,找到一个已经安装好gcc
和g++
以及make
的机器,然后开始执行配置
CXXFLAGS=-static ./configure
在这里,使用了一个CXXFLAGS
的变量,这个用于作为g++
编译使用的参数,在这里的目的是为了进行静态编译,因为我们目的是为了在这台编译机编译完成后直接可以移动到其他设备上使用,特别是没有装有C运行库的环境,例如我的Unraid服务器。配置脚本会自动检查所需依赖,需要关注C++ compiler flags
是否含有所需的静态编译参数
configure:
-----------------------------------------------------------------------------
smartmontools-7.4 configuration:
host operating system: x86_64-pc-linux-gnu
C++ compiler: g++
C compiler: gcc
preprocessor flags:
C++ compiler flags: -static -std=gnu++11 -Wall -W -Wformat=2 -Werror=return-type -fstack-protector-strong
C compiler flags: -g -O2
linker flags:
OS specific modules: os_linux.o cciss.o dev_areca.o
binary install path: /usr/local/sbin
man page install path: /usr/local/share/man
doc file install path: /usr/local/share/doc/smartmontools
examples install path: /usr/local/share/doc/smartmontools/examplescripts
drive database file: /usr/local/share/smartmontools/drivedb.h
database update script: /usr/local/sbin/update-smart-drivedb
database update branch: branches/RELEASE_7_3_DRIVEDB
download tools: curl wget lynx svn
GnuPG for verification: gpg
local drive database: /usr/local/etc/smart_drivedb.h
smartd config file: /usr/local/etc/smartd.conf
smartd warning script: /usr/local/etc/smartd_warning.sh
smartd plugin path: /usr/local/etc/smartd_warning.d
PATH within scripts: /usr/local/bin:/usr/bin:/bin
smartd initd script: [disabled]
smartd save files: [disabled]
smartd attribute logs: [disabled]
SELinux support: no
libcap-ng support: no
systemd notify support: no
NVMe DEVICESCAN: yes
-----------------------------------------------------------------------------
在我这个静态编译的场景下,关于systemd
的支持因为能安装的只有动态库,缺乏静态库,因此会提示无法使用,在我这种需要跨操作系统使用的倒也无所谓
configure: WARNING:
systemd(1) is used on this system but smartd systemd notify support will
not be available because a required library is missing.
Use option '--without-libsystemd' to suppress this warning.
然后执行make
开始进行编译,编译完成后,需要的是底下的smartctl
二进制程序,在移动到其他设备上使用之前,可以使用ldd
工具检查它是否被正确地编译
tiya@codelabmini:~/smartmontools-7.4$ ldd smartctl
not a dynamic executable
这种就是被正确地静态编译的,没有其余外部依赖
tiya@codelabmini:~/smartmontools-7.4$ ldd smartctl
linux-vdso.so.1 (0x00007ffd2a703000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f41c5a85000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f41c5a65000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f41c583c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f41c5755000)
/lib64/ld-linux-x86-64.so.2 (0x00007f41c5dd5000)
这种就是没有按预期编译的,因为有外部链接,其他机器上如果缺乏这些环境就会无法运行
查询
在目标机器上,查询对于硬盘的信息,并过滤出FARM
字段
./smartctl -x /dev/sdd | grep FARM
如果这个硬盘支持FARM,可以看到如下信息
Seagate FARM log (GP Log 0xa6) supported [try: -l farm]
接下来按照提示,使用-l farm
来查询FARM数据
./smartctl -l farm /dev/sdd
FARM的数据很多,要关注的是FARM Log Page 1: Drive Information
这部分
FARM Log Page 1: Drive Information
Serial Number: xxxxxxxx
World Wide Name: 0xffffffffff
Device Interface: SATA
Device Capacity in Sectors: 31251759104
Physical Sector Size: 4096
Logical Sector Size: 512
Device Buffer Size: 268435456
Number of Heads: 18
Device Form Factor: 3.5 inches
Rotation Rate: 7200 rpm
Firmware Rev: SN03
ATA Security State (ID Word 128): 0x01621
ATA Features Supported (ID Word 78): 0x016cc
ATA Features Enabled (ID Word 79): 0x0000000000000044
Power on Hours: 16046
Spindle Power on Hours: 192
Head Flight Hours: 25
Head Load Events: 403
Power Cycle Count: 33
Hardware Reset Count: 20
Spin-up Time: 10 ms
Time to ready of the last power cycle: 20320 ms
Time drive is held in staggered spin: 0 ms
Model Number: ST16000NM000J-2TW103
Drive Recording Type: CMR
Max Number of Available Sectors for Reassignment: 57754
Assembly Date (YYWW):
Depopulation Head Mask: 0
其中可以注意到Power on Hours
字段,和SAMRT上的Power on hours
对比,如果对不上就能发现端倪,例如这块所谓的“全新”盘,其SMART上只报告了192h
,但实际上是16046h
,换算过来是1.8年
同时,结合Workload Statistics
可以看到全盘实际的读写量
FARM Log Page 2: Workload Statistics
Total Number of Read Commands: 27844018
Total Number of Write Commands: 60955272
Total Number of Random Read Commands: 5820930
Total Number of Random Write Commands: 38959298
Total Number Of Other Commands: 10928672
Logical Sectors Written: 71996186962
Logical Sectors Read: 2275086853
Number of dither events during current power cycle: 16
Number of times dither was held off during random workloads: 7
Number of times dither was held off during sequential workloads: 245
Number of Read commands from 0-3.125% of LBA space for last 3 SMART Summary Frames: 0
Number of Read commands from 3.125-25% of LBA space for last 3 SMART Summary Frames: 0
Number of Read commands from 25-75% of LBA space for last 3 SMART Summary Frames: 0
Number of Read commands from 75-100% of LBA space for last 3 SMART Summary Frames: 0
Number of Write commands from 0-3.125% of LBA space for last 3 SMART Summary Frames: 0
Number of Write commands from 3.125-25% of LBA space for last 3 SMART Summary Frames: 0
Number of Write commands from 25-75% of LBA space for last 3 SMART Summary Frames: 0
Number of Write commands from 75-100% of LBA space for last 3 SMART Summary Frames: 0
根据Page 1描述的Logical Sector Size
来换算Logical Sectors Written/Read
,从而得出真实的读写信息,例如在这里可见已经写入了33.52TB
,读取1.06TB
,是一个典型的写多读少,属于比较明显的Chia矿盘的特征
FARM数据远不止于此,还能通过对比上面的序列号信息来发现贴纸是否被篡改,以及磁头健康状况,最近读写分布,温度最高最低值,甚至当前电机功耗和电压情况,如果原始数据不好阅读,可以交由AI来总结
我这块毕竟是深水鱼上面的,因此会有这种事也不意外,不过好在通电时长基本上和质保开始时长相当,而且Chia的对机械硬盘磨损较少,且时长较短,还是国行在保,因此还是能接受的。