Jump to content
IPS Community Suite 简体中文
Sign in to follow this  
ipscn

smartmontools

Recommended Posts

smartmontools 是一个可以用来查看 SSD 写入量的软件。

可以从 https://www.smartmontools.org 了解如何安装。

在 Windows 操作系统上,以管理员模式运行安装目录下的 smartctl (Admin CMD):

1957.png

这是我的 Toshiba Q200EX 240GB , ID 为 173 (AD)的那行的值,可以看出大致的使用量,我的这个盘,已经用了好几个月了,新的时候,是 200,现在是 196。

往下翻,可以看到通电时长和通电次数:

1960.png

往下翻,会看到:

1958.png

其中的 0x008到 0x030 几行比较关键,比如,这个盘的数据写入量为:

8777365570*512/1024/1024/1024/1024= 4.08 TB

再往下翻,会看到

1959.png

 

0x07 的值,为使用百分比,这个盘,意境使用 4%的了,N表示目前是正常的。

由以上数据,可以推测出,这个盘的最大使用量是 102TB。

在 Ubuntu 上使用:

wget https://builds.smartmontools.org/r4731/smartmontools-6.7-0-20180419-r4731.src.tar.gz
tar zxvf smartmontools-6.7-0-20180419-r4731.src.tar.gz
cd smartmontools-6.7
./configure
make
sudo make install

 

配置时,可能会遇到可以忽略的警告:

configure: WARNING:
This version of smartmontools provides NVMe support which is still
EXPERIMENTAL.  NVMe devices are not yet included in smartd.conf
'DEVICESCAN' and 'smartctl --scan' unless '-d nvme' is specified.
Use option '--with-nvme-devicescan' to include NVMe devices.
Use option '--without-nvme-devicescan' to suppress this warning.

然后开始扫描挂载的硬盘

sudo smartctl --scan

系统盘一半是 /dev/sda, 查看它的使用情况

sudo smartctl -x /dev/sda
uuu@uuu:~/smartmontools-6.7$ sudo smartctl -x /dev/sda
smartctl 6.7 2018-04-19 r4731 [x86_64-linux-4.15.0-20-generic] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     FSX-120GB
Serial Number:    6212161000778
LU WWN Device Id: 6 212161 000770000
Firmware Version: 5.2.4
User Capacity:    120,034,123,776 bytes [120 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS, ACS-2 T13/2015-D revision 3
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri May  4 23:41:36 2018 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
AAM feature is:   Unavailable
APM level is:     254 (maximum performance)
Rd look-ahead is: Disabled
Write cache is:   Enabled
DSN feature is:   Unavailable
ATA Security is:  Disabled, frozen [SEC2]
Wt Cache Reorder: Unavailable

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00)	Offline data collection activity
					was never started.
					Auto Offline Data Collection: Disabled.
Self-test execution status:      (   1)	The previous self-test routine completed
					without error or no self-test has ever 
					been run.
Total time to complete Offline 
data collection: 		(    0) seconds.
Offline data collection
capabilities: 			 (0x79) SMART execute Offline immediate.
					No Auto Offline data collection support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					Conveyance Self-test supported.
					Selective Self-test supported.
SMART capabilities:            (0x0003)	Saves SMART data before entering
					power-saving mode.
					Supports SMART auto save timer.
Error logging capability:        (0x01)	Error logging supported.
					General Purpose Logging supported.
Short self-test routine 
recommended polling time: 	 (   1) minutes.
Extended self-test routine
recommended polling time: 	 (  36) minutes.
Conveyance self-test routine
recommended polling time: 	 (   2) minutes.
SCT capabilities: 	       (0x0025)	SCT Status supported.
					SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAGS    VALUE WORST THRESH FAIL RAW_VALUE
  1 Raw_Read_Error_Rate     PO--CK   120   120   050    -    0
  5 Reallocated_Sector_Ct   PO--CK   100   100   003    -    0
  9 Power_On_Hours          -O--CK   100   100   000    -    51 (229 168 0)
 12 Power_Cycle_Count       -O--CK   100   100   000    -    28
171 Unknown_Attribute       -O-R--   000   000   000    -    0
172 Unknown_Attribute       -O--CK   000   000   000    -    0
174 Unknown_Attribute       ----CK   000   000   000    -    7
177 Wear_Leveling_Count     ------   000   000   000    -    0
181 Program_Fail_Cnt_Total  -O-R--   000   000   000    -    0
182 Erase_Fail_Count_Total  -O--CK   000   000   000    -    0
187 Reported_Uncorrect      -O--C-   100   100   000    -    0
194 Temperature_Celsius     -O---K   030   030   000    -    30 (Min/Max 30/30)
195 Hardware_ECC_Recovered  --SRC-   120   120   000    -    0
196 Reallocated_Event_Count PO--CK   100   100   003    -    0
201 Unknown_SSD_Attribute   --SRC-   120   120   000    -    0
204 Soft_ECC_Correction     --SRC-   120   120   000    -    0
230 Unknown_SSD_Attribute   PO--C-   100   100   000    -    100
231 Temperature_Celsius     PO--C-   100   100   010    -    0
233 Media_Wearout_Indicator -O--CK   000   000   000    -    69
234 Unknown_Attribute       -O--CK   000   000   000    -    115
241 Total_LBAs_Written      -O--CK   000   000   000    -    115
242 Total_LBAs_Read         -O--CK   000   000   000    -    54
                            ||||||_ K auto-keep
                            |||||__ C event count
                            ||||___ R error rate
                            |||____ S speed/performance
                            ||_____ O updated online
                            |______ P prefailure warning

