SMART: Difference between revisions

From Leo's Notes
This page was last edited on 3 April 2021, at 04:45.
No edit summary
Line 2: Line 2:


==Usage==
==Usage==
On Linux, install the {{code|smartmon-tools}} package. Use the {{code|smartctl}} utility.
On Linux, most distros package SMART as the <code>smartmontools</code> package. Two utilities come with this package:
 
* <code>smartctl</code>, which can be used to perform SMART related tasks such as starting tests and printing health status reports
* <code>smartd</code>, which monitors SMART and performs self-tests periodically. This may be configured to alert you when issues are detected.


===Show Disk Information===
===Show Disk Information===
Line 11: Line 14:


===Run Self-Test===
===Run Self-Test===
Use the {{code|--test=[offline|short|long]}} option to begin a self-test on the device. To abort a test, use the {{code|-X}} or {{code|--abort}} option.
Use the <code>--test=long</code> or the <code>--test=short</code> options to begin a self-test on the device. To abort a test, use the {{code|-X}} or {{code|--abort}} option. Test results will be listed under the self-test section in <code>smartctl -a</code> or <code>smartctl -l selftest</code>.
 
If a test failed on a bad sector, you may try to [[Hdparm|force a reallocation of that sector]].
 
It isn't a bad idea to schedule long self tests periodically (like once a month?).


==Troubleshooting==
==Troubleshooting==
Line 31: Line 38:


;Reallocated_Sector_Ct
;Reallocated_Sector_Ct
:Disks automatically remap bad sectors to a pool of reserved sectors. This attribute is the number of sectors that have been reallocated.
:Disks automatically remap bad sectors to a pool of reserved sectors. This attribute is the number of sectors that have been reallocated. You should be wary of disks with a non-zero value.
;Current_Pending_Sector
;Current_Pending_Sector
:The number of sectors that the disk had issues reading. The sector will be reallocated when either: 1. the sector can be read properly or 2. the sector is written over.
:The number of sectors that the disk had issues reading. The sector will be reallocated when either: 1. the sector can be read properly or 2. the sector is written over which may force a reallocation.


==See Also==
==See Also==

Revision as of 04:45, 3 April 2021

SMART (Self-Monitoring, Analysis and Reporting Technology) is a monitoring system included in all computer hard drives and solid state drives.

Usage

On Linux, most distros package SMART as the smartmontools package. Two utilities come with this package:

  • smartctl, which can be used to perform SMART related tasks such as starting tests and printing health status reports
  • smartd, which monitors SMART and performs self-tests periodically. This may be configured to alert you when issues are detected.

Show Disk Information

To show all capabilities, monitored attributes, errors, etc. of a particular disk, run:

# smartctl -a /dev/sda

Run Self-Test

Use the --test=long or the --test=short options to begin a self-test on the device. To abort a test, use the -X or --abort option. Test results will be listed under the self-test section in smartctl -a or smartctl -l selftest.

If a test failed on a bad sector, you may try to force a reallocation of that sector.

It isn't a bad idea to schedule long self tests periodically (like once a month?).

Troubleshooting

USB Support

When working with hard drives connected via USB, you need to disable USB Attached SCSI (UAS). Otherwise, smartctl will report:

# smartctl -a /dev/sdb
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.6.14-300.fc32.x86_64] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

Read Device Identity failed: scsi error unsupported field in scsi command

Use one of three methods described in the Disable UAS page. Once UAS is disabled, smartctl should be able to report the SMART parameters. For some devices, you may need to also pass in a -d option to smartctl. Check the supported devices page. https://www.smartmontools.org/wiki/Supported_USB-Devices for more information.

See also: https://askubuntu.com/questions/637450/cannot-perform-smart-data-and-self-test-on-external-hard-drive

Attributes

Some attributes of note.

Reallocated_Sector_Ct
Disks automatically remap bad sectors to a pool of reserved sectors. This attribute is the number of sectors that have been reallocated. You should be wary of disks with a non-zero value.
Current_Pending_Sector
The number of sectors that the disk had issues reading. The sector will be reallocated when either: 1. the sector can be read properly or 2. the sector is written over which may force a reallocation.

See Also