none
Using WMI to get SMART status of a hard disk RRS feed

  • Question

  • Hi

    In an app I have created it uses WMI to get SMART status of a drive using the following WMI objects:-

    Win32_DiskDrive object and its Status property

    And I have also checked:-

    MSStorageDriver_FailurePredictStatus
    MSStorageDriver_FailurePredictData
    MSStorageDriver_FailurePredictEvent
    MSStorageDriver_FailurePredictFunction

    Now I thought my app was working fine and picking up Status of OK for all drives

    I have now found for testing a failed Seagate hard disk which when run with any SMART tool such as GSmartCtrl or HDD Guardian clearly shows multiple issues (and I know it has failed as had to get data recovery company to recover files from it!) - the below screen shows all the details SMART shows about it

    So my question is why are the values returned by WMI showing NO problems at all with the disk, when clearly it has issues? - is this a common thing and am I better off just not trusting WMI for this information?

    Thanks


    Darren Rose

    Monday, March 23, 2015 11:55 AM

All replies

  • does disk manufacturer have disk provide system with info you want so wmi provide info you ask for?

    you know what gsmartctl or hdd guardian use for determining issue on hard disk an displaying info? if so use what they use.

    wmi only ask for info. not mean manufacturer provide info for device. numerous wmi query my system return some or none info for lots of properties for a class. see wmi code creator to watch happen for numerous things.


    La vida loca

    Monday, March 23, 2015 12:11 PM
  • thanks for your reply

    I haven't tried manufacturer tools to check status - as this program is used on multiple computers all within different makes/models of hard disk

    gsmartcontrol and HDD guardian use SmartMonTools (smartctl) which is what I am now going to implement in my own app to retrieve smart values correctly

    My question was mainly to find out if WMI reporting wrong SMART status information is a common problem others see - or if I am missing something here


    Darren Rose

    Monday, March 23, 2015 2:27 PM
  • thanks for your reply

    I haven't tried manufacturer tools to check status - as this program is used on multiple computers all within different makes/models of hard disk

    gsmartcontrol and HDD guardian use SmartMonTools (smartctl) which is what I am now going to implement in my own app to retrieve smart values correctly

    My question was mainly to find out if WMI reporting wrong SMART status information is a common problem others see - or if I am missing something here


    Darren Rose

    well dont believe so. never read such.

    see links. if at links not what you do then maybe what you do wrong. you not show what you do. how expect answer really? just displaying some string not represent code. who know if code correct?

    http://www.i-programmer.info/projects/38-windows/208-disk-drive-dangers.html?start=1

    http://www.i-programmer.info/projects/38-windows/208-disk-drive-dangers.html?start=2

    http://www.i-programmer.info/projects/38-windows/208-disk-drive-dangers.html?start=3


    La vida loca

    Monday, March 23, 2015 7:36 PM
  • okay thanks, will look at links

    my code is fine, was from a fellow person on this forum - and I have checked what WMI is giving me using various tools such as WMI explorer - so code not really relevant to my question


    Darren Rose

    Monday, March 23, 2015 7:38 PM
  • okay thanks, will look at links

    my code is fine, was from a fellow person on this forum - and I have checked what WMI is giving me using various tools such as WMI explorer - so code not really relevant to my question


    Darren Rose

    Hi Darren,

    This is a good opportunity because normally one can't test these things - usually the drives are fine.

    How about put a breakpoint in the class and be sure that the underlying enum is returning "OK" for status.

    I'm curious now just what you'll find.


    Still lost in code, just at a little higher level.

    :-)

    Monday, March 23, 2015 10:43 PM
  • Hi Frank - hope you are well

    Yes I have done that and also used various other WMI tools to check the values I am receiving and it is definitely showing OK for status - so it seems whatever WMI is actually checking hardware wise is just inaccurate

    I think from further testing tonight it is just retrieving the SMART overall health value and using that, which it appears from testing several faulty drives is more often than not still showing as not reporting any issues despite a disk have multiple bad sectors and 2000+ ATA errors

    Think I will amend my code and start retrieving SMART values (specifically ID
    5, 196, 197 and 198) - this along with smart overall health and ATA error values should give me a much more accurate report of the health of a drive

    The image below shows what results I get from doing this - so will be much more informative than relying on WMI Smart Status value

    Thank you both for your replies - was mainly just trying to make sure that WMI was inaccurate rather than just me being inaccurate :)


    Darren Rose

    • Proposed as answer by Frank L. Smith Monday, March 23, 2015 11:28 PM
    Monday, March 23, 2015 11:25 PM
  • Darren,

    You may be right - how can we know other than the MSDN documentation which doesn't mention "oh by the way, this is wrong". ;-)


    Still lost in code, just at a little higher level.

    :-)

    Monday, March 23, 2015 11:28 PM
  • Darren,

    You may be right - how can we know other than the MSDN documentation which doesn't mention "oh by the way, this is wrong". ;-)


    Still lost in code, just at a little higher level.

    :-)


    Yes very true - I will continue testing on other failed drives and come back if I find out more

    Darren Rose

    Monday, March 23, 2015 11:58 PM
  • okay thanks, will look at links

    my code is fine, was from a fellow person on this forum - and I have checked what WMI is giving me using various tools such as WMI explorer - so code not really relevant to my question


    Darren Rose

    Yes "so code not really relevant to my question" would be a common reply unless the explanation below seems to nullify that your code is accurate. From the second link I posted. I like posting links for no reason. Mostly because nobody reads them.

    http://en.wikipedia.org/wiki/S.M.A.R.T.

    There are (at least) four WMI objects that provide access to SMART but lack of documentation makes them difficult to use. The only information available can be found in an archived paper on the Micorosft site which describes four objects:

    MSStorageDriver_FailurePredictStatus
    MSStorageDriver_FailurePredictData
    MSStorageDriver_FailurePredictEvent
    MSStorageDriver_FailurePredictFunction

    The first provides information on the state of the drive similar to the state property already described. The second provides the SMART data that this decision was based on but the format used varies according to the make of the drive and no information is given how to decipher it. The third implements events based on the SMART status and the fourth provides methods that can be used to configure a SMART drive and initiate a test.

    There is also another object:

    MSStorageDriver_ATAPISmartData

    but there seems to be even less documentation for this and it is only available in Vista and later. It seems to return the same information as

    MSStorageDriver_FailurePredictData

    To get at the SMART data we need to use MSStorageDriver_FailurePredictData. This is stored in \root\wmi rather than the default \root\cimv2 and means we need to set the scope:

    WMISearch.Scope=new 
    ManagementScope(@"\root\wmi" );

    You can also specify a machine and user if you want to collect data on a remote machine. The WQL query is:

    WMISearch.Query=new ObjectQuery(
    "Select * from
    MSStorageDriver_FailurePredictData");
    ManagementObjectCollection
    FailDataSet = WMISearch.Get();

    The FailDataSet contains a block of SMART data for each drive in the system that supports it. Each of the FailData objects in the collection has a VendorSpecific property which returns a byte array full of SMART data.

    The big problem is in figuring out what it all means as it really is “vendor specific”. The data is organized into 12 byte blocks of attribute data. The first byte of the array gives the number of attribute blocks. Each attribute block has the format:

    Item    Data
    0 and 1 Unknown usually zero
    2 Attribute
    3 Status
    4 Unknown usually zero
    5 Value
    6 Worst
    7,8 Raw Value
    9,10,11 Unknown usually zero

    The attribute codes are also not standardized but there are a core set that you can rely on:

    Code  Attribute
    1       Raw Read Error Rate
    2 Throughput Performance
    3 Spin Up Time
    4 Start/Stop Count
    5 Reallocated Sector Count
    6 Read Channel Margin
    7 Seek Error Rate
    8 Seek Time Performance
    9 Power On Hours Count
    10 Spin Retry Count
    11 Calibration Retry Count
    12 Power Cycle Count
    192 Power-off Retract Count
    193 Load Cycle Count
    194 Temperature
    196 Reallocation Event Count
    197 Current Pending Sector Count
    198 Off-line Scan Uncorrectable Sector Count
    199 Ultra DMA CRC Error Count
    201 Soft Read Error Rate
    220 Disk Shift

    Not all drives support all attributes and you can be certain that some will report attributes not in this list. A more complete list can be found on Wikipedia: SMART. Notice also that code 194 gives the temperature of the drive.


    La vida loca

    Tuesday, March 24, 2015 4:54 AM