General Purpose Log Directory Version 1
SMART           Log Directory Version 1 [multi-sector log support]
Address    Access  R/W   Size  Description
0x00       GPL,SL  R/O      1  Log Directory
0x04       GPL,SL  R/O      1  Device Statistics log
0x07       GPL     R/O      1  Extended self-test log
0x09           SL  R/W      1  Selective self-test log
0x10       GPL     R/O      1  NCQ Command Error log
0x11       GPL     R/O      1  SATA Phy Event Counters log
0x80-0x9f  GPL,SL  R/W     16  Host vendor specific log
0xb7       GPL,SL  VS      16  Device vendor specific log
0xe0       GPL,SL  R/W      1  SCT Command/Status
0xe1       GPL,SL  R/W      1  SCT Data Transfer

SMART Extended Comprehensive Error Log (GP Log 0x03) not supported

SMART Error Log not supported

SMART Extended Self-test Log Version: 1 (1 sectors)
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

SCT Status Version:                  3
SCT Version (vendor specific):       0 (0x0000)
Device State:                        Active (0)
Current Temperature:                    30 Celsius
Power Cycle Min/Max Temperature:     127/-127 Celsius
Lifetime    Min/Max Temperature:     30/-127 Celsius
Under/Over Temperature Limit Count:   0/0

SCT Temperature History Version:     2
Temperature Sampling Period:         1 minute
Temperature Logging Interval:        10 minutes
Min/Max recommended Temperature:      0/65 Celsius
Min/Max Temperature Limit:            0/70 Celsius
Temperature History Size (Index):    478 (26)

Index    Estimated Time   Temperature Celsius
  27    2018-05-01 16:10     ?  -
 ...    ..(476 skipped).    ..  -
  26    2018-05-04 23:40     ?  -

SCT Error Recovery Control command not supported

Device Statistics (GP Log 0x04)
Page  Offset Size        Value Flags Description
0x01  =====  =               =  ===  == General Statistics (rev 2) ==
0x01  0x008  4              28  ---  Lifetime Power-On Resets
0x01  0x018  6       242139005  ---  Logical Sectors Written
0x01  0x028  6       114331214  ---  Logical Sectors Read
0x04  =====  =               =  ===  == General Errors Statistics (rev 1) ==
0x04  0x008  4               0  ---  Number of Reported Uncorrectable Errors
0x04  0x010  4               0  ---  Resets Between Cmd Acceptance and Completion
0x05  =====  =               =  ===  == Temperature Statistics (rev 1) ==
0x05  0x008  1              30  ---  Current Temperature
0x05  0x010  1               -  ---  Average Short Term Temperature
0x05  0x018  1               -  ---  Average Long Term Temperature
0x05  0x020  1               -  ---  Highest Temperature
0x05  0x028  1               -  ---  Lowest Temperature
0x05  0x030  1               -  ---  Highest Average Short Term Temperature
0x05  0x038  1               -  ---  Lowest Average Short Term Temperature
0x05  0x040  1               -  ---  Highest Average Long Term Temperature
0x05  0x048  1               -  ---  Lowest Average Long Term Temperature
0x05  0x050  4               0  ---  Time in Over-Temperature
0x05  0x058  1              65  ---  Specified Maximum Operating Temperature
0x05  0x060  4               0  ---  Time in Under-Temperature
0x05  0x068  1               0  ---  Specified Minimum Operating Temperature
0x06  =====  =               =  ===  == Transport Statistics (rev 1) ==
0x06  0x008  4               0  ---  Number of Hardware Resets
0x06  0x010  4              43  ---  Number of ASR Events
0x06  0x018  4               0  ---  Number of Interface CRC Errors
0x07  =====  =               =  ===  == Solid State Device Statistics (rev 1) ==
0x07  0x008  1               0  ---  Percentage Used Endurance Indicator
                                |||_ C monitored condition met
                                ||__ D supports DSN
                                |___ N normalized value

Pending Defects log (GP Log 0x0c) not supported

SATA Phy Event Counters (GP Log 0x11)
ID      Size     Value  Description
0x0001  2            0  Command failed due to ICRC error
0x0003  2            0  R_ERR response for device-to-host data FIS
0x0004  2            0  R_ERR response for host-to-device data FIS
0x0006  2            0  R_ERR response for device-to-host non-data FIS
0x0007  2            0  R_ERR response for host-to-device non-data FIS
0x0008  2            0  Device-to-host non-data FIS retries
0x0009  2            2  Transition from drive PhyRdy to drive PhyNRdy
0x000a  2            2  Device-to-host register FISes sent due to a COMRESET
0x000f  2            0  R_ERR response for host-to-device data FIS, CRC
0x0010  2            0  R_ERR response for host-to-device data FIS, non-CRC
0x0012  2            0  R_ERR response for host-to-device non-data FIS, CRC
0x0013  2            0  R_ERR response for host-to-device non-data FIS, non-CRC
0x0002  2            0  R_ERR response for data FIS
0x0005  2            0  R_ERR response for non-data FIS
0x000b  2            0  CRC errors within host-to-device FIS
0x000d  2            0  Non-CRC errors within host-to-device FIS

由上面的数据可知这个盘的写入量是242139005*512/1024/1024/1024=115.4GB, 使用率是 100%,这个盘 SLC 闪存的 Fujitsu FX 240GB 。

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×