# ZFS bad hdd replacement



## Qaz (Sep 6, 2012)

Hello!

On one my servers I have one completely died HDD, I'm even can't seen them in system, just this:

```
pool: tank
  state: DEGRADED
 status: One or more devices could not be opened.  Sufficient replicas exist for
         the pool to continue functioning in a degraded state.
 action: Attach the missing device and online it using 'zpool online'.
    see: http://www.sun.com/msg/ZFS-8000-2Q
  scrub: none requested
 config:

         NAME        STATE     READ WRITE CKSUM
         tank        DEGRADED     0     0     0
           mirror    DEGRADED     0     0     0
             ad4p3   UNAVAIL      0     0     0  cannot open
             ad6p3   ONLINE       0     0     0

 errors: No known data errors

 atacontrol list
 ATA channel 2:
     Master:      no device present
     Slave:       no device present
 ATA channel 3:
     Master:  ad6 <ST3000DM001-9YN166/CC4C> SATA revision 2.x
     Slave:       no device present
```

And I just detach bad drive, and after reboot I add new drive to pool. Here it is:


```
pool: tank
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          ad6p3     ONLINE       0     0     0
          ad4       ONLINE       0     0     0

errors: No known data errors
```

But I think that this is does not right...can you tell me what is the right way? Thanx!


----------



## knarf (Sep 6, 2012)

You were using zpool add instead of zpool attach. In order to fix it, you will have to backup all the data and recreate the pool. 

I'd recommend using gpt labels in the future and partitions with a proper alignment for your 4K disks (keywords: gpart add -b 2048 ..., gnop, ashift=12).


----------



## Qaz (Sep 6, 2012)

Brilliant...ZFS rocks


----------



## phoenix (Sep 6, 2012)

Another reason to always read the man pages before trying things.


----------



## Crest (Sep 6, 2012)

The manpage clearly states the difference between zfs add and zfs attach/replace.


----------



## Sebulon (Sep 7, 2012)

Qaz said:
			
		

> Brilliant...ZFS rocks



ZFS only does *exactly* what *you* tell it to do.

Destroy. Erase. Improve.

/Sebulon


----------

