[one-liner]: Checking out a HDD’s Health using the Command Line Tool udisk

Background

Here’s a quick tip for checking out the overall health of your computer’s hard drive. It makes use of a little known tool called udisks which provides access to information about storage devices from the D-Bus interface.

Solution

Before we jump into udisks here are some resources that might prove useful when dealing with the design/architecture of udisks.

To see which drives are currently under udisks watchful eye, you can use the following command:

1
2
3
4
5
6
7
8
9
10
11
12
% sudo udisks --enumerate
/org/freedesktop/UDisks/devices/dm_2d0
/org/freedesktop/UDisks/devices/dm_2d1
/org/freedesktop/UDisks/devices/dm_2d2
/org/freedesktop/UDisks/devices/sda1
/org/freedesktop/UDisks/devices/sda2
/org/freedesktop/UDisks/devices/sda3
/org/freedesktop/UDisks/devices/sda4
/org/freedesktop/UDisks/devices/sda5
/org/freedesktop/UDisks/devices/sda6
/org/freedesktop/UDisks/devices/sr0
/org/freedesktop/UDisks/devices/sda

This output shows that I have several partitions that are currently bing monitored, the last bit in the path tells you which device, i.e. sda1, sda2, sda3, etc. These are partitions /dev/sda1, /dev/sda2, etc.

Now on to the actual health output. This next command will show you the overall health of device /dev/sda, i.e. my primary HDD on my laptop:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
udisks --show-info /dev/sda
Showing information for /org/freedesktop/UDisks/devices/sda
  native-path:                 /sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
  device:                      8:0
  device-file:                 /dev/sda
    presentation:              /dev/sda
    by-id:                     /dev/disk/by-id/ata-ST9500420AS_5VJ9H3BY
    by-id:                     /dev/disk/by-id/scsi-SATA_ST9500420AS_5VJ9H3BY
    by-id:                     /dev/disk/by-id/wwn-0x5000c5002ed97512
    by-path:                   /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
  detected at:                 Mon 15 Apr 2013 01:00:39 PM EDT
  system internal:             1
  removable:                   0
  has media:                   1 (detected at Mon 15 Apr 2013 01:00:39 PM EDT)
    detects change:            0
    detection by polling:      0
    detection inhibitable:     0
    detection inhibited:       0
  is read only:                0
  is mounted:                  0
  mount paths:             
  mounted by uid:              0
  presentation hide:           0
  presentation nopolicy:       0
  presentation name:           
  presentation icon:           
  size:                        500107862016
  block size:                  512
  job underway:                no
  usage:                       
  type:                        
  version:                     
  uuid:                        
  label:                       
  partition table:
    scheme:                    mbr
    count:                     6
  drive:
    vendor:                    ATA
    model:                     ST9500420AS
    revision:                  0003LV1M
    serial:                    5VJ9H3BY
    WWN:                       5000c5002ed97512
    detachable:                0
    can spindown:              1
    rotational media:          Yes, at 7200 RPM
    write-cache:               enabled
    ejectable:                 0
    adapter:                   /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2
    ports:
      /org/freedesktop/UDisks/adapters/0000_3a00_3a1f_2e2/host0
    similar devices:
    media:                     
      compat:                 
    interface:                 ata
    if speed:                  (unknown)
    ATA SMART:                 Updated at Mon 15 Apr 2013 09:26:39 PM EDT
      overall assessment:      Good
===============================================================================
 Attribute       Current|Worst|Threshold  Status   Value       Type     Updates
