How to See SMART Status from Remote Login

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to See SMART Status from Remote Login

Nello Lucchesi
I want to check the SMART status of a hard drive on an iMac to which I have an ssh connection.

I'm hoping that there is a command-line option for Disk Utility that would retrieve the SMART status of a hard drive.  But an Apple Genius says there is no Terminal command to monitor SMART status.

Does anyone know a way to check the SMART status of a hard drive on a remote iMac (via an ssh connection or otherwise)? 

- nello





____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: How to See SMART Status from Remote Login

Travis Butler

> On Oct 2, 2016, at 2:26 PM, Nello Lucchesi <[hidden email]> wrote:
>
> I want to check the SMART status of a hard drive on an iMac to which I have an ssh connection.
>
> I'm hoping that there is a command-line option for Disk Utility that would retrieve the SMART status of a hard drive.  But an Apple Genius says there is no Terminal command to monitor SMART status.
>
> Does anyone know a way to check the SMART status of a hard drive on a remote iMac (via an ssh connection or otherwise)?

The only possible way I can think of - assuming no third-party command line utility can be found - would be to use screen sharing and Disk Utility or one of the other GUI utilities that shows SMART status. If this is about the iMac that’s having trouble with its graphic card, though, I’m not sure that would work.





____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: How to See SMART Status from Remote Login

Ron Risley
In reply to this post by Nello Lucchesi

> On Oct 2, 2016, at 12:26, Nello Lucchesi <[hidden email]> wrote:
>
> I want to check the SMART status of a hard drive on an iMac to which I have an ssh connection.
>

This thread, though a couple of years old, might be of interest:

http://apple.stackexchange.com/questions/135565/how-do-i-get-detailed-smart-disk-information-on-os-x-mavericks-or-later

or https://is.gd/dseKHI

--Ron




____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: How to See SMART Status from Remote Login

Al Varnell
In reply to this post by Nello Lucchesi

On Sun, Oct 02, 2016 at 12:26 PM, Nello Lucchesi wrote:
I'm hoping that there is a command-line option for Disk Utility that would retrieve the SMART status of a hard drive.

diskutil info MountPoint|DiskIdentifier|DeviceNode|UUID

Probably "diskutil info /" will work.

-Al-
-- 
Al Varnell
Mountain View, CA







____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: How to See SMART Status from Remote Login

David Ross
On 10/2/16 5:59 PM, Al Varnell wrote:
On Sun, Oct 02, 2016 at 12:26 PM, Nello Lucchesi wrote:
I'm hoping that there is a command-line option for Disk Utility that would retrieve the SMART status of a hard drive.

diskutil info MountPoint|DiskIdentifier|DeviceNode|UUID

Probably "diskutil info /" will work.
Close. This gets converted to to give the status of the partition with the OS but you need to get the status of the entire drive.

diskutil info disk0
will most likely give you the smart status of a single drive computer setup with not tricks. Not sure what you might get with a fusion drive setup.
If you're adventurous you can
diskutil list
which will show you a list of drives and partitions and you can figure out from that list what you want to use for the "info" variant of the comment.

David



____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: How to See SMART Status from Remote Login

Al Varnell
On Sun, Oct 02, 2016 at 08:27 PM, David Ross wrote:
On 10/2/16 5:59 PM, Al Varnell wrote:
On Sun, Oct 02, 2016 at 12:26 PM, Nello Lucchesi wrote:
I'm hoping that there is a command-line option for Disk Utility that would retrieve the SMART status of a hard drive.

diskutil info MountPoint|DiskIdentifier|DeviceNode|UUID

Probably "diskutil info /" will work.

Close. This gets converted to to give the status of the partition with the OS but you need to get the status of the entire drive.

diskutil info disk0
will most likely give you the smart status of a single drive computer setup with not tricks. Not sure what you might get with a fusion drive setup.
If you're adventurous you can
diskutil list
which will show you a list of drives and partitions and you can figure out from that list what you want to use for the "info" variant of the comment.

David

Just wanted to add that it did work for my boot drive with multiple partitions:

 diskutil info /
   Device Identifier:        disk1s6
   Device Node:              /dev/disk1s6
   Whole:                    No
   Part of Whole:            disk1
   Device / Media Name:      Untitled

   Volume Name:              El Capitan

   Mounted:                  Yes
   Mount Point:              /

   File System Personality:  Journaled HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended (Journaled)
   Journal:                  Journal size 32768 KB at offset 0xb56000
   Owners:                   Enabled

   Partition Type:           Apple_HFS
   OS Can Be Installed:      Yes
   Recovery Disk:            disk1s7
   Media Type:               Generic
   Protocol:                 SATA
   SMART Status:             Verified
   Volume UUID:              AEEC637F-DB2E-3B23-97D1-37CDB0ED3A0D
   Disk / Partition UUID:    C2CDD4FF-6960-4A23-A4C3-D5F5927DEF4E

   Total Size:               388.8 GB (388804710400 Bytes) (exactly 759384200 512-Byte-Units)
   Volume Free Space:        180.6 GB (180603273216 Bytes) (exactly 352740768 512-Byte-Units)
   Device Block Size:        512 Bytes
   Allocation Block Size:    4096 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No

   Device Location:          External
   Removable Media:          No

   Solid State:              No

