Configure Solaris Volume Manager (Raid 1)

1. Two disks will be use for this example. The first disk will be the primary disk and the second will be the mirror.

Disk 1: c1t1d0
Disk 2: c1t0d0

2. Copy the layout of the Disk 1 into Disk 2.

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

Partition for the Disk 1:

Part      Tag    Flag     Cylinders         Size            Blocks
 0       root    wm       0 -  2060       10.00GB    (2061/0/0)   20972736
 1       swap    wu    2061 -  2885        4.00GB    (825/0/0)     8395200
 2     backup    wu       0 - 14086       68.35GB    (14087/0/0) 143349312
 3 unassigned    wm    2886 -  2889       19.88MB    (4/0/0)         40704
 4        var    wm    2890 -  4126        6.00GB    (1237/0/0)   12587712
 5        opt    wm    4127 -  6393       11.00GB    (2267/0/0)   23068992
 6       data    wm    6394 - 11752       26.00GB    (5359/0/0)   54533184
 7      data1    wm   11753 - 14086       11.33GB    (2334/0/0)   23750784

Partition for the Disk 2:

Part      Tag    Flag     Cylinders         Size            Blocks
 0       root    wm       0 -  2060       10.00GB    (2061/0/0)   20972736
 1       swap    wu    2061 -  2885        4.00GB    (825/0/0)     8395200
 2     backup    wu       0 - 14086       68.35GB    (14087/0/0) 143349312
 3 unassigned    wm    2886 -  2889       19.88MB    (4/0/0)         40704
 4        var    wm    2890 -  4126        6.00GB    (1237/0/0)   12587712
 5        opt    wm    4127 -  6393       11.00GB    (2267/0/0)   23068992
 6       data    wm    6394 - 11752       26.00GB    (5359/0/0)   54533184
 7       data1   wm   11753 - 14086       11.33GB    (2334/0/0)   23750784

3. Create state replicas using the metadb command.

# metadb -a -f -c 3 /dev/dsk/c1t1d0s3
# metadb -a -c 3 /dev/dsk/c1t0d0s3

4. Initializing mirrors & submirrors.

# metainit -f d10 1 1 /dev/dsk/c1t1d0s0
# metainit -f d20 1 1 /dev/dsk/c1t0d0s0
# metainit d0 -m d10
# metaroot d0

Additional note:
Please run the metaroot command before reboot.

# metainit -f d11 1 1 /dev/dsk/c1t1d0s1
# metainit -f d21 1 1 /dev/dsk/c1t0d0s1
# metainit d1 -m d11
# metainit -f d14 1 1 /dev/dsk/c1t1d0s4
# metainit -f d24 1 1 /dev/dsk/c1t0d0s4
# metainit d4 -m d14
# metainit -f d15 1 1 /dev/dsk/c1t1d0s5
# metainit -f d25 1 1 /dev/dsk/c1t0d0s5
# metainit d5 -m d15
# metainit -f d16 1 1 /dev/dsk/c1t1d0s6
# metainit -f d26 1 1 /dev/dsk/c1t0d0s6
# metainit d6 -m d16
# metainit -f d17 1 1 /dev/dsk/c1t1d0s7
# metainit -f d27 1 1 /dev/dsk/c1t0d0s7
# metainit d7 -m d17

5. Updating /etc/vfstab.

# 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/dsk/c1t1d0s1       -       -       swap    -       no      -
 /dev/dsk/c1t1d0s0       /dev/rdsk/c1t1d0s0      /       ufs     1       no      -
 /dev/dsk/c1t1d0s5       /dev/rdsk/c1t1d0s5      /opt   ufs     2       yes     -
 /dev/dsk/c1t1d0s4       /dev/rdsk/c1t1d0s4      /var    ufs     1       no      -
 /dev/dsk/c1t1d0s7       /dev/rdsk/c1t1d0s7      /data1 ufs     2       yes     -
 /dev/dsk/c1t1d0s6       /dev/rdsk/c1t1d0s6      /data   ufs     2       yes     -
 swap    -       /tmp    tmpfs   -       yes     -

to

# 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/d5  /dev/md/rdsk/d5 /opt   ufs     2       yes     -
 /dev/md/dsk/d4  /dev/md/rdsk/d4 /var    ufs     1       no      -
 /dev/md/dsk/d7  /dev/md/rdsk/d7 /data1 ufs     2       yes     -
 /dev/md/dsk/d6  /dev/md/rdsk/d6 /data   ufs     2       yes     -
 swap    -       /tmp    tmpfs   -       yes     -

6. Reboot.

7. Attaching the Mirrors.

# metattach d0 d20
# metattach d1 d21
# metattach d4 d24
# metattach d5 d25
# metattach d6 d26
# metattach d7 d27

8. Verify mirror:

# metastat -p

d7 -m d17 d27 1
 d17 1 1 c1t1d0s7
 d27 1 1 c1t0d0s7
d6 -m d16 d26 1
 d16 1 1 c1t1d0s6
 d26 1 1 c1t0d0s6
d5 -m d15 d25 1
 d15 1 1 c1t1d0s5
 d25 1 1 c1t0d0s5
d4 -m d14 d24 1
 d14 1 1 c1t1d0s4
 d24 1 1 c1t0d0s4
d1 -m d11 d21 1
 d11 1 1 c1t1d0s1
 d21 1 1 c1t0d0s1
d0 -m d10 d20 1
 d10 1 1 c1t1d0s0
 d20 1 1 c1t0d0s0

9. Set boot path in OBP.

ok nvalias <diskname> /sbus@3,0/SUNW,fas@3,60000/sd@1,0:a
ok boot <diskname>

Additional note:

In /etc/system file, add the following line:

set md:mirrored_root_flag=1

By default the system will not boot without one more than half the total metadb replicas. This will allow you to boot with only one metadb, if one of you disk drives fails.

You May Also Like

Leave a Reply?