一般呢,在Sun的X86和Spark平台,我们不做物理上的RAID1来做磁盘镜像,为什么呢,有个好处,在打补丁之前,我们为了能更好的fallback,我们一般在物理上把一个硬盘拔掉,这样在打补丁以后发现对应用程序有影响,我们可以用另一个硬盘作回滚操作,但是用了软件层面的镜像的话,就不需要拔掉其中一块硬盘,只需要在系统里把其中的一块拿掉就可以了,在这里我写一下如何用SVM(Solaris Volume Manager )来对两块硬盘作镜像。我们假定两块磁盘分别为c1t0d0 & c1t1d0,确保你Slot7有50M-100M的预留空间给meta DB.
# Partition 2nd disk as the layout of 1st disk
prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
# Create metadatabase in slice 7 of both of the disks
metadb -a -c 3 -f c1t0d0s7 c1t1d0s7
# For /
metainit -f d10 1 1 c1t0d0s0
metainit -f d20 1 1 c1t1d0s0
metainit d0 -m d10
metaroot d0
init 6
# For swap
metainit -f d11 1 1 c1t0d0s1
metainit -f d21 1 1 c1t1d0s1
metainit d1 -m d11
# For /var
metainit -f d13 1 1 c1t0d0s3
metainit -f d23 1 1 c1t1d0s3
metainit d3 -m d13
# For /opt
metainit -f d14 1 1 c1t0d0s4
metainit -f d24 1 1 c1t1d0s4
metainit d4 -m d14
# For /home
metainit -f d15 1 1 c1t0d0s5
metainit -f d25 1 1 c1t1d0s5
metainit d5 -m d15
# For /appvol
metainit -f d16 1 1 c1t0d0s6
metainit -f d26 1 1 c1t1d0s6
metainit d6 -m d16
echo "set md:mirrored_root_flag=1" >> /etc/system
vi /etc/vfstab
init 6
# The following will sync the 1st disk to 2nd disk, DO NOT REBOOT the machine during synchronization
installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0
metattach d0 d20
metattach d1 d21
metattach d3 d23
metattach d4 d24
metattach d5 d25
metattach d6 d26
dumpadm -d /dev/md/dsk/d1
metaparam -p 0 /dev/md/dsk/d1
# Check the sync progress with the following command
while :; do metastat | grep "Resync in progress" ; date ; sleep 60 ; done