Checking Hard Drive Health (SMART) in Windows

Checking Hard Drive Health (SMART) in Windows

https://ift.tt/3HrQYWH

Current Windows versions collect information about the health of hard drives in your computer via SMART and may notify a user in case of any problems. Let’s see what a Windows notification of physical problems with a hard drive looks like and how to get SMART information about the health of your disks using built-in tools (WMI classes, PowerShell and command prompt).

Most modern hard drives (including HDD, SSD, NVMe SSD) support S.M.A.R.T (Self-Monitoring, Analysis, and Reporting Technology). A disk controller estimates the physical characteristics of a disk, and Windows can access these data through WMI.

SMART information is available for local physical disks only (ATA/SATA devices). External LUNs connected via Fiber Channel,

iSCSI

, RAID, or

shared drives

don’t report SMART status.

Windows Detected a Hard Disk Problem

By default, disk monitoring by the Logical Disk Manager and Diagnostic Policy Service is enabled in Windows. If one of the drives returns the Predictive Failure status, the Task Scheduler runs the Microsoft-Windows-DiskDiagnosticResolver (\Microsoft\Windows\DiskDiagnostic) task that displays the error message:

Windows detected a hard disk problem
Back up your files immediately to prevent information loss, and then contact the computer manufacturer to determine if you need to repair the disk.

drive health error: Windows Detected a Hard Disk Problem

The following messages appear in the Event Viewer logs:

The driver has detected that device \Device\Harddisk1\DR1 has predicted that it will fail. Immediately back up your data and replace your hard disk drive. A failure may be imminent.
Windows Disk Diagnostic detected a S.M.A.R.T. fault on disk .......... (volumes E:\). This disk might fail; back up your computer now. All data on the hard disk, including files, documents, pictures, programs, and settings might be lost if your hard disk fails. To determine if the hard disk needs to be repaired or replaced, contact the manufacturer of your computer. If you can't back up (for example, you have no CDs or other backup media), you should shut down your computer and restart when you have backup media available. In the meantime, do not save any critical files to this disk.

The Predictive Failure status means that one of the disk characteristics (like mechanical wear) doesn’t match the reference values and it may fail.

In this case, it is recommended to back up data from the disk to a separate media. Then check the disk using a default manufacturer SMART tool (or other tools, like CrystalDiskInfo) and using chkdsk.

You can show or hide this message using a separate GPO option, Disk Diagnostic: Configure execution level, located in the Administrative Templates -> System -> Troubleshooting and Diagnostics -> Disk Diagnostics section of GPO.

Enable drive SMART health alerts on Windows using GPO - Disk Diagnostic: Configure execution level

Most often, third-party tools (like CrystalDiskInfo, HDTune, etc.) are used to get information about disk health in Windows. These programs provide a lot of information about your disks.

CrystalDiskInfo drive health report

For example, I can get an SSD resource. The current value of the Total Host Writes is 507 GB. The manufacturer guarantees that the maximum write resource (TBW) for my SSD model is 300 TB. So the disk wear is less than 0.2%. The disk is only used for 108 hours.

Check SMART Attributes of a Hard Disk via WMI Class and PowerShell

You can check SMART disk data using Windows built-in tools. You can view the information about the disk health of your computer through the Control Panel (Control Panel\System and Security\Security and Maintenance). The section also contains information about the state of the Windows Error Reporting service.

In my case, the disks are OK, since there is the following message in the Drive Status section: OK, All drives are working properly.

Drive status in Windows Control Panel: All drives are working properly

As we told above, Windows collects SMART information from the disks and allows to access it using WMI.

SMART must be enabled in BIOS/UEFI settings.

Run the elevated command prompt and use the command below to get the state of all your disks:

wmic diskdrive get status

cmd: wmic diskdrive get status

In this case, the disks are OK. Otherwise, you will see Bad, Unknown, or Caution status.

You can get information about possible hard drive failure using MSStorageDriver_FailurePredictStatus WMI class:

wmic /namespace:\\root\wmi path MSStorageDriver_FailurePredictStatus

get FailurePredictStatus in windows via WMI

If the disk controller doesn’t detect any disk problems, the PredictFailure value should be FALSE.

The same class may be queried using PowerShell:

Get-WmiObject -namespace root\wmi –class MSStorageDriver_FailurePredictStatus

If the value is PredictFailure = True, pay attention to the error code shown in the Reason parameter. The meaning of the PredictFailure error code depends on your vendor. You can find information on some error codes in the wiki (https://en.wikipedia.org/wiki/S.M.A.R.T.#ATA_S.M.A.R.T._attributes).

You can get the values of some reliability counters using the following PowerShell command:

Get-Disk | foreach { $_ | Get-StorageReliabilityCounter | Format-List }

Get disk reliability counters - PowerShell - Get-StorageReliabilityCounter

You can display information on some SMART attributes only:

Get-PhysicalDisk | Get-StorageReliabilityCounter | Select-Object -Property DeviceID, Wear, ReadErrorsTotal, ReadErrorsCorrected, WriteErrorsTotal, WriteErrorsUncorrected, Temperature, TemperatureMax | FT

Also, you can view general information about your disks using the Get-PhysicalDisk cmdlet:

$(Get-PhysicalDisk | Select *)[0]

PhysicalDisk - health status powershell

Earlier we showed how to get information about a failed disk in

Windows Server S2D

using Get-PhysicalDisk and

replace

it:

Get-PhysicalDisk | Where-Object {$_.HealthStatus -ne 'Healthy'}

Using these WMI classes and PowerShell cmdlets, you can configure disk health data collection on user computers to proactively track their status. You can create alerts for your monitoring system (like zabbix, nagios, icinga, etc.), SCCM compliance report using Configuration Baseline, PowerShell Desired State Configuration (DSC), query SMART status from remote computers using a PowerShell Remoting (Invoke-Command cmdlet), or use your methods.

powershell,virtualization,windows

via Windows OS Hub http://woshub.com

November 12, 2021 at 08:24AM
admin