Intelligente Informationen zu SSD unter Linux – Smartmontools-Tool, Intelligente Informationen zu SSD unter Linux – Smartmontools-Tool.

smartmontools 工具安装
#Debian or Ubuntu
apt -y install smartmontools
#CentOS
yum -y install smartmontools


Festplattenbuchstaben anzeigen

fdisk -l


磁盘 /dev/sda:512.1 GB, 512110190592 字节,1000215216 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x000afaec

   设备 Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200  1000214527   499057664   8e  Linux LVM

磁盘 /dev/mapper/centos-root:53.7 GB, 53687091200 字节,104857600 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/centos-swap:6241 MB, 6241124352 字节,12189696 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/centos-home:451.1 GB, 451101589504 字节,881057792 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


Verwenden Sie das Tool smartmontools, um das kumulierte Lese- und Schreibvolumen des Solid-State-Laufwerks anzuzeigen

smartctl -a /dev/sda


Hier werden zahlreiche Informationen angezeigt. Mit dem grep-Tool können Sie die benötigten Informationen herausfiltern.

smartctl -x /dev/sda | grep "Read|Written"


Für diesen Satz kann es viele Ausgaben geben, die erste ist die intuitivste:

# smartctl -x /dev/sda | grep "Read|Written"
Data Units Read:                    9,076 [4.64 GB]
Data Units Written:                 60,090 [30.7 GB]
Host Read Commands:                 169,586


Es gibt noch eine weitere Methode, die berechnet werden muss:

# smartctl -x /dev/sda | grep "Read|Written"
241 Total_LBAs_Written      -O--CK   100   100   000    -    441689956
242 Total_LBAs_Read         -O--CK   100   100   000    -    880047510
0x01  0x018  6       441689956  -D-  Logical Sectors Written
0x01  0x028  6       880047510  -D-  Logical Sectors Read
0x01  0x030  6        30038299  -D-  Number of Read Commands


Die Einheit von Total_LBAs_Written ist LBAS=512Byte. Um es in GB umzurechnen, können Sie die folgende Formel verwenden: Total_LBAs_Written * 512 / 1024^3.
Hier berechnet beträgt das kumulierte Schreibvolumen ca. 210GB.