Replacing A zpool disk (Solaris ZSF)
A quick and dirty guide to replacing a faild rpool disk in a Solaris ZFS pool.
(rpool being a root pool )
This guide is geared towards a X86 root raid 1 mirror zfs pool disk. the process will be different for other setups (eg raidz or raid 0...)
PLEASE NOTE: this is a ruff and ready guide, i have quickly thrown it together, to remind my self. I will clean it up some day.
IF this busts you system its not my fault.
Check the status
# zpool status
Will look somehting liek this: pool: rpool state: ONLINE scrub: resilver completed after 0h3m with 0 errors on Mon Sep 28 16:52:43 2009 config: NAME STATE READ WRITE CKSUM rpool DEGRADED 0 0 0 mirror DEGRADED 0 0 0 c3t0d0s0 ONLINE 0 0 0 c3t1d0s0 FAILED 0 0 0 errors: No known data errors
Detatch the failed disk
# zpool detach rpool c3t1d0s0 (id of failed disk)
phasicaly replace faild disk
Create a new partision
# fdisk /dev/rdsk/c3t1d0p0
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. y
Format the new partision
copy the partisions table (slice table) from the working disk to the new disk
# prtvtoc /dev/rdsk/c3t0d0s2 |fmthard -s - /dev/rdsk/c3t1d0s2
Attach the new disk
- zpool attach -f rpool c3t0d0s0 c3t1d0s0
Check the status of the new disk
- zpool status
pool: rpool state: ONLINE status: One or more devices is currently being resilvered. The pool will continue to function, possibly in a degraded state. action: Wait for the resilver to complete. scrub: resilver in progress for 0h0m, 0.49% done, 0h40m to go config: NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 mirror ONLINE 0 0 0 c3t0d0s0 ONLINE 0 0 0 c3t1d0s0 ONLINE 0 0 0 errors: No known data errors