# Is this disk drive dying?

## tabanus

Getting lots of these errors in dmesg for a USB hard drive:

```
print_req_error: critical medium error, dev sdb, sector 326931328

[130106.313070] sd 4:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08

[130106.313079] sd 4:0:0:0: [sdb] tag#0 Sense Key : 0x3 [current] 

[130106.313085] sd 4:0:0:0: [sdb] tag#0 ASC=0x11 ASCQ=0x0 

[130106.313091] sd 4:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 02 a2 91 f1 00 00 01 00

[130106.313095] print_req_error: critical medium error, dev sdb, sector 353669000

[130125.033444] sd 4:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08

[130125.033453] sd 4:0:0:0: [sdb] tag#0 Sense Key : 0x3 [current] 

[130125.033459] sd 4:0:0:0: [sdb] tag#0 ASC=0x11 ASCQ=0x0 

[130125.033465] sd 4:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 02 a2 91 f1 00 00 01 00

[130125.033470] print_req_error: critical medium error, dev sdb, sector 353669000

[130584.848194] sd 4:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08

[130584.848204] sd 4:0:0:0: [sdb] tag#0 Sense Key : 0x3 [current] 

[130584.848209] sd 4:0:0:0: [sdb] tag#0 ASC=0x11 ASCQ=0x0 

[130584.848215] sd 4:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 02 28 41 33 00 00 01 00

[130584.848220] print_req_error: critical medium error, dev sdb, sector 289540504

[130600.534796] sd 4:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08

[130600.534805] sd 4:0:0:0: [sdb] tag#0 Sense Key : 0x3 [current] 

[130600.534810] sd 4:0:0:0: [sdb] tag#0 ASC=0x11 ASCQ=0x0 

[130600.534816] sd 4:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 02 28 41 33 00 00 01 00

[130600.534821] print_req_error: critical medium error, dev sdb, sector 289540504
```

This is a 1TB drive formatted with btrfs, and a btrfs check took >2 hours to complete, (this is a drive at work , and I got bored after 2 hours and went home, was finished in the morning), and found lots of errors.

So, dead or just btrfs corruption?

----------

## NeddySeagoon

tabanus,

It looks like the drive.

What does 

```
smartctl -a /dev/sdb
```

have to say?

It may not be useful because a lot of USB to SATA converters do not pass on the required SCSI commands.

Then its remove the drive from the enclosure and try it with a real SATA connector.

How sure do you want to be before you replace the drive?

A replacement drive probably costs less than one hour of your time.

----------

## tabanus

 *NeddySeagoon wrote:*   

> tabanus,
> 
> A replacement drive probably costs less than one hour of your time.

 

It's the time to deal with replacing the drive that costs me the most   :Wink: 

```
# smartctl -a /dev/sdb

smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.14.13-gentoo] (local build)

Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===

Model Family:     Seagate Barracuda 7200.14 (AF)

Device Model:     ST3000DM001-1ER166

Serial Number:    W500NTE0

LU WWN Device Id: 5 000c50 07cf82dc5

Firmware Version: CC45

User Capacity:    3,000,592,982,016 bytes [3.00 TB]

Sector Sizes:     512 bytes logical, 4096 bytes physical

Rotation Rate:    7200 rpm

Form Factor:      3.5 inches

Device is:        In smartctl database [for details use: -P show]

ATA Version is:   ACS-2, ACS-3 T13/2161-D revision 3b

SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 3.0 Gb/s)

Local Time is:    Sun May  6 22:17:00 2018 BST

SMART support is: Available - device has SMART capability.

SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===

SMART overall-health self-assessment test result: PASSED

See vendor-specific Attribute list for marginal Attributes.

General SMART Values:

Offline data collection status:  (0x00) Offline data collection activity

                                        was never started.

                                        Auto Offline Data Collection: Disabled.

Self-test execution status:      (   0) The previous self-test routine completed

                                        without error or no self-test has ever 

                                        been run.

Total time to complete Offline 

data collection:                (   89) seconds.

Offline data collection

capabilities:                    (0x73) SMART execute Offline immediate.

                                        Auto Offline data collection on/off support.

                                        Suspend Offline collection upon new

                                        command.

                                        No Offline surface scan supported.

                                        Self-test supported.

                                        Conveyance Self-test supported.

                                        Selective Self-test supported.

SMART capabilities:            (0x0003) Saves SMART data before entering

                                        power-saving mode.

                                        Supports SMART auto save timer.

Error logging capability:        (0x01) Error logging supported.

                                        General Purpose Logging supported.

Short self-test routine 

recommended polling time:        (   1) minutes.

Extended self-test routine

recommended polling time:        ( 325) minutes.

Conveyance self-test routine

recommended polling time:        (   2) minutes.

SCT capabilities:              (0x1085) SCT Status supported.

SMART Attributes Data Structure revision number: 10

Vendor Specific SMART Attributes with Thresholds:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE

  1 Raw_Read_Error_Rate     0x000f   072   071   006    Pre-fail  Always       -       70404960

  3 Spin_Up_Time            0x0003   094   093   000    Pre-fail  Always       -       0

  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       28

  5 Reallocated_Sector_Ct   0x0033   088   088   010    Pre-fail  Always       -       15832

  7 Seek_Error_Rate         0x000f   087   060   030    Pre-fail  Always       -       514625600

  9 Power_On_Hours          0x0032   069   069   000    Old_age   Always       -       27712

 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0

 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       22

183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0

184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0

187 Reported_Uncorrect      0x0032   001   001   000    Old_age   Always       -       19073

188 Command_Timeout         0x0032   100   095   000    Old_age   Always       -       49 87 89

189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0

190 Airflow_Temperature_Cel 0x0022   050   041   045    Old_age   Always   In_the_past 50 (Min/Max 24/59 #883)

191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0

192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       5

193 Load_Cycle_Count        0x0032   013   013   000    Old_age   Always       -       174484

194 Temperature_Celsius     0x0022   050   059   000    Old_age   Always       -       50 (0 15 0 0 0)

197 Current_Pending_Sector  0x0012   001   001   000    Old_age   Always       -       48904

198 Offline_Uncorrectable   0x0010   001   001   000    Old_age   Offline      -       48904

199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0

240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       7159h+38m+01.172s

241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       1953767264

242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       53739106

SMART Error Log Version: 1

ATA Error Count: 19015 (device log contains only the most recent five errors)

        CR = Command Register [HEX]

        FR = Features Register [HEX]

        SC = Sector Count Register [HEX]

        SN = Sector Number Register [HEX]

        CL = Cylinder Low Register [HEX]

        CH = Cylinder High Register [HEX]

        DH = Device/Head Register [HEX]

        DC = Device Command Register [HEX]

        ER = Error register [HEX]

        ST = Status register [HEX]

Powered_Up_Time is measured from power on, and printed as

DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,

SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 19015 occurred at disk power-on lifetime: 27711 hours (1154 days + 15 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  25 00 20 ff ff ff 4f 00  32d+09:11:50.658  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:47.082  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:43.473  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:36.255  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:32.680  READ DMA EXT

Error 19014 occurred at disk power-on lifetime: 27711 hours (1154 days + 15 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  25 00 20 ff ff ff 4f 00  32d+09:11:47.082  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:43.473  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:36.255  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:32.680  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:29.095  READ DMA EXT

Error 19013 occurred at disk power-on lifetime: 27711 hours (1154 days + 15 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  25 00 20 ff ff ff 4f 00  32d+09:11:43.473  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:36.255  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:32.680  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:29.095  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:25.495  READ DMA EXT

Error 19012 occurred at disk power-on lifetime: 27711 hours (1154 days + 15 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  25 00 20 ff ff ff 4f 00  32d+09:11:36.255  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:32.680  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:29.095  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:25.495  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:18.318  READ DMA EXT

Error 19011 occurred at disk power-on lifetime: 27711 hours (1154 days + 15 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  25 00 20 ff ff ff 4f 00  32d+09:11:32.680  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:29.095  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:25.495  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:18.318  READ DMA EXT

  25 00 20 ff ff ff 4f 00  32d+09:11:14.677  READ DMA EXT

SMART Self-test log structure revision number 1

No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 1

 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS

    1        0        0  Not_testing

    2        0        0  Not_testing

    3        0        0  Not_testing

    4        0        0  Not_testing

    5        0        0  Not_testing

Selective self-test flags (0x0):

  After scanning selected spans, do NOT read-scan remainder of disk.

If Selective self-test is pending on power-up, resume after 0 minute delay.
```

