Smart information about SSD in Linux - smartmontools tool, Smart information about SSD in Linux - smartmontools tool.
smartmontools 工具安装
#Debian or Ubuntu
apt -y install smartmontools
#CentOS
yum -y install smartmontools
View hard drive letter
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 字节
Use the smartmontools tool to view the cumulative read and write volume of the solid state drive
smartctl -a /dev/sda
A large amount of information will be displayed here. You can use the grep tool to filter out the required information.
smartctl -x /dev/sda | grep "Read|Written"
There may be many outputs for this sentence, the first one is the most intuitive:
# 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
There is another method that needs to be calculated:
# 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
The unit of Total_LBAs_Written is LBAS=512Byte, so to convert it to GB, you can use the following formula: Total_LBAs_Written * 512 / 1024^3.
Calculated here, the cumulative write volume is approximately 210GB.