Tuesday, 7 April 2015

SVM Root disk mirroring


The concept
***********
Solaris Volume Manager is a software package for creating, modifying and controlling RAID-0 (concatenation and stripe) volumes, RAID-1 (mirror) volumes, RAID 0+1 volumes, RAID 1+0 volumes, RAID-5 volumes, and soft partitions.

Before configuring SVM you should take the Backup of /etc/vfstab & /etc/system File

# cp /etc/vfstab /etc/vfstab.before_mirror

# cp /etc/system /etc/system.before_mirror

Installing the software(Solaris 9 onwards its defaultly installed with OE)
**********************************************************
The DiskSuite product is found on the Solaris 8 "2-of-2" CD. Minimally, the drivers (SUNWmdr and SUNWmdx) and command line tools (SUNWmdu) need to be installed. 

The "metatool" GUI is in the optional SUNWmdg package. Reboot after installing the packages.

bash-2.05#pkgadd -d /cdrom/cdrom0/Solaris_8/EA/products/DiskSuite_4.2.1/sparc/Packages \
          SUNWmdr SUNWmdx SUNWmdu SUNWmdg

bash-2.05#shutdown -y -g0 -i6

Naming convention
****************
You can number your metadevices however you wish. I like something that makes a little bit of sense, 

I use the following convention:

d0 - mirror metadevice to be mounted instead of c0t0d0s0
d10 - submirror metadevice on first disk, c0t0d0s0
d20 - submirror metadevice on second disk, c0t1d0s0

d4 - mirror metadevice to be mounted instead of c0t0d0s4
d14 - submirror metadevice on first disk, c0t0d0s4
d24 - submirror metadevice on second disk, c0t1d0s4

d5 - mirror metadevice to be mounted instead of c0t0d0s5
d15 - submirror metadevice on first disk, c0t0d0s5
d25 - submirror metadevice on second disk, c0t1d0s5

d6 - mirror metadevice to be mounted instead of c0t0d0s6
d16 - submirror metadevice on first disk, c0t0d0s6
d26 - submirror metadevice on second disk, c0t1d0s6
Etc.

***********************************************************
Make sure both disks are partitioned identically, and has filesystem on it.
***********************************************************
bash-2.05# prtvtoc /dev/rdsk/c0t0d0s2 |fmthard -s - /dev/rdsk/c0t1d0s2
fmthard:  New volume table of contents now in place. 

bash-2.05# newfs /dev/rdsk/c0t1d0s0
bash-2.05# newfs /dev/rdsk/c0t1d0s4
bash-2.05# newfs /dev/rdsk/c0t1d0s5
bash-2.05# newfs /dev/rdsk/c0t1d0s6

*****************************************
Creating Meta Database in Both the system Disks
*****************************************
A minimum of two metadatabases must be on each system disk, preferably spread over more than one disk slice.


bash-2.05#
bash-2.05#metadb -afc3 c0t0d0s7  c0t1d0s7 

*******************
Mirroring the root disk
*******************

Create a metadevice out of the original root:

        bash-2.05#metainit -f d10 1 1 c0t0d0s0

Create a metadevice for the root mirror:

  bash-2.05#metainit d20 1 1 c0t1d0s0

Set up a one-way mirror of the root metadevice:

bash-2.05#metainit d0 -m d10

Configure the system to boot the root filesystem from the metadevice, using the "metaroot" command. This will make the necessary changes to /etc/vfstab and /etc/system:

bash-2.05#metaroot d0


Flush any UFS logging of the master filesystem

bash-2.05#lockfs -fa

Reboot the server so that it will boot up in SVM contorl

bash-2.05#shutdown -y -g0 -i6

Attach the second metadevice to the root metadevice to make it a 2-way mirror:

bash-2.05#metattach d0 d20

Copy the Bootblock to the Mirror Disk so that it become bootable

bash-2.05#cd /usr/platform/'uname -i'/lib/fs/ufs

bash-2.05#installboot bootblk /dev/rdsk/c0t1d0s0

So that you can boot the machine from disk1 also

******************************
Mirroring the remaining system slices
******************************

***************************************************
Create the sub-mirror metadevice for /var:

bash-2.05# metainit -f d14 1 1 c0t0d0s4
bash-2.05# metainit -f d24 1 1 c0t1d0s4

Create the Main mirror metadevice for /var:

bash-2.05# metainit d4 -m d14
***************************************************
Create the sub-mirror metadevice for /home:

bash-2.05# metainit -f d15 1 1 c0t0d0s5
bash-2.05# metainit -f d25 1 1 c0t1d0s5

Create the Main mirror metadevice for /home:

bash-2.05# metainit d5 -m d15
***************************************************
Create the sub-mirror metadevice /usr mirror:

bash-2.05# metainit -f d16 1 1 c0t0d0s6
bash-2.05# metainit -f d26 1 1 c0t1d0s6

Create the Main mirror metadevice for /usr:

bash-2.05# metainit d6 -m d16
***************************************************

Edit /etc/vfstab so that the new metadevices will be mounted:

/dev/md/dsk/d4 /dev/md/rdsk/d4  /var    ufs     1   no  logging
/dev/md/dsk/d5 /dev/md/rdsk/d5  /home   ufs     1   no  logging
/dev/md/dsk/d6 /dev/md/rdsk/d6  /usr    ufs     1   no  logging

Reboot:

bash-2.05# shutdown -y -g0 -i6

Attach the second submirrors to the mirrors to make 2-way mirrors:

bash-2.05# metattach d4 d24
bash-2.05# metattach d5 d25
bash-2.05# metattach d6 d26

****************************************************
Wait until disk activity stops before doing much else. DiskSuite's progress of syncing the second drive to the first can be monitored using the "metastat" command. Though it is not strictly necessary, it is a good idea to reboot after this, if only to make sure there are no problems and that the box will indeed come back up.

Note:
****************************************************
The following warning messages are harmless, and may be safely ignored. They are an artifact of the way drivers are loaded during the boot process when you have a mirrored root or /usr file system.:
WARNING: forceload of misc/md_trans failed
WARNING: forceload of misc/md_raid failed
WARNING: forceload of misc/md_hotspares failed

"WARNING: forceload of misc/md_hotspares failed". This messages can be suppressed by creating an empty hot spare pool. The following metainit command does just that:

        bash-2.05# metainit hsp001

No comments:

Post a Comment