镜像规划
镜像名 | 源盘子镜像名 | 源盘分区名 | 镜像盘子镜像名 | 镜像盘分区名 | 挂载点 |
d10 | d11 | c1t0d0s0 | d12 | c1t1d0s0 | / |
d20 | d21 | c1t0d0s1 | d22 | c1t1d0s1 | swap |
state database replica存放在两块盘的slice 7上。
1. 将源盘分区表同步到镜像盘上
root@node1:/ #> prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
2. 创建metadb数据库,分别存放在两块盘的slice7上
root@node1:/ #> metadb -a -c 3 -f c1t0d0s7 c1t1d0s7
root@node1:/ #> metadb -i
flags first blk block count
a u 16 8192 /dev/dsk/c1t0d0s7
a u 8208 8192 /dev/dsk/c1t0d0s7
a u 16400 8192 /dev/dsk/c1t0d0s7
a u 16 8192 /dev/dsk/c1t1d0s7
a u 8208 8192 /dev/dsk/c1t1d0s7
a u 16400 8192 /dev/dsk/c1t1d0s7
r - replica does not have device relocation information
o - replica active prior to last mddb configuration change
u - replica is up to date
l - locator for this replica was read successfully
c - replica's location was in /etc/lvm/mddb.cf
p - replica's location was patched in kernel
m - replica is master, this is replica selected as input
W - replica has device write errors
a - replica is active, commits are occurring to this replica
M - replica had problem with master blocks
D - replica had problem with data blocks
F - replica had format problems
S - replica is too small to hold current data base
R - replica had device read errors
3. 创建root分区的子镜像
root@node1:/ #> metainit -f d11 1 1 c1t0d0s0
d11: Concat/Stripe is setup
root@node1:/ #> metainit -f d12 1 1 c1t1d0s0
d12: Concat/Stripe is setup
4. 创建root分区镜像
root@node1:/ #> metainit d10 -m d11
d10: Mirror is setup
5. 执行metaroot修改vfstab记录
root@node1:/ #> metaroot d10
root@node1:/ #> more /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c1t0d0s1 - - swap - no -
/dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no -
/devices - /devices devfs - no -
ctfs - /system/contract ctfs - no -
objfs - /system/object objfs - no -
swap - /tmp tmpfs - yes -
root@node1:/ #>
6. 重启系统
root@node1:/ #> shutdown -i6 -g0 -y
Shutdown started. Wed Nov 23 15:34:19 CST 2011
Changing to init state 6 - please wait
Broadcast Message from root (pts/1) on node1 Wed Nov 23 15:34:19...
THE SYSTEM node1 IS BEING SHUT DOWN NOW ! ! !
Log off now or risk your files being damaged
7. 创建swap的子镜像和镜像
root@node1:/ #> metainit -f d21 1 1 c1t0d0s1
d21: Concat/Stripe is setup
root@node1:/ #> metainit -f d22 1 1 c1t1d0s1
d22: Concat/Stripe is setup
root@node1:/ #> metainit d20 -m d21
d20: Mirror is setup
8. 手工修改vfstab文件
修改前:
root@node1:/ #> more /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c1t0d0s1 - - swap - no -
/dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no -
/devices - /devices devfs - no -
ctfs - /system/contract ctfs - no -
objfs - /system/object objfs - no -
swap - /tmp tmpfs - yes -修改后:
root@node1:/ #> more /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/md/dsk/d20 - - swap - no -
/dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no -
/devices - /devices devfs - no -
ctfs - /system/contract ctfs - no -
objfs - /system/object objfs - no -
swap - /tmp tmpfs - yes -
9. 重启系统
root@node1:/ #> shutdown -i6 -g0 -y
Shutdown started. Wed Nov 23 15:34:19 CST 2011
Changing to init state 6 - please wait
Broadcast Message from root (pts/1) on node1 Wed Nov 23 15:34:19...
THE SYSTEM node1 IS BEING SHUT DOWN NOW ! ! !
Log off now or risk your files being damaged
10. 附加镜像盘所有分区的子镜像
root@node1:/ #> metattach d10 d12
d10: submirror d12 is attached
root@node1:/ #> metattach d20 d22
d20: submirror d22 is attached
同步在后台自动运行。可用metastat检查同步情况
root@node1:/ #> metastat
d20: Mirror
Submirror 0: d21
State: Okay
Submirror 1: d22
State: Resyncing
Resync in progress: 69 % done
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 16790400 blocks (8.0 GB)d21: Submirror of d20
State: Okay
Size: 16790400 blocks (8.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s1 0 No Okay Yesd22: Submirror of d20
State: Resyncing
Size: 16790400 blocks (8.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t1d0s1 0 No Okay Yesd10: Mirror
Submirror 0: d11
State: Okay
Submirror 1: d12
State: Resyncing
Resync in progress: 3 % done
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 269684352 blocks (128 GB)d11: Submirror of d10
State: Okay
Size: 269684352 blocks (128 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 0 No Okay Yesd12: Submirror of d10
State: Resyncing
Size: 269684352 blocks (128 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t1d0s0 0 No Okay YesDevice Relocation Information:
Device Reloc Device ID
c1t1d0 Yes id1,sd@n5000cca000902554
c1t0d0 Yes id1,sd@n5000cca0008f8bd8
11. 将set md:mirrored_root_flag = 1加入到/etc/system中。设置此参数可以使SVM启动时忽略Quorum规则,避免当Quorum<=50%时,系统无法启动到多用户模式。(SUN不建议设置此参数)