1. Duplicate source disk label to second disk
1.1 Dump source disk labels
# fmthard -i -n "" /dev/rdsk/c2t0d0s2 > d0# cat d0
* /dev/rdsk/c2t0d0s2 default partition map
* Volume Name: solaris
*
* Dimensions:
* 512 bytes/sector
* 625 sectors/track
* 20 tracks/cylinder
* 46875 cylinders
* 46873 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Partition Tag Flag First Sector Sector Count
0 2 00 12500 585900000
2 5 01 0 585912500
1.2 Write disk labels to new harddisk
# fmthard -s d0 -n "" /dev/rdsk/c2t1d0s2
# format c2t1d0
2. Attach a second disk to configure a mirrored root pool
# zpool attach rpool c2t0d0s0 c2t1d0s0
Make sure to wait until resilver is done before rebooting.
# zpool status
pool: rpool
state: DEGRADED
status: One or more devices is currently being resilvered. The pool will
continue to function in a degraded state.
action: Wait for the resilver to complete.
Run 'zpool status -v' to see device specific details.
scan: resilver in progress since Thu Apr 4 08:20:58 2013
16.3G scanned out of 209G at 79.5M/s, 0h41m to go
16.3G resilvered, 7.79% done
config:
NAME STATE READ WRITE CKSUM
rpool DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
c2t0d0s0 ONLINE 0 0 0
c2t1d0s0 DEGRADED 0 0 0 (resilvering)
errors: No known data errors
Keep checking rpool status until "DEGRADED" is changed to "ONLINE"
# zpool status rpool
pool: rpool
state: ONLINE
scan: resilvered 209G in 0h38m with 0 errors on Thu Apr 4 08:59:51 2013
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c2t0d0s0 ONLINE 0 0 0
c2t1d0s0 ONLINE 0 0 0
errors: No known data errors
3. Apply boot blocks to the second disk after resilvering is complete
Determine if needed from output of below command line.# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c2t1d0s0
WARNING: target device /dev/rdsk/c2t1d0s0 has a versioned bootblock but no versioning information was provided.
bootblock version installed on /dev/rdsk/c2t1d0s0 is more recent or identical
Use -F to override or install without the -u option
4. Test mirror
Destroy 2nd disk
# dd if=/dev/random of=/dev/rdsk/c2t1d0s2# zpool status -v
pool: rpool
state: DEGRADED
status: One or more devices are unavailable in response to persistent errors.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool clear' or 'fmadm repaired', or replace the device
with 'zpool replace'.
scan: resilvered 209G in 0h38m with 0 errors on Thu Apr 4 08:59:51 2013
config:
NAME STATE READ WRITE CKSUM
rpool DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
c2t0d0s0 ONLINE 0 0 0
c2t1d0s0 UNAVAIL 0 0 0
device details:
c2t1d0s0 UNAVAIL cannot open
status: ZFS detected errors on this device.
The device was missing.
see: http://support.oracle.com/msg/ZFS-8000-LR for recovery
Fix it
# fmthard -s d0 -n "" /dev/rdsk/c2t1d0s2
# zpool status -lx
pool: rpool
state: DEGRADED
status: One or more devices is currently being resilvered. The pool will
continue to function in a degraded state.
action: Wait for the resilver to complete.
Run 'zpool status -v' to see device specific details.
scan: resilver in progress since Thu Apr 11 14:20:56 2013
5.28G scanned out of 248G at 118M/s, 0h35m to go
5.28G resilvered, 2.13% done
config:
NAME STATE READ WRITE CKSUM
rpool DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
c2t0d0s0 ONLINE 0 0 0
c2t1d0s0 DEGRADED 0 0 0 (resilvering)
errors: No known data errors
Reference:
http://docs.oracle.com/cd/E19253-01/819-5461/gkdep/index.html
Reference: http://www.hacktopia.net/wp/how-to-mirror-zfs-root-disk-on-a-sparc-system/
No comments:
Post a Comment