The post describes steps to replace a failed disk in rpool for x86 based systems. Assuming c0t0d0 and c0t1d0 are mirrored in the ZFS rpool, and c0t1d0 need to be replaced.
1. As shown in the output below, c0t1d0 need to be replaced as it is having a lot of errors.
# iostat -En ... c0t1d0 Soft Errors: 0 Hard Errors: 35 Transport Errors: 137630 Vendor: SEAGATE Product: ST914602SSUN146G Revision: 0400 Serial No: 071791R032 Size: 146.81GB <146810535936 bytes> ...
The spool status command will also show the disk as faulted with “too many errors” status.
# zpool status -v ... c0t1d0s0 FAULTED 3 6.71K 0 too many errors ...
2. Before we replace the failed disk, we have to remove it from the rpool. Use the “zfs detach” command to remove the disk from ZFS control.
# zpool detach rpool c0t1d0s0
3. Perform physical replacement as follows:
# cfgadm -al ... c1::dsk/c0t1d0 disk connected configured unknown
# cfgadm -c unconfigure c0::dsk/c0t1d0 CAUTION for any hardware requirement: Physically replace the drive
4. Check if there are some remaining device.
# ls -l /dev/dsk/c0t1d0s0
If yes clean the device tree with “devfsadm” command.
# devfsadm -Cv
5. Insert the new disk physically. The Solaris disk configuration should be automatically done. If required you can run the “devfsadm” command. Verify the new disk with format or cfgadm commands.
# devfsadm # cfgadm -al # echo | format
6. Label new disk with fdisk and format -e (choose “SMI label” under “label” entry)
# fdisk /dev/rdsk/c0t1d0s2 No fdisk table exists. The default partition for the disk is: a 100% "SOLARIS System" partition Type "y" to accept the default partition, otherwise type "n" to edit the partition table. Then choose "y"
fdisk option can also be use with :
# fdisk /dev/rdsk/c0t1d0p0
This change can be done using fdisk under “format -e” as well.
# format -e c0t1d0 format> fdisk ...
Then change the label if needed.
# format -e c0t1d0 format> label  SMI Label  EFI Label Specify Label type:
6. Create partitioning by copying the partition table from the existing disk to the new disk.
# prtvtoc -s /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2
7. Re-attach the sub-mirror
# zpool attach rpool c0t0d0s0 c0t1d0s0
8. Let ZFS resilver the newly attached mirror.
# zpool status -v
9. Install the boot loader in the replaced disk
# installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t1d0s0