What is the procedure to replace failed HD in ZFS Raid Mirror conf?

yena

Renowned Member
Nov 18, 2011
385
6
83
Hello,
i have made a simple setup on a single server with 2 Hard disk,
Raid Z mirror.

Now i'm try to replace one of the two HD.

What is the right procedure when i replace it with the new one?

I have tried:

sgdisk -R /dev/sdnew /dev/sdb
sgdisk -G /dev/sdnew
dd if=/dev/sda1 of=/dev/sdnew1 bs=512
zpool detach rpool 15234235641392610364
zpool add -f rpool /dev/sdnew2
grub-install /dev/sdNew
update-grub
update-initramfs -u

but when i try to boot only with the new Hardisk i have this error:
error: no such device: 54d12b35e86bfda2.
Entering rescue mode ...
grub rescue>


Thanks!
 
Last edited:
zpool add was a very bad idea. That adds a new "raid0" vdev instead of mirror. The correct procedure is to do "zpool attach rpool /dev/sdb /dev/sdnew"
 
What is the right procedure when i replace it with the new one?


sgdisk -R /dev/sdnew /dev/sdb
sgdisk -G /dev/sdnew
-dd if=/dev/sda1 of=/dev/sdnew1 bs=512
-zpool detach rpool 15234235641392610364
-zpool add -f rpool /dev/sdnew2
+zpool replace pool sda1 sdnew1
grub-install /dev/sdNew
update-grub
update-initramfs -u