1. Let the machine have external network
2, installation tool
sudo apt-get install smartmontools
3, enter the query command
sudo smartctl -x /dev/sda |egrep 'Device Model|User Capacity|Sector Size|173|Logical Sectors Written|Percentage Used Endurance Indicator'
4, Calculate the number of erasing and writing
Calculation method: 2578270620 (the number after 0x018) × 512 (the number after Size) ÷ 1024 ÷ 1024 ÷ 1024 ÷ 64 (the hard disk size is 64G)