# zfs replacing a drive



## william21 (Sep 28, 2012)

Could some please confirm the steps too replace ad8 in this pool please no hot swap. The machine will be shutdown and the failing drive changed


```
bsd# zpool status
  pool: tank
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          mirror    ONLINE       0     0     0
            ad8     ONLINE       0     0     0
            ad10    ONLINE       0     0     0

errors: No known data errors
```

FreeBSD 7.1-RELEASE (GENERIC) 

I have googled but things are still a bit unclear
Thank you


----------



## gkontos (Sep 28, 2012)

http://bit.ly/Sguzub


----------



## usdmatt (Sep 28, 2012)

I would offline the failing disk, install new disk then replace:


```
# zpool offline tank ad10
... reboot and replace ...
# zpool replace tank ad10
```

This assumes that it's ad10 that's failing and that the new disk gets the same device name. If the device name changes the replace command needs to be slightly different:


```
# zpool replace tank ad10 {newdevice}
```

You could also 'detach' the failing disk, effectively making your pool a single unmirrored disk, then attach the new disk making it back into a mirror, I'd probably just use the offline/replace method though.


```
# zpool detach tank ad10
... pool is now a single disk ...
... reboot and replace disk ...
# zpool attach tank ad8 {newdevice}
```


----------

