Computerglitch

An ongoing adventure

Solaris Software Raid 1

This document describes how to setup a software raid 1 on a Solaris 10 machine. I have also tested this method on Solaris 8 and the process closely matches this one.


Our main drive that currently has data on it will be c1t12d0. The drive that will be setup in the mirror will be c1t15d0


First clear all partitions on the drive that will act as the mirror drive (c1t15d0)

#format

Next copy the VTOC from the data drive (c1t12d0) to the mirror drive (c1t15d0) Note: s2 represents the entire disk

#prtvtoc /dev/rdsk/c1t12d0s2 | fmthard -s - /dev/rdsk/c1t15d0s2

Install the boot block to the mirror drive

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

Create the state database replicas on our dedicated s3 slices. We create four here - two on each disk. If one disk fails, we still have the prerequisite 50% of DBs to make sure the system is usable.

#metadb -a -f -c 2 c1t12d0s3 c1t15d0s3

Now setup the submirrors first disk (data disk)

# metainit -f d10 1 1 c1t12d0s0
d10: Concat/Stripe is setup

# metainit -f d11 1 1 c1t12d0s1
d11: Concat/Stripe is setup

# metainit -f d14 1 1 c1t12d0s4
d17: Concat/Stripe is setup

Then setup the submirrors on the second disk (mirror)

# metainit -f d20 1 1 c1t15d0s0
d20: Concat/Stripe is setup

# metainit -f d21 1 1 c1t15d0s1
d21: Concat/Stripe is setup

# metainit -f d24 1 1 c1t15d0s4
d24: Concat/Stripe is setup

Now we create the mirrors using the submirrors from the first disk

# metainit d0 -m d10
d0: Mirror is setup

# metainit d1 -m d11
d1: Mirror is setup

# metainit d4 -m d14
d4: Mirror is setup

Set the system to boot from the mirror using:

#metaroot d0

This will change the line in /etc/vfstab for the root slice, and also add a line to /etc/system for rootdev. We need to edit /etc/vfstab and modify the entries for the swap slice and the home slice. Be sure to add nologging option to the root slice.


Snapshot of /etc/vfsatb:

# cat /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/c1t12d0s1 - - swap - no -
#/dev/dsk/c1t12d0s3 - - swap - no -
/dev/dsk/c1t14d0s4 - - swap - no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no nologging
/dev/md/dsk/d1 /dev/md/rdsk/d1 /var ufs 1 no -
/dev/md/dsk/d4 /dev/md/rdsk/d4 /usr ufs 1 no -
#/dev/dsk/c1t15d0s7 /dev/rdsk/c1t15d0s7 /usr ufs 1 no -
#/dev/dsk/c1t12d0s4 /dev/rdsk/c1t12d0s4 /usr ufs 1 no -
#/dev/dsk/c1t12d0s7 /dev/rdsk/c1t12d0s7 /var ufs 1 no -
#/dev/dsk/c1t13d0s6 /dev/rdsk/c1t13d0s6 /var ufs 1 no -
#/dev/dsk/c1t12d0s1 /dev/rdsk/c1t12d0s1 /var ufs 1 no -
/dev/dsk/c1t14d0s7 /dev/rdsk/c1t14d0s7 /opt ufs 2 yes -
/dev/dsk/c1t14d0s5 /dev/rdsk/c1t14d0s5 /opt1 ufs 2 yes -
/dev/dsk/c1t14d0s6 /dev/rdsk/c1t14d0s6 /users ufs 2 yes -
/devices - /devices devfs - no -
ctfs - /system/contract ctfs - no -
objfs - /system/object objfs - no -
swap - /tmp tmpfs - yes -

Note the mirrors from the output:

/dev/md/dsk/d0  /dev/md/rdsk/d0 /       ufs     1       no      nologging
/dev/md/dsk/d1 /dev/md/rdsk/d1 /var ufs 1 no -
/dev/md/dsk/d4 /dev/md/rdsk/d4 /usr ufs 1 no -

Execute lockfs and reboot:

# lockfs -fa
# init 6

Once the system is up (you can let it come up into runlevel 3 now - the system will just be a bit slow during the mirror synch), attach the submirrors from the second drive.

# metattach d0 d20
d0: submirror d20 is attached

# metattach d1 d21
d1: submirror d21 is attached

# metattach d4 d24
d4: submirror d24 is attached

Now you can use the metastat command to monitor the synch operation

# metastat | grep "%"
Resync in progress: 1 % done
Resync in progress: 78 % done
Resync in progress: 7 % done

The next step is optional. This process explains how to setup the system using Openboot to automatically use the second disk in case of primary disk failure.

Openboot set with the following to use second disk in case of primary disk failure:
Aliases set for the drives:

nvalias primary /sbus@7,0/SUNW,fas@3,8800000/sd@c,0:a
nvalias mirror /sbus@7,0/SUNW,fas@3,8800000/sd@f,0:a

Save the aliases in nvram.

ok setenv use-nvramrc? true

Set the primary boot device and the mirror boot device for fault tolerance.

ok setenv boot-device primary mirror

Comments