Friday, November 24, 2006

Solaris: DiskSuite OS Mirror

這個範例 好處是 Mirror 可以做的很漂亮
老實說不太喜歡用 GUI 拉出來的結果

由於 UFS 的限制 只能有 8 個 Slice
所以扣掉 swap metadb 及 slice2 就只能切 5 個
這邊我是切了 /, /var, /opt, /usr, /export/home

There are two disk c0t0d0 and c0t1d0
After install DiskSuite_4.2.1 and patch

Following is the file system layout.
c0t0d0s0 /
c0t0d0s1 swap
c0t0d0s3 /var
c0t0d0s4 (metaDB*3)
c0t0d0s5 /opt
c0t0d0s6 /usr
c0t0d0s7 /export/home

Meta Device Map

mirror c0t0d0 c0t1d0
s0 d0 d10 d20
s1 d1 d11 d21
s2 d2 d12 d22
s3 d3 d13 d23
s5 d5 d15 d25
s6 d6 d16 d26
s7 d7 d17 d27

Login as root

a. dump c0t0d0 to c0t1d0

# prtvtoc /dev/rdsk/c0t0d0s2 > boot-vtoc.tab
# fmthard -s boot-vtoc.tab /dev/rdsk/c0t1d0s2

you can combind the two command
prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2

b. create metadb
# metadb -afc 3 c0t0d0s4
# metadb -afc 3 c0t1d0s4

c. create meta device

# metainit -f d1 1 1 c0t0d0s0
# metainit -f d1 1 1 c0t0d0s1
# metainit -f d3 1 1 c0t0d0s3
# metainit -f d5 1 1 c0t0d0s5
# metainit -f d6 1 1 c0t0d0s6
# metainit -f d7 1 1 c0t0d0s7

# metainit d20 1 1 c0t1d0s0
# metainit d21 1 1 c0t1d0s1
# metainit d23 1 1 c0t1d0s3
# metainit d25 1 1 c0t1d0s5
# metainit d26 1 1 c0t1d0s6
# metainit d27 1 1 c0t1d0s7


# metainit d0 -m d10
# metainit d1 -m d 11
# metainit d3 -m d 13
# metainit d5 -m d 15
# metainit d6 -m d 16
# metainit d7 -m d 17
# metaroot d0
# lockfs -fa

d. modify /etc/vfstab with using meta device
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
#/dev/dsk/c0d0s2 /dev/rdsk/c0d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
#/dev/dsk/c0t0d0s1 - - swap - no -
/dev/md/dsk/d1 - - swap - no -
#/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -
#/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6 /usr ufs 1 no -
/dev/md/dsk/d6 /dev/md/rdsk/d6 /usr ufs 1 no -
#/dev/dsk/c0t0d0s1 /dev/rdsk/c0t0d0s1 /var ufs 1 no -
/dev/md/dsk/d3 /dev/md/rdsk/d3 /var ufs 1 no -
#/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs 2 yes -
/dev/md/dsk/d7 /dev/md/rdsk/d7 /export/home ufs 2 yes -
#/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /opt ufs 2 yes -
/dev/md/dsk/d5 /dev/md/rdsk/d5 /opt ufs 2 yes -
swap - /tmp tmpfs - yes -


# sync
# sync
# sync
# reboot

f. attach mirror

# metattach d0 d20
# metattach d1 d21
# metattach d3 d23
# metattach d5 d25
# metattach d6 d26
# metattach d7 d27

No comments:

Post a Comment