----------

## krinn

Well, what is the thing mechanical hdd hate the most? -> moving (heat is second)

USB drive is then technically the worst condition for an hdd (hence why many laptop use non mechanical hdd).

We know we should just never move them when running, and we know we should not shake them even when off (even heads are park).

But hey, we're bad boys aren't we?

You should try another backup solution than usb hdd, dunno, nas or a tiny file server, you'll save money with time.

If really you wish keep the drive as non backup but as a "hey i need move data sometimes", try pickup a 5400rpm drive, they (logically) are stronger vs shaking and users with Parkinson  :Wink: 

 *Quote:*   

> dead or just btrfs corruption?

 

nope and nope, some sectors are dead, hdd could survive that as long as you are able to tell the fs to avoid the bad sectors, so except if the fs table location sector are dead, drive could keep up while ignoring dead sectors.

You need to mark them, for a "carry data" drive, it will be ok

For a backup drive, it's no more reliable enough to keep using it for that mission.

----------

## NeddySeagoon

tabanus,

Those are real read errors on the drive.

Heres some interesting numbers.

```
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE

  5 Reallocated_Sector_Ct   0x0033   088   088   010    Pre-fail  Always       -       15832 

  9 Power_On_Hours          0x0032   069   069   000    Old_age   Always       -       27712

 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       22 

190 Airflow_Temperature_Cel 0x0022   050   041   045    Old_age   Always   In_the_past 50 (Min/Max 24/59 #883) 

193 Load_Cycle_Count        0x0032   013   013   000    Old_age   Always       -       174484 

197 Current_Pending_Sector  0x0012   001   001   000    Old_age   Always       -       48904 
```

The values in the VALUE WORST THRESH columns are normalised. If VALUE or WORST <= THRESH, the parameter has failed.

Here, Airflow_Temperature_Cel.

As drives age, they relocate hard to read sectors. This is indicated by the Reallocated_Sector_Ct. If the 15832 is real, thats a lot.

I say if its real as the RAW_VALUE if often from a packed bit field and not corrected for its offset.

The lowest value that can possibly be, if its from a bit field is 1979 and I never seen a drive with that many reallocated sectors ever.

The Current_Pending_Sector is a count of the sectors that drive would like to reallocate, if it could only read them. Again the RAW_VALUE may be a packed bit field.

The lower limit for that is 6113. This count is just the sectors that the drive has tried to read and failed. If you were to do a surface scan, that number may rise.

Even 1 Pending_Sector indicates the drive is scrap, as it can no longer read its own writing.

The rest is info only. 

The Power_Cycle_Count says that the drive has only been power cycled 22 times but the Load_Cycle_Count is 174484.

This tells that the drive has been spun down when not in use. That's a very bad thing for desktop hard drives and will shorten their lives.

----------

## tabanus

OK thanks guys. I'll get a new drive and replace it.

----------

