Smartctl: Difference between revisions

From 太極
Jump to navigation Jump to search
Line 239: Line 239:
= USB =
= USB =
* The message Unknown USB bridge [Please specify device type with the -d option.] indicates that smartctl is unable to automatically detect the type of USB bridge used by your external drive.
* The message Unknown USB bridge [Please specify device type with the -d option.] indicates that smartctl is unable to automatically detect the type of USB bridge used by your external drive.
* You can try using the -d sat option to specify that the device is a SATA drive behind a SCSI-to-ATA Translation (SAT) layer.
* You can try using the '''-d sat''' option to specify that the device is a SATA drive behind a SCSI-to-ATA Translation (SAT) layer.
* If this doesn’t work, you can try other device types such as -d sat,12, -d usbcypress, -d usbjmicron, -d usbprolific, or -d usbsunplus. You can find more information about these options in the smartctl man page or by running smartctl --help.
* If this doesn’t work, you can try other device types such as '''-d sat,12''', '''-d usbcypress''', '''-d usbjmicron''', '''-d usbprolific''', or '''-d usbsunplus'''. You can find more information about these options in the smartctl man page or by running '''smartctl --help'''.
<pre>
<pre>
sudo smartctl -a -d sat /dev/sdX
sudo smartctl -a -d sat /dev/sdX

Revision as of 05:53, 6 July 2023

Smartmontools

NVME

  • Version
    $ smartctl -v | head -1
    smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.19.0-46-generic] (local build)
    
  • Keyboards to look for: Written, Percentage
    $ sudo smartctl -a /dev/nvme0 | grep "Writ"
    Data Units Written:                 274,127 [140 GB]
    Host Write Commands:                7,499,312
    
    $ sudo smartctl -a /dev/nvme0 | grep "Percentage"
    Percentage Used:                    0%
    
  • Full output
    $ sudo smartctl -a /dev/nvme0 
    smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.19.0-46-generic] (local build)
    Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
    
    === START OF INFORMATION SECTION ===
    Model Number:                       CT1000P3SSD8
    Serial Number:                      2314E6C4100F
    Firmware Version:                   P9CR30A
    PCI Vendor/Subsystem ID:            0xc0a9
    IEEE OUI Identifier:                0x00a075
    Controller ID:                      1
    NVMe Version:                       1.4
    Number of Namespaces:               1
    Namespace 1 Size/Capacity:          1,000,204,886,016 [1.00 TB]
    Namespace 1 Formatted LBA Size:     512
    Namespace 1 IEEE EUI-64:            6479a7 77f00000c9
    Local Time is:                      Sat Jul  1 11:22:30 2023 EDT
    Firmware Updates (0x12):            1 Slot, no Reset required
    Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
    Optional NVM Commands (0x005e):     Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
    Log Page Attributes (0x06):         Cmd_Eff_Lg Ext_Get_Lg
    Maximum Data Transfer Size:         64 Pages
    Warning  Comp. Temp. Threshold:     85 Celsius
    Critical Comp. Temp. Threshold:     95 Celsius
    
    Supported Power States
    St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
     0 +     6.00W  0.0000W       -    0  0  0  0        0       0
     1 +     3.00W  0.0000W       -    0  0  0  0        0       0
     2 +     1.50W  0.0000W       -    0  0  0  0        0       0
     3 -   0.0250W  0.0000W       -    3  3  3  3     5000    1900
     4 -   0.0030W       -        -    4  4  4  4    13000  100000
    
    Supported LBA Sizes (NSID 0x1)
    Id Fmt  Data  Metadt  Rel_Perf
     0 +     512       0         1
     1 -    4096       0         0
    
    === START OF SMART DATA SECTION ===
    SMART overall-health self-assessment test result: PASSED
    
    SMART/Health Information (NVMe Log 0x02)
    Critical Warning:                   0x00
    Temperature:                        26 Celsius
    Available Spare:                    100%
    Available Spare Threshold:          5%
    Percentage Used:                    0%
    Data Units Read:                    201,206 [103 GB]
    Data Units Written:                 274,128 [140 GB]
    Host Read Commands:                 4,982,258
    Host Write Commands:                7,499,381
    Controller Busy Time:               23
    Power Cycles:                       13
    Power On Hours:                     408
    Unsafe Shutdowns:                   9
    Media and Data Integrity Errors:    0
    Error Information Log Entries:      42
    Warning  Comp. Temperature Time:    0
    Critical Comp. Temperature Time:    0
    Temperature Sensor 1:               26 Celsius
    Temperature Sensor 2:               31 Celsius
    Temperature Sensor 8:               26 Celsius
    
    Error Information (NVMe Log 0x01, 16 of 16 entries)
    Num   ErrCount  SQId   CmdId  Status  PELoc          LBA  NSID    VS
      0         42     0  0x5007  0x4005  0x028            0     0     -
    