But even with all that information, it probably won’t show you want you really want to know about SMART. Disk Utility just gives you the results of the last self-check and almost certainly won’t let you know if the drive is failing. For that you need an advanced Utility, such as SMART Utility or DriveDx (which can be used in demo mode) or TechTool Pro 9 or Drive Genius 4 (if you already have them).

-Al-




____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: How to See SMART Status from Remote Login

Chris Devers
In reply to this post by Ron Risley
The diskutil command is handy for a lot of things, but (unless this has changed in Sierra) Apple has never implemented a mechanism for querying SMART data via diskutil. If you want to read relatively raw data off the drive firmware itself, smartmontools is the way to go.

The StackExchange post that Ron Risley pointed out has the correct answer: use Homebrew (or similar) to install Smartmontools, then use that to interrogate the hardware.

$ brew install smartmontools

Then, you need to work out what the logical device is. Checking the computer I’m on, which has Windows and Mac partitions, I see:

$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:       Microsoft Basic Data WINDOWS 7               106.7 GB   disk0s2
   3:       Microsoft Basic Data DATA                    106.7 GB   disk0s3
   4:                  Apple_HFS Macintosh HD            105.8 GB   disk0s4
   5:                 Apple_Boot Recovery HD             650.0 MB   disk0s5

Okay, so disk0 is the hardware device. Let’s try that:

$ smartctl -i disk0 | egrep -i 'model|serial|capacity'
Device Model:     Hitachi […omitted…]
Serial Number:    […omitted…]
User Capacity:    320,072,933,376 bytes [320 GB]

We can run a “quick” test on the drive hardware:

$ smartctl -t short disk0 
smartctl 6.4 2015-06-04 r4109 [x86_64-apple-darwin15.0.0] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in off-line mode".
Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 2 minutes for test to complete.
Test will complete after Mon Oct  3 10:45:46 2016

Use smartctl -X to abort test.

I find the estimate is reasonable but not always accurate. We can check on the progress as it runs:

$ smartctl -a disk0 | egrep -A1 -i '^Self-test execution status'
Self-test execution status:      ( 249) Self-test routine in progress...
90% of test remaining.

Still going then. Let’s wait a bit for it to finish, then…

$ smartctl -a disk0 | egrep -A1 -i '^Self-test execution status'
Self-test execution status:      ( 242) Self-test routine in progress...
20% of test remaining.

Still not quite done yet. Wait a bit longer, then re-check…

$ smartctl -a disk0 | egrep -A1 -i '^Self-test execution status'
Self-test execution status:      (   0) The previous self-test routine completed
without error or no self-test has ever 

Great, the test is done now. Let’s check the results:

$ smartctl -l selftest disk0
smartctl 6.4 2015-06-04 r4109 [x86_64-apple-darwin15.0.0] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%     48629         -
# 2  Short offline       Completed without error       00%     48628         -
# 3  Short offline       Completed without error       00%     16094         -
# 4  Short offline       Completed without error       00%     16094         -
# 5  Short offline       Completed without error       00%     16094         -

So this, in my case, seems to be a healthy drive. 

We can also do a “long” test — smartctl -t long — which tends to take an hour or two, depending on the drive, and also some other test options:

$ smartctl -h 2>&1 | grep -A2 't TEST'
  -t TEST, --test=TEST
        Run test. TEST: offline, short, long, conveyance, force, vendor,N,
                        select,M-N, pending,N, afterselect,[on|off]

Explanations for these are a quick manpage or web search away :-)

We can also look at the raw vendor-specific attributes for the drive:

$ smartctl -A disk0
smartctl 6.4 2015-06-04 r4109 [x86_64-apple-darwin15.0.0] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
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     0x000b   100   100   062    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0005   100   100   040    Pre-fail  Offline      -       0
  3 Spin_Up_Time            0x0007   139   139   033    Pre-fail  Always       -       2
  4 Start_Stop_Count        0x0012   097   097   000    Old_age   Always       -       5449
  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0005   100   100   040    Pre-fail  Offline      -       0
  9 Power_On_Hours          0x0012   001   001   000    Old_age   Always       -       48629
 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       265
160 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
191 G-Sense_Error_Rate      0x000a   100   100   000    Old_age   Always       -       3504693313536
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       32
193 Load_Cycle_Count        0x0012   001   001   000    Old_age   Always       -       1732288
194 Temperature_Celsius     0x0002   148   148   000    Old_age   Always       -       37 (Min/Max 17/47)
195 Hardware_ECC_Recovered  0x000a   100   100   000    Old_age   Always       -       0
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       0
223 Load_Retry_Count        0x000a   085   085   000    Old_age   Always       -       262155
254 Free_Fall_Sensor        0x0032   100   100   000    Old_age   Always       -       12