===============================================================================
 raw-read-error-rate         104| 99| 34   good    6520505     Pre-fail Online 
 spin-up-time                100| 99|  0    n/a    0           Pre-fail Online 
 start-stop-count             98| 98| 20   good    2785        Old-age  Online 
 reallocated-sector-count    100|100| 36   good    0 sectors   Pre-fail Online 
 seek-error-rate              72| 60| 30   good    25872919731 Pre-fail Online 
 power-on-hours               89| 89|  0    n/a    424.5 days  Old-age  Online 
 spin-retry-count            100|100| 97   good    0           Pre-fail Online 
 power-cycle-count            98| 98| 20   good    2753        Old-age  Online 
 attribute-184               100|100| 99   good    0           Old-age  Online 
 reported-uncorrect          100|100|  0    n/a    0 sectors   Old-age  Online 
 attribute-188               100| 96|  0    n/a    0           Old-age  Online 
 high-fly-writes             100|100|  0    n/a    0           Old-age  Online 
 airflow-temperature-celsius  58| 42| 45 FAIL_PAST 42C / 108F  Old-age  Online 
 g-sense-error-rate          100|100|  0    n/a    124         Old-age  Online 
 power-off-retract-count     100|100|  0    n/a    15          Old-age  Online 
 load-cycle-count              1|  1|  0    n/a    248327      Old-age  Online 
 temperature-celsius-2        42| 58|  0    n/a    42C / 108F  Old-age  Online 
 hardware-ecc-recovered       44| 38|  0    n/a    6520505     Old-age  Online 
 reallocated-event-count      89| 89| 30   good    79886391715520 Pre-fail Online 
 current-pending-sector      100|100|  0    n/a    0 sectors   Old-age  Online 
 offline-uncorrectable       100|100|  0    n/a    0 sectors   Old-age  Offline
 udma-crc-error-count        200|200|  0    n/a    0           Old-age  Online 
 attribute-254               100|100|  0    n/a    0           Old-age  Online

One thing to note, my HDD is essentially overheating at 58 degrees celcius while threshold for that value is suppose to be 45 degrees celcius. Might need to think about replacing it some time soon 8-).

Here’s another way to get just the health information using the –dump switch instead.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% udisks --dump | grep -A 24 Updates
 
 Attribute       Current|Worst|Threshold  Status   Value       Type     Updates
===============================================================================
 raw-read-error-rate         103| 99| 34   good    6214810     Pre-fail Online 
 spin-up-time                100| 99|  0    n/a    0           Pre-fail Online 
 start-stop-count             98| 98| 20   good    2785        Old-age  Online 
 reallocated-sector-count    100|100| 36   good    0 sectors   Pre-fail Online 
 seek-error-rate              72| 60| 30   good    25872903767 Pre-fail Online 
 power-on-hours               89| 89|  0    n/a    424.4 days  Old-age  Online 
 spin-retry-count            100|100| 97   good    0           Pre-fail Online 
 power-cycle-count            98| 98| 20   good    2753        Old-age  Online 
 attribute-184               100|100| 99   good    0           Old-age  Online 
 reported-uncorrect          100|100|  0    n/a    0 sectors   Old-age  Online 
 attribute-188               100| 96|  0    n/a    0           Old-age  Online 
 high-fly-writes             100|100|  0    n/a    0           Old-age  Online 
 airflow-temperature-celsius  58| 42| 45 FAIL_PAST 42C / 108F  Old-age  Online 
 g-sense-error-rate          100|100|  0    n/a    124         Old-age  Online 
 power-off-retract-count     100|100|  0    n/a    15          Old-age  Online 
 load-cycle-count              1|  1|  0    n/a    248327      Old-age  Online 
 temperature-celsius-2        42| 58|  0    n/a    42C / 108F  Old-age  Online 
 hardware-ecc-recovered       44| 38|  0    n/a    6214810     Old-age  Online 
 reallocated-event-count      89| 89| 30   good    181604102186687 Pre-fail Online 
 current-pending-sector      100|100|  0    n/a    0 sectors   Old-age  Online 
 offline-uncorrectable       100|100|  0    n/a    0 sectors   Old-age  Offline
 udma-crc-error-count        200|200|  0    n/a    0           Old-age  Online 
 attribute-254               100|100|  0    n/a    0           Old-age  Online

References

links
local copies

NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.

This entry was posted in HDD, linux, monitoring, one-liner, performance, Syndicated, sysadmin, tips & tricks. Bookmark the permalink.

Comments are closed.