电脑技术学习

solaris raid 制作大集合

dn001
在操作系统安装结束后
安装DiskSuite_4.2.1软件及相关补丁
以下以实力的方式介绍“引导盘镜像操作”
例子中操作系统分区定义如下:
c0t0d0s0 /
c0t0d0s1 swap
c0t0d0s3 /var
c0t0d0s4 (metaDB*3)
c0t0d0s5 /opt
c0t0d0s6 /usr
c0t0d0s7 /export/home
用root用户登陆
运行以下命令:
# prtvtoc /dev/rdsk/c0t0d0s2 > boot-vtoc.tab
# fmthard -s boot-vtoc.tab /dev/rdsk/c0t1d0s2
以上命令将第2硬盘的文件分区表调整为和引导盘一致
运行以下命令:
# metadb -afc 3 c0t0d0s4
# metadb -afc 3 c0t1d0s4
# metainit -f d21 1 1 c0t0d0s0
# metainit d22 1 1 c0t1d0s0
# metainit -f d24 1 1 c0t0d0s1
# metainit d25 1 1 c0t1d0s1
# metainit -f d27 1 1 c0t0d0s3
# metainit d28 1 1 c0t1d0s3
# metainit -f d31 1 1 c0t0d0s5
# metainit d32 1 1 c0t1d0s5
# metainit -f d34 1 1 c0t0d0s6
# metainit d35 1 1 c0t1d0s6
# metainit -f d37 1 1 c0t0d0s7
# metainit d38 1 1 c0t1d0s7

# metainit d20 -m d21
# metainit d23 -m d24
# metainit d26 -m d27
# metainit d30 -m d31
# metainit d33 -m d34
# metainit d36 -m d37

# metaroot d20
# lockfs -fa

修改/etc/vfstab文件为如下:

#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -

#/dev/dsk/c0t0d0s3 - - swap - no -
/dev/md/dsk/d26 - - swap - no -

#/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -
/dev/md/dsk/d20 /dev/md/rdsk/d20 / ufs 1 no -

#/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6 /usr ufs 1 no -
/dev/md/dsk/d33 /dev/md/rdsk/d33 /usr ufs 1 no -

#/dev/dsk/c0t0d0s1 /dev/rdsk/c0t0d0s1 /var ufs 1 no -
/dev/md/dsk/d23 /dev/md/rdsk/d23 /var ufs 1 no -

#/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs 2 yes -
/dev/md/dsk/d36 /dev/md/rdsk/d36 /export/home ufs 2 yes -

#/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /opt ufs 2 yes -
/dev/md/dsk/d30 /dev/md/rdsk/d30 /opt ufs 2 yes -

swap - /tmp tmpfs - yes -

至此,引导盘镜像操作的第一步完成

运行以下命令重新引导操作系统

# sync
# sync
# sync
# reboot

做数据同步
# metattach d20 d22
# metattach d23 d25
# metattach d26 d28
# metattach d30 d32
# metattach d33 d35
# metattach d36 d38
以上步骤执行时间较长


主引导盘损坏的恢复(主引导盘为c0t0d0)
删除损坏的replicas
# metadb -i #查看状态
# metadb -d c0t0d0s4 #删除replicas
停机,换盘
# sync
# sync
# init 5

从备用盘引导系统(使用Stop+A 使系统进入ok状态)
ok boot disk1
设置新盘分区
# prtvtoc /dev/rdsk/c0t1d0s2 > boot-vtoc.tab
# fmthard -f boot-vtoc.tab /dev/rdsk/c0t0d0s2
再创建replicas
# metadb -afc 3 c0t0d0s4
重连接新设备到主mirror,并同步
# metareplace -e d20 c0t0d0s0
d20: device c0t0d0s0 is enabled
# metareplace -e d23 c0t0d0s1
d20: device c0t0d0s1 is enabled
# metareplace -e d26 c0t0d0s3
d20: device c0t0d0s3 is enabled
# metareplace -e d30 c0t0d0s5
d20: device c0t0d0s5 is enabled
# metareplace -e d33 c0t0d0s6
d20: device c0t0d0s6 is enabled
# metareplace -e d36 c0t0d0s7
d20: device c0t0d0s7 is enabled
以上步骤执行时间较长

好,我就搞个
raid 0 +1
metainit d1 1 3 c0t1d0s0 c0t2d0s0 c0t3d0s0
metainit d2 1 3 c0t4d0s0 c0t5d0s0 c0t6d0s0
# metainit d0 -m d1
# metattach d0 d2

raid 1 +0
metainit d1 3 1 c0t1d0s0 1 c0t2d0s0 1 c0t3d0s0
metainit d2 3 1 c0t4d0s0 1 c0t5d0s0 1 c0t6d0s0
# metainit d0 -m d1
# metattach d0 d2

raid 5比较简单
# metainit d0 -r 1 6 c0t1d0s0 1 c0t2d0s0 1 c0t3d0s0 c0t4d0s0 1 c0t5d0s0 1 c0t6d0s0


Stripe

This example shows a metadevice, /dev/md/dsk/d15, consisting of two slices.

# metainit d15 1 2 c0t1d0s2 c0t2d0s2 -i 32k

The number 1 indicates that one stripe is being created.
Because the stripe is made of two slices, the number 2 fol-
lows next. The optional -i followed by 32k specifIEs the
interlace size as 32 Kbytes. If the interlace size were not
specified, the stripe would use the default value of 16
Kbytes.

本楼文章来自man metainit.试译如下:
条带(raid 0)
这个例子显示了由两个分区组成的raid0硬盘设备: /dev/md/dsk/d15。
命令是:metainit d15 1 2 c0t1d0s2 c0t2d0s2 -i 32k
数字1表示一个条带区被创建。数字2表示这个条带由两个磁盘分区组成。
选项-i和紧跟的32k,表示条带在磁盘上使用时是以32k为单位。不加此选项则系统会使用缺省的16k为单位。

标签: