Smart information of SSD in Linux - smartmontools tool, Smart information of SSD in Linux - smartmontools tool.

smartmontools tool installation
#Debian or Ubuntu
apt -y install smartmontools
#CentOS
yum -y install smartmontools


Check the hard drive letter

fdisk -l


Disk /dev/sda: 512.1 GB, 512110190592 bytes, 1000215216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000afaec

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

Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 6241 MB, 6241124352 bytes, 12189696 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-home: 451.1 GB, 451101589504 bytes, 881057792 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


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 one 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.