Pages

Wednesday, September 7, 2011

Solaris Software Mirror

How to Create Software Mirror on solaris 10

assuming we have structure like

where first column is your main os disk


then right last is empty disk


prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2


Above command will copy structure of base disk to new disk


having 5 usr partition and seventh slice as 100mb metadb slice

c1t0d0s0   d0   d1  d2   c1t1d0s0   /

c1t0d0s1   d3   d4  d5   c1t1d0s1  swap

s3             d6   d7  d8  c1t1d0s3   /dft

s4            d9   d10  d11  s4         /draft

s5            d12  d13  d14  s5        /sbi3

s6            d15  d16  d17  s6        /sbcc

s7                               100mb     metadb


metadb -a -f -c 2 c1t0d0s7 c1t1d0s7
   
metainit -f d1 1 1 c1t0d0s0

metainit -f d2 1 1 c1t1d0s0

metainit -f d4 1 1 c1t0d0s1

metainit -f d5 1 1 c1t1d0s1

metainit -f d7 1 1 c1t0d0s3

metainit -f d8 1 1 c1t1d0s3

metainit -f d10 1 1 c1t0d0s4

metainit -f d11 1 1 c1t1d0s4

metainit -f d13 1 1 c1t0d0s5

metainit -f d14 1 1 c1t1d0s5

metainit -f d16 1 1 c1t0d0s6

metainit -f d17 1 1 c1t1d0s6


metainit d0 -m d1

metaroot d0

metainit d3 -m d4

metainit d6 -m d7

metainit d9 -m d10

metainit d12 -m d13

metainit d15 -m d16

lockfs -fa

 init 6

metattach d0 d2

metattach d3 d5
   
metattach d6 d8

metattach d9 d11

metattach d12 d14

metattach d15 d17

 installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0

Solaris Replace Software Mirror disk


How to Replace Solaris Mirror Disk 

First we need to remove metadb databse from disk

metadb -d c1t2d0s7

then unconfigure disk

cfgadm -c unconfigure c1::dsk/c1t2d0

then insert new disk and reconfigure it

cfgadm -c configure c1::dsk/c1t2d0

after disk is available we need working disks structure on new disk

prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t2d0s2 

then

metareplace -e d0 c1t2d0s0
metareplace -e d3 c1t2d0s1
metareplace -e d6 c1t2d0s3
metareplace -e d9 c1t2d0s4
metareplace -e d12 c1t2d0s5

metadb -a -c 2 /dev/dsk/c1t2d0s7