# How to monitor all HDD activities



## Eason (Dec 19, 2015)

Recently, I started learning to use `smartctl` to monitor the health of SSD on my server. I am using Intel Solid State Drive 120GB M.2 120 1-Inch SSDSCKJW120H601. The server is for internal use only so I expect there would be only a few data written to SSD per day. However, after I run `smartctl -a /dev/ada0` for two consecutive days, I found it is not the case.

This is yesterday `smartctl` output.

```
smartctl 6.4 2015-06-04 r4109 [FreeBSD 10.2-RELEASE-p2 amd64] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     INTEL SSDSCKJW120H6
Serial Number:    CVTQ526501Y3120G
LU WWN Device Id: 5 5cd2e4 14c8bf84c
Firmware Version: RG10
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:   ACS-3 (minor revision not indicated)
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri Dec 18 22:02:46 2015 HKT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== 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:      (   0)    The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:         ( 2930) seconds.
Offline data collection
capabilities:             (0x7f) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Abort 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:     (   2) minutes.
Extended self-test routine
recommended polling time:     (  58) minutes.
Conveyance self-test routine
recommended polling time:     (   4) 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          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0032   100   100   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       2164
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       29
170 Unknown_Attribute       0x0033   100   100   010    Pre-fail  Always       -       0
171 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
172 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
174 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       1
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0033   100   100   090    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0032   032   100   000    Old_age   Always       -       32 (Min/Max 24/47)
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       1
199 UDMA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       0
225 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       1962
226 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       65535
227 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       53
228 Power-off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       65535
232 Available_Reservd_Space 0x0033   100   100   010    Pre-fail  Always       -       0
233 Media_Wearout_Indicator 0x0032   100   100   000    Old_age   Always       -       0
241 Total_LBAs_Written      0x0032   100   100   000    Old_age   Always       -       1962
242 Total_LBAs_Read         0x0032   100   100   000    Old_age   Always       -       254
249 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       1137

SMART Error Log not supported

SMART Self-test log structure revision number 1
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.
```

This is today `smartctl` output

```
smartctl 6.4 2015-06-04 r4109 [FreeBSD 10.2-RELEASE-p2 amd64] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     INTEL SSDSCKJW120H6
Serial Number:    CVTQ526501Y3120G
LU WWN Device Id: 5 5cd2e4 14c8bf84c
Firmware Version: RG10
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:   ACS-3 (minor revision not indicated)
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sat Dec 19 23:22:16 2015 HKT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== 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:      (   0)    The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:         ( 2930) seconds.
Offline data collection
capabilities:             (0x7f) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Abort 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:     (   2) minutes.
Extended self-test routine
recommended polling time:     (  58) minutes.
Conveyance self-test routine
recommended polling time:     (   4) 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          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0032   100   100   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       2187
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       29
170 Unknown_Attribute       0x0033   100   100   010    Pre-fail  Always       -       0
171 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
172 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
174 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       1
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0033   100   100   090    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0032   034   100   000    Old_age   Always       -       34 (Min/Max 24/47)
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       1
199 UDMA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       0
225 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       1987
226 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       65535
227 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       53
228 Power-off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       65535
232 Available_Reservd_Space 0x0033   100   100   010    Pre-fail  Always       -       0
233 Media_Wearout_Indicator 0x0032   100   100   000    Old_age   Always       -       0
241 Total_LBAs_Written      0x0032   100   100   000    Old_age   Always       -       1987
242 Total_LBAs_Read         0x0032   100   100   000    Old_age   Always       -       254
249 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       1157

SMART Error Log not supported

SMART Self-test log structure revision number 1
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.
```

The attributes 249 increases from 1137 to 1157. According to Wikipedia https://en.wikipedia.org/wiki/S.M.A.R.T.#Known_ATA_S.M.A.R.T._attributes, this should be 





> Total NAND Writes. Raw value reports the number of writes to NAND in 1 GB increments.


. That means my server wrote 20GB data in one day.

As I mention above, I expect there aren't much data per day. Therefore, I looked into this thread https://forums.freebsd.org/threads/sharing-of-dtrace-scripts.32855/#post-181816. I run this `dtrace` script for a day. It only records around 120MB data written to disk, which matches my expectation.

My question is should I trust the value reported by `smartctl`? Or is the script really recording all disk I/O activities? If not, what tool should I use?


----------



## SirDice (Dec 21, 2015)

qweefb said:


> The attributes 249 increases from 1137 to 1157. According to Wikipedia https://en.wikipedia.org/wiki/S.M.A.R.T.#Known_ATA_S.M.A.R.T._attributes, this should be . That means my server wrote 20GB data in one day.


If you look closely it's a definition on a Intel SSD 520 series. Yours is different. Not sure what it supposed to measure though (Unknown_Attribute).


----------



## Eason (Dec 21, 2015)

Thanks for pointing out that! After Googling it, I found that it has the same meaning. Intel 535 SSD product specification.

It seems that I have to do more research on this.


----------

