# zpool replace after device reordering



## absduser (Sep 6, 2017)

I'm curious how I'd go about solving this puzzle:

A raidz3 zpool with several vdevs had a drive go bad, and it was removed via:


```
zpool offline tank da25
```

THEN, while the system was offline and the drive was replaced and before the zpool was brought back online we noticed the drive identification was off: what we thought was da4 was actually da5, etc. So we got that fixed in the usual way (via /boot/loader.conf hints) and brought the zpool back online. 

At this point, the replacement drive is now da26, and the old da24 is now da25:


```
da24                 ONLINE       0     0     0
            da25                 ONLINE       0     0     0
            6211956789331675853  OFFLINE      0     0     0  was /dev/da25
            da27                 ONLINE       0     0     0
            da28                 ONLINE       0     0     0
```

And when trying to replace the drive we get an error:


```
# zpool replace tank da26
cannot replace da26 with da26: no such device in pool
```

I believe this would be bad as it would replace the existing, good, in-use da25 with da26:


```
zpool replace tank da25 da26
```

I *think* this could be solved with a:


```
zpool export tank
zpool import tank

zpool replace tank da26
```

but I'd like confirmation or advice on this strategy.

Thanks!


----------



## ekingston (Sep 6, 2017)

I think you need to use


```
zpool replace tank 6211956789331675853 da26
```

You use the big long number to replace offline drives.

See section 19.3.6 in the handbook. https://www.freebsd.org/doc/handbook/zfs-zpool.html


----------



## phoenix (Sep 7, 2017)

Yeah, you need to use the identifier listed in the zpool output. da26 isn't listed, so you can't use that as the original disk to be replaced. Instead, you have to use the ZFS uuid of the disk, as shown in the post above.


----------

