# Trouble with zfs/zpool commands when importing broken HDD



## ag74 (Sep 1, 2014)

OK, so I have this dying WD20EARS (WD Green 2TB) drive that's previously been used in a RAIDZ1 pool but nowadays just kept for testing purposes. 

System is FreeBSD zorg 9.2-RELEASE-p5 FreeBSD 9.2-RELEASE-p5 #0: Tue Apr 29 19:09:13 UTC 2014 running on a dual-Xeon E5620, Intel S5520HC system. The built-in SATA controller is used.

At one point I created a pool (I think with feature flags, or possibly version 28) on it and now when I hot plug it through Raidsonic/Icy Box SATA enclosure, I get this in `dmesg`: 


```
ada2 at ata3 bus 0 scbus1 target 1 lun 0
ada2: <WDC WD20EARS-00MVWB0 51.0AB51> ATA-8 SATA 2.x device
ada2: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada2: 1907729MB (3907029168 512 byte sectors: 16H 63S/T 16383C)
ada2: quirks=0x1<4K>
ada2: Previously was known as ad7
GEOM: ada2: the primary GPT table is corrupt or invalid.
GEOM: ada2: using the secondary instead -- recovery strongly advised.
```

When I try `zpool import <poolname>`, I get this: 


```
(ada2:ata3:0:1:0): READ_DMA. ACB: c8 00 18 de 0c 40 00 00 00 00 34 00
(ada2:ata3:0:1:0): CAM status: ATA Status Error
(ada2:ata3:0:1:0): ATA status: 51 (DRDY SERV ERR), error: 40 (UNC )
(ada2:ata3:0:1:0): RES: 51 40 40 de 0c 00 00 00 00 03 00
(ada2:ata3:0:1:0): Retrying command
```

... repeating seemingly forever. So this disk is having some serious problems, no question about that. 

The problem/question here is, *how can I stop this import operation?* The whole ZFS subsystem appears to become inaccessible, i.e. I can't issue any other `zfs`/`zpool` commands while trying to import this broken pool. Eventually, I physically unplugged the drive; still no access to `zfs`/`zpool` commands. Appears to me I need to reboot the server to have it back to normal.


----------



## Sebulon (Sep 2, 2014)

*Re: Trouble with zfs/zpool commands when importing broken HD*

Hi @ag74!

If you run:
`# ps ax | grep 'zpool import'`

And find the process in a "D" state then yes, a reboot will be needed. Or if you try to pull the drive, the process may be dropped. I wouldn't try doing anything with drive afterwards either, more like a permanent transfer to nearest dust bin is more like it.

/Sebulon


----------



## ag74 (Sep 2, 2014)

*Re: Trouble with zfs/zpool commands when importing broken HD*

Thanks @Sebulon. Did some reading up on the D state and it sounds like a nasty condition to end up in. 

I promise I will never use this drive for anything other than learning what happens when a drive dies.


----------



## kpa (Sep 2, 2014)

*Re: Trouble with zfs/zpool commands when importing broken HD*

ZFS is quite unforgiving in this sense, there's no way interrupt (other than a hard reset) any of the fundamental operations like import if they get hung because of a hardware problem or some other problem like not enough memory for a pool that uses deduplication.


----------