This table can be a bit inscrutable, but Wikipedia’s S.M.A.R.T. article has a useful table to help with decoding the fields: 
Better still, Backblaze has been researching drive failure patterns in their data centers, and has published a series of blog posts about what SMART attributes they do, and do not, find meaningful.
Et cetera. The TL;DR is in that last Backblaze link:

From experience, we have found the following 5 SMART metrics indicate impending disk drive failure:

SMART 5 – Reallocated_Sector_Count.
SMART 187 – Reported_Uncorrectable_Errors.
SMART 188 – Command_Timeout.
SMART 197 – Current_Pending_Sector_Count.
SMART 198 – Offline_Uncorrectable.

We chose these 5 stats based on our experience and input from others in the industry because they are consistent across manufacturers and they are good predictors of failure.

The blog post goes on to discuss a bit about what they think of some of the other fields, and why you might or might not want to pay attention to them. (For example, for data center drives that turn on & run for years, the #12 “power cycle count” should be very low and a high value suggests a problem, but for a normal consumer computer’s drive, the count is going to go up every time the computer gets turned off or (perhaps) the drive goes to sleep, so it may not be meaningful for regular people.)

The fun part is that not every drive reports all of these statistics. The drive I’m looking at — which cam with the computer — doesn’t report fields #187 and #188, for example. 

Good luck, and let me know if you have any questions. 


--
Chris Devers



____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: How to See SMART Status from Remote Login

Rodney

On Oct 3, 2016, at 17:14, Chris Devers <[hidden email]> wrote:

$ brew install smartmontools

I tried that and got:

rodneys-imac-1:~ Rodney$ brew install smartmontools
Warning: You have not agreed to the Xcode license.
Builds will fail! Agree to the license by opening Xcode.app or running:
    sudo xcodebuild -license

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
I launched the Xcode app and agreed to the license.  Then I got:
rodneys-imac-1:~ Rodney$ brew install smartmontools
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/smartmontools/6.3 --sbindir=/usr/local/Cellar/smartmontools/6.3/bin --sysconf
==> make install
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man8/smartctl.8
/usr/local/share/man/man8 is not writable.

You can try again using:
  brew link smartmontools
==> Summary
üç∫  /usr/local/Cellar/smartmontools/6.3: 32 files, 1.6M, built in 11 seconds

rodneys-imac-1:~ Rodney$ brew link smartmontools
Linking /usr/local/Cellar/smartmontools/6.3... 
Error: Could not symlink share/man/man8/smartctl.8
/usr/local/share/man/man8 is not writable.
I tried with sudo and got:
rodneys-imac-1:~ Rodney$ sudo brew link smartmontools
Password:
Error: Cowardly refusing to `sudo brew link`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

Did I miss something?



____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: How to See SMART Status from Remote Login

Chris Devers
On Mon, Oct 3, 2016 at 11:38 AM, Rodney <[hidden email]> wrote:

I tried that and got:
[…]

Well, now you’re in to Homebrew support questions, not SMART per se…

With Homebrew, escalating to “sudo” usually isn’t the right way to fix problems, because they’re going out of their way to minimize (and audit) the limited cases where root admin access is required. Basically, they get that privilege on initial installation, mainly so that they can give your regular account ownership of the /usr/local tree, and after that, Homebrew shouldn’t need root access anymore, because the software runs with your account access level, and if your account can write to those folders, then so can Homebrew. If something else wants root access, that something might be doing something naughty, so they try to protect you from this by “cowardly refusing” to run via sudo.

If the `brew` command hits errors, it’s often useful to run `brew doctor` to run an audit that might reveal misconfigurations that could lead to problems. 

I try that at the moment, and not much happens:

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.

Okay, fine, whatever.

$ brew update ; brew upgrade
Updated Homebrew from 58ffe34 to ea5aff8.
[…dozens of boring lines of upgrade stuff omitted…]

Ask the Doctor again:

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Your Xcode (7.3.1) is outdated.
Please update to Xcode 8.0 (or delete it).
Xcode can be updated from the App Store.

Okay, fine, whatever. I’ll upgrade Xcode later. 

In your case, my hunch is that it’s going to say that /usr/local has permissions &/or ownership that Brew doesn’t like. If so, the message it tells you should have enough detail to fix the problem, or you can paste it here and I can make suggestions.

In particular, this line —

/usr/local/share/man/man8 is not writable.

— is a big clue that the `brew` command wasn’t able to write into the /usr/local/share/man folder, which in turn implies that one or more parent folders might not be writable either. Follow `brew doctor`’s instructions for fixing that, and the `brew link …` command should work again.


--
Chris Devers



____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____