HEALTHY_DISK=/dev/sda
BROKEN_DISK=/dev/sdb
Make sure that the variables are correctly populated by executing this:
echo "HEALTHY_DISK: ${HEALTHY_DISK}"
echo "BROKEN_DISK: ${BROKEN_DISK}"
This should output
HEALTHY_DISK: /dev/sda
BROKEN_DISK: /dev/sdb
-
Check status
zpool status
-
List disks
lsblk | grep -v zd
-
Rescan partitions (if the disk was replaced while the system was online):
blockdev --rereadpt /dev/${BROKEN_DISK}
-
Copy partition layout from working disk to replaced disk:
sgdisk --backup=/tmp/sda.layout ${HEALTHY_DISK} sgdisk --load-backup=/tmp/sda.layout ${BROKEN_DISK}
-
Resilver disk:
FAILED_DISK_ID
can be an ID or just the partition number (when online replaced)NEW_DISK_ID
from the new disk or just the partition path (e.g./dev/sdb3
)
Recommended is to use the IDs. They can be found with:
ls -l /dev/disk/by-id/
zpool replace rpool <FAILED_DISK_ID> ${BROKEN_DISK}3
-
Copy data from BIOS boot partition to new one (if replaced disk was the boot disk):
dd if=${HEALTHY_DISK}1 of=${BROKEN_DISK}1 bs=512
-
Reinstall bootloader on replaced disk (if replaced disk was the boot disk):
GRUB
proxmox-boot-tool format ${BROKEN_DISK}2 --force proxmox-boot-tool init ${BROKEN_DISK}2 grub
systemd-boot
proxmox-boot-tool format ${BROKEN_DISK}2 --force proxmox-boot-tool init ${BROKEN_DISK}2
-
Update initramfs information (if replaced disk was the boot disk):
update-initramfs -u proxmox-boot-tool status
-
List ZFS status again:
zpool status