Software >> OS >> Unix >> Solaris >> An example of how to create Solaris Volume Manager (SVM) mirror disk

assume we want to mirror the following

c1t0d0s0 & c1t1d0s0 (as d10 for / filesystem)
c1t0d0s1 & c1t1d0s1 (as swap filesystem)

1.  save the current structure in c1t0d0 and then write into c1t1d0

format -> 0 -> p -> name -> "abc" -> quit
   disk -> 1 ->  p -> select -> 0   (assuming it lists 0. abc i.e. option 0 is table named abc)

 alternatively can use prtvtoc command as follows to copy the structure

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

 

2.  Create ufs file systems on the copied slices

newfs /dev/rdsk/c1t1d0s0
newfs /dev/rdsk/c1t1d0s1
newfs /dev/rdsk/c1t1d0s7 
  (the metadata slice for metadb)

3.  Create the metadata space

metadb -af -c3 /dev/dsk/c1t0d0s7
metadb -af -c3 /dev/dsk/c1t1d0s7

verify the metadata created

metadb

4..  Init the submirrors and then add one of them to the mirror disk

metainit -f d11 1 1 c1t0d0s0
metainit -f d12 1 1 c1t1d0s0
metainit -f d10 -m d11

5.  update /etc/system and /etc/vfstab with the new root disk

metaroot d10

6.  run lockfs and reboot

/usr/sbin/lockfs -fa
init 6

7.  After reboot, login as root and attach d12

metattach d10 d12

8.  create mirror for the swap filesystem

metainit -f d21 1 1 c1t0d0s1
metainit -f d22 1 1 c1t1d0s1
metainit -f d20 -m d21
metattach d20 d22

9.  edit /etc/vfstab and replace /dev/dsk/c1t1d0s1 with /dev/md/dsk/d20 for the swap file system