CoreStorage and SMART status?

AVmcclint
Honored Contributor

Is it my imagination or can we no longer get the SMART status of internal drives that are partitioned via CoreStorage (FileVault2 & 10.10.5)? My boss wants to be a little proactive for finding dying drives and I knew diskutil could return the SMART status but it doesn't appear to be an option even in Disk Utility.app. It looks like it is reported for non CoreStorage drives though.

If this is the case, does anyone have suggestions for determining the SMART status on drives now?

1 ACCEPTED SOLUTION

mjsanders
New Contributor III

The new (and worse) Disk Utility still shows SMART status in 2 places:
-select the drive in the left column (not volume) : it is shown in this window directly:
1973fe7f277f4dec9e1df701099a0c08

-click info button.
and the command line works, easy way with grep:

$ diskutil info disk0 |grep SMART
   SMART Status:             Verified

I cannot check with 10.10.x, but this part of diskutil on 10.11.x seems the same to me. What was the script you used to check the status of a disk?
(edit: I use filevault, so corestorage for MacHD)

View solution in original post

4 REPLIES 4

mjsanders
New Contributor III

The new (and worse) Disk Utility still shows SMART status in 2 places:
-select the drive in the left column (not volume) : it is shown in this window directly:
1973fe7f277f4dec9e1df701099a0c08

-click info button.
and the command line works, easy way with grep:

$ diskutil info disk0 |grep SMART
   SMART Status:             Verified

I cannot check with 10.10.x, but this part of diskutil on 10.11.x seems the same to me. What was the script you used to check the status of a disk?
(edit: I use filevault, so corestorage for MacHD)

AVmcclint
Honored Contributor

I can't remember the command I used many years ago, but your reply sparked a possible answer. System Profiler (aka System information) in Yosemite and El Capitan does still list S.M.A.R.T. status. So I would imagine it might be possible to grep info from thesystem_profiler SPStorageDataType command. However I'm not good with scripting at all so I don't know how you'd grep S.M.A.R.T. and specify which drives the results apply to. Example:

disk0 S.M.A.R.T. status: Verified
disk1 S.M.A.R.T. status: Failed
disk2 S.M.A.R.T. Status: Not Supported

I'd really like to build an extension attribute to load into JSS for quick glance reference.

bpavlov
Honored Contributor

@AVmcclint It's a bit more complicated to grep from system_profiler if there are multiple mounted disks. For example, I have my bootable volume Macintosh HD and a DMG for an app open and I get multiple lines when I grep. But you could do something like this (depending on which delimiter you want to use with the cut command, pick your poison):

system_profiler SPStorageDataType | grep "S.M.A.R.T. Status:" | cut -d ' ' -f 13-

or

system_profiler SPStorageDataType | grep "S.M.A.R.T. Status:" | cut -d ':' -f 2 | sed -e 's/^[[:space:]]*//'

To break down what's happening there.
system_profiler SPStorageDataType gives you all the data you go through.
grep will search the output from the previous command for the text "S.M.A.R.T. Status:"
cut will allow you to break up the results so that you can trim out the text before the actual status (e.g. S.M.A.R.T. Status: Verified now becomes Verified)
sed will replace any leading whitespaces because when there is whitespace in front of the actual status you've just recently 'cut'.

With the command that @mjsanders mentioned, you can at least specify the disk. (Btw, that command works in 10.10.5 on my computer which is not running Core Storage.) But that also gets into assuming that disk0 is where your bootable OS is located. So if creating an extension attribute it should really be named something like SMART Status (disk0) so it's clear what it's really reporting. If you want to make that into an extension attribute then you can build around this command:

diskutil info disk0 | grep SMART | cut -d ':' -f 2- | sed -e 's/^[[:space:]]*//'

and make this extension attribute out of it

#!/bin/bash

#Determine S.M.A.R.T. Status of disk0

result=`diskutil info disk0 | grep SMART | cut -d ':' -f 2- | sed -e 's/^[[:space:]]*//'`

echo "<result>$result</result>"

As always test (because I sure haven't)

AVmcclint
Honored Contributor

I don't know why I didn't see it when I read your reply @mjsanders but it looks like the diskutil info disk0 |grep SMART will do what I need. That should wrap up in an extension attribute nicely.