Thursday, May 26, 2011

Solaris 10 disk mirroring using Solaris Volume Manager

 

Below are the steps to do disk mirroring using SVM.

  • My primary Disk: c0t0d0s0
  • My Second Disk:c0t1d0s0

 

1. Copy the partition table of the first disk to second disk(mirror disk)

bash-3.00# prtvtoc /dev/rdsk/c0t0d0s0 >/vtoc.bak
bash-3.00# fmthard -s /vtoc.bak /dev/rdsk/c0t1d0s0

2. Creating state database replicas on each disk

bash-3.00# metadb -a -f -c 3 c0t0d0s7
bash-3.00# metadb -a -f -c 3 c0t1d0s7

3. Check the state database

bash-3.00# metadb
        flags           first blk       block count
     a        u         16              8192            /dev/dsk/c0t0d0s7
     a        u         8208            8192            /dev/dsk/c0t0d0s7
     a        u         16400           8192            /dev/dsk/c0t0d0s7
     a        u         16              8192            /dev/dsk/c0t1d0s7
     a        u         8208            8192            /dev/dsk/c0t1d0s7
     a        u         16400           8192            /dev/dsk/c0t1d0s7

A state database replica contains configuration and state information about the meta devices.

4.Create the root slice mirror and its first sub-mirror 

bash-3.00# metainit -f d10 1 1 c0t0d0s0
d10: Concat/Stripe is setup
bash-3.00# metainit -f d20 1 1 c0t1d0s0
d20: Concat/Stripe is setup
bash-3.00# metainit d0 -m d10
d0: Mirror is setup

5. Next we need to run metaroot to prepare /etc/vfstab and /etc/system (do this only for the root slice)

Take a backup before run metaroot command

bash-3.00# cp vfstab vfstab.orig
bash-3.00# cp system system.orig


bash-3.00# metaroot d0

6. create swap slice mirror and its first sub-mirror

bash-3.00# metainit -f d11 1 1 c0t0d0s1
d11: Concat/Stripe is setup
bash-3.00# metainit -f d21 1 1 c0t1d0s1
d21: Concat/Stripe is setup
bash-3.00# metainit d1 -m d11
d1: Mirror is setup

7. Now my HOME partition

bash-3.00# metainit -f d12 1 1 c0t0d0s3
d12: Concat/Stripe is setup
bash-3.00# metainit -f d22 1 1 c0t1d0s3
d22: Concat/Stripe is setup
bash-3.00# metainit d2 -m d12
d2: Mirror is setup

 

8. My VAR partition

bash-3.00# metainit -f d13 1 1 c0t0d0s4
d13: Concat/Stripe is setup
bash-3.00# metainit -f d23 1 1 c0t1d0s4
d23: Concat/Stripe is setup
bash-3.00# metainit d3 -m d13
d3: Mirror is setup

 

9. My OPT partition

bash-3.00# metainit -f d14 1 1 c0t0d0s5
d14: Concat/Stripe is setup
bash-3.00# metainit -f d24 1 1 c0t1d0s5
d24: Concat/Stripe is setup
bash-3.00# metainit d4 -m d14
d4: Mirror is setup

10. Modify vfstab to mount all mirrors after boot.
The entry for the root device (/) has already been altered by the metaroot command we executed before.

#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/md/dsk/d1  -       -       swap    -       no      -
/dev/md/dsk/d0  /dev/md/rdsk/d0 /       ufs     1       no      -
/dev/md/dsk/d3  /dev/md/rdsk/d3 /var    ufs     1       no      -
/dev/md/dsk/d2  /dev/md/rdsk/d2 /home   ufs     2       yes     -
/dev/md/dsk/d4  /dev/md/rdsk/d4 /opt    ufs     2       yes     -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
swap    -       /tmp    tmpfs   -       yes     -

11.Reboot the system


bash-3.00#lockfs -fa
bash-3.00# sync;sync;init 6

12. Now Attach the sub-mirrors to all mirrors

bash-3.00# metattach d0 d20
d0: submirror d20 is attached
bash-3.00# metattach d1 d21
d1: submirror d21 is attached
bash-3.00# metattach d2 d22
d2: submirror d22 is attached
bash-3.00# metattach d3 d23
d3: submirror d23 is attached
bash-3.00# metattach d4 d24
d4: submirror d24 is attached

 

You can use metastat to track the mirroring progress

bash-3.00#metastat

No comments:

Post a Comment