创建一个mirror的pool
root@sparcvm:~# zpool create datapool mirror c0t5000CCA07D067040d0 c0t5000CCA07D067F28d0 root@sparcvm:~# zpool status datapool pool: datapool state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM datapool ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 c0t5000CCA07D067040d0 ONLINE 0 0 0 c0t5000CCA07D067F28d0 ONLINE 0 0 0 errors: No known data errors root@sparcvm:~# root@sparcvm:~# zfs mount rpool/ROOT/solaris / rpool/ROOT/solaris/var /var rpool/VARSHARE /var/share rpool/export /export rpool/export/home /export/home rpool /rpool rpool/VARSHARE/zones /system/zones rpool/VARSHARE/pkg /var/share/pkg rpool/VARSHARE/pkg/repositories /var/share/pkg/repositories datapool /datapool root@sparcvm:~# root@sparcvm:~$ zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT datapool 556G 94K 556G 0% 1.00x ONLINE - rpool 556G 179G 377G 32% 1.00x ONLINE - root@sparcvm:~$
为系统盘做镜像,ZFS镜像就相当于RAID1,这个很方便
root@sparcvm:~# zpool attach rpool c0t5000CCA07D067838d0 c0t5000CCA07D0681E0d0 Make sure to wait until resilver is done before rebooting. root@sparcvm:~# zpool status -v 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. scan: resilver in progress since Tue Mar 28 20:47:51 2017 134G scanned 113G resilvered at 199M/s, 84.04% done, 1m50s to go config: NAME STATE READ WRITE CKSUM rpool DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 c0t5000CCA07D067838d0 ONLINE 0 0 0 c0t5000CCA07D0681E0d0 DEGRADED 0 0 0 (resilvering) device details: c0t5000CCA07D0681E0d0 DEGRADED scrub/resilver needed status: ZFS detected errors on this device. The device is missing some data that is recoverable. see: http://support.oracle.com/msg/ZFS-8000-QJ for recovery
errors: No known data errors
在resilver完成之前,ILOM会报错,完成之后,错误消失
SUNW-MSG-ID: ZFS-8000-QJ, TYPE: Fault, VER: 1, SEVERITY: Minor EVENT-TIME: Wed Mar 29 20:57:40 CST 2017 PLATFORM: SPARC S7-2, CSN: AK99999999, HOSTNAME: sparcvm SOURCE: zfs-diagnosis, REV: 1.0 EVENT-ID: ef930420-4f99-413d-863c-a8186ae1282e DESC: Missing data on ZFS device 'id1,sd@n5000cca07d0681e0/a' in pool 'rpool'. Applications are unaffected if sufficient replicas exist. AUTO-RESPONSE: An attempt will be made automatically to recover the data. The device and pool will be degraded. IMPACT: The device and pool may continue functioning in degraded state until data is recovered.
查看pool的状态
root@sparcvm:~# zpool status
root@sparcvm:~# zpool status pool: rpool state: ONLINE scan: resilvered 134G in 11m51s with 0 errors on Tue Mar 28 20:59:42 2017 config: NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 c0t5000CCA07D067838d0 ONLINE 0 0 0 c0t5000CCA07D0681E0d0 ONLINE 0 0 0 errors: No known data errors root@sparcvm:~#
root@sparcvm:~# bootadm install-bootloader -P rpool
root@sparcvm:~# prtconf -vp | grep bootpath
Reference
http://docs.oracle.com/cd/E56344_01/html/E54077/zpool-1m.html