SATA SSD

  • How can I monitor the TBW on my Samsung SSD?
  • Crucial shows rated as 220TB Total Bytes Written (TBW) while Samsung shows as 600 TB TBW. Both 5 year warranty.
  • Sector size is 512 bytes.
  • Keyboards to look for: Written, Percent
    $ sudo smartctl -a /dev/sda | grep "Writ"
    206 Write_Error_Rate        0x000e   100   100   000    Old_age   Always       -       0
    246 Total_LBAs_Written      0x0032   100   100   000    Old_age   Always       -       7384050441
    
    $ sudo smartctl -a /dev/sda | grep "Sector"
    Sector Size:      512 bytes logical/physical
    
    $ sudo smartctl -a /dev/sda | grep "Percent" # 99% life remain in this case
    202 Percent_Lifetime_Remain 0x0030   099   099   001    Old_age   Offline      -       1
    
  • Full output
    $ sudo smartctl --all /dev/sda
    smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.19.0-46-generic] (local build)
    Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
    
    === START OF INFORMATION SECTION ===
    Model Family:     Crucial/Micron Client SSDs
    Device Model:     Crucial_CT525MX300SSD1
    Serial Number:    1644148274F7
    LU WWN Device Id: 5 00a075 1148274f7
    Firmware Version: M0CR031
    User Capacity:    525,112,713,216 bytes [525 GB]
    Sector Size:      512 bytes logical/physical
    Rotation Rate:    Solid State Device
    Form Factor:      2.5 inches
    TRIM Command:     Available, deterministic, zeroed
    Device is:        In smartctl database [for details use: -P show]
    ATA Version is:   ACS-3 T13/2161-D revision 5
    SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
    Local Time is:    Sat Jul  1 11:17:53 2023 EDT
    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: 		( 1391) seconds.
    Offline data collection
    capabilities: 			 (0x7b) SMART execute Offline immediate.
    					Auto Offline data collection on/off 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: 	 (   2) minutes.
    Extended self-test routine
    recommended polling time: 	 (   7) minutes.
    Conveyance self-test routine
    recommended polling time: 	 (   3) minutes.
    SCT capabilities: 	       (0x0035)	SCT Status supported.
    					SCT Feature Control supported.
    					SCT Data Table supported.
    
    SMART Attributes Data Structure revision number: 16
    Vendor Specific SMART Attributes with Thresholds:
    ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
      1 Raw_Read_Error_Rate     0x002f   100   100   000    Pre-fail  Always       -       0
      5 Reallocate_NAND_Blk_Cnt 0x0032   100   100   010    Old_age   Always       -       0
      9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       14046
     12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       118
    171 Program_Fail_Count      0x0032   100   100   000    Old_age   Always       -       0
    172 Erase_Fail_Count        0x0032   100   100   000    Old_age   Always       -       0
    173 Ave_Block-Erase_Count   0x0032   099   099   000    Old_age   Always       -       17
    174 Unexpect_Power_Loss_Ct  0x0032   100   100   000    Old_age   Always       -       78
    183 SATA_Interfac_Downshift 0x0032   100   100   000    Old_age   Always       -       0
    184 Error_Correction_Count  0x0032   100   100   000    Old_age   Always       -       0
    187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
    194 Temperature_Celsius     0x0022   077   058   000    Old_age   Always       -       23 (Min/Max 12/42)
    196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
    197 Current_Pending_ECC_Cnt 0x0032   100   100   000    Old_age   Always       -       0
    198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
    199 UDMA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       1
    202 Percent_Lifetime_Remain 0x0030   099   099   001    Old_age   Offline      -       1
    206 Write_Error_Rate        0x000e   100   100   000    Old_age   Always       -       0
    246 Total_LBAs_Written      0x0032   100   100   000    Old_age   Always       -       7384050441
    247 Host_Program_Page_Count 0x0032   100   100   000    Old_age   Always       -       231070651
    248 FTL_Program_Page_Count  0x0032   100   100   000    Old_age   Always       -       94337836
    180 Unused_Reserve_NAND_Blk 0x0033   000   000   000    Pre-fail  Always       -       1940
    210 Success_RAIN_Recov_Cnt  0x0032   100   100   000    Old_age   Always       -       0
    
    SMART Error Log Version: 1
    No Errors Logged
    
    SMART Self-test log structure revision number 1
    Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
    # 1  Vendor (0xff)       Completed without error       00%     14038         -
    # 2  Vendor (0xff)       Completed without error       00%     13741         -
    # 3  Vendor (0xff)       Completed without error       00%     13548         -
    # 4  Vendor (0xff)       Completed without error       00%     13126         -
    # 5  Vendor (0xff)       Completed without error       00%     12915         -
    # 6  Vendor (0xff)       Completed without error       00%      5647         -
    # 7  Vendor (0xff)       Completed without error       00%      5484         -
    # 8  Vendor (0xff)       Completed without error       00%      5312         -
    
    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.
    

Wear out

Use the attribute Media_Wearout_Indicator or Percentage Used or SSD Life Left.

# Kingston SSD 240 GB
# smartctl -a /dev/sda | grep Left
231 SSD_Life_Left           0x0000   002   002   000    Old_age   Offline      -       98

# Crucial 1T
$ sudo smartctl -a /dev/sda | grep Percent
202 Percent_Lifetime_Remain 0x0030   099   099   001    Old_age   Offline      -       1

USB

  • The message Unknown USB bridge [Please specify device type with the -d option.] indicates that smartctl is unable to automatically detect the type of USB bridge used by your external drive.
  • You can try using the -d sat option to specify that the device is a SATA drive behind a SCSI-to-ATA Translation (SAT) layer.
  • If this doesn’t work, you can try other device types such as -d sat,12, -d usbcypress, -d usbjmicron, -d usbprolific, or -d usbsunplus. You can find more information about these options in the smartctl man page or by running smartctl --help.
sudo smartctl -a -d sat /dev/sdX

eMMC

dmesg | grep mmc

Calculation

$ sudo apt install calc
$ calc 274127*512/1024^2
	133.85107421875
> 274127 *512/1024^2 # sudo smartctl -a /dev/nvme0 | grep "Data Units Written"
[1] 133.8511 # GB

> 7384050441 * 512/1024^3 # sudo smartctl -a /dev/sda | grep "Total_LBAs_Written"
[1] 3520.99 # GB