Mirroring with DiskSuite


Tags:
                                  
Mirroring with Solaris Disksuite
--------------------------------

To enable DiskSuite, you must configure one partition as the database partition,
and it only needs to be 20-30 meg.

You then will use the command <metadb> to create the database, Also may use the
full path /usr/sbin/meta*


to create the initial metadb (in this example, s3 is the db slice):
-------------------------------------------------------------------

metadb -af c0t0d0s3
metadb -af c0t1d0s3


to create the additional databases (in this example, s7 is used):
-----------------------------------------------------------------

metadb -fac 3 c0t0d0s7
metadb -fac 3 c0t0d0s7


A minimum of two metadatabases must be on each system disk, preferably spread over
more than one disk slice. They only need to be 5MB or so.

In Disksuite, a 2-way mirror is a metadevice, itself made up of two submirror
metadevices. A metadevice can be made out of an existing slice -- non-destructively,
unlike some other software-RAID tools out there. The technique is to create
metadevices out of the existing slices, create the companion metadevices out of the
spare slices, and join these together to form the 2-way mirrors that will be mounted
instead of the raw disk slices. The 2-way mirror metadevices are actually first
created as 1-way, with the second disk attached afterward.


You can number your metadevices however you wish. This is a common 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
Etc.


Make sure both disks are partitioned identically, and that partitions on the mirror
disk have been newfs'ed.


backup system files:
--------------------

cp /etc/system /etc/system.orig
cp /etc/vfstab /etc/vfstab.orig


Create a metadevice out of the original root:
---------------------------------------------

metainit -f d10 1 1 c0t0d0s0


Create a metadevice for the root mirror:
----------------------------------------

metainit d20 1 1 c0t1d0s0


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

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:)

metaroot d0


Flush any UFS logging of the master filesystem:
-----------------------------------------------

lockfs -fa


Reboot:
-------

init 6


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

metattach d0 d20


Get the name of what is now the raw root disk, in case we need it later:
------------------------------------------------------------------------

ls -l /dev/rdsk/c0t1d0s0


---------------------------------------------------------------------------------
mirroring the remaining system slices
---------------------------------------------------------------------------------


Create a metadevice from the original s4 partition:
-----------------------------------------------------

metainit -f d14 1 1 c0t0d0s4


Create a metadevice from the mirror s4 partition:
---------------------------------------------------

metainit -f d24 1 1 c0t1d0s4


Create the s4 mirror metadevice as a one-way mirror of the s4 metadevice:
-----------------------------------------------------------------------------

metainit d4 -m d14


Repeat for each slice...


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/d6 /dev/md/rdsk/d6  /usr    ufs     1   no  logging
/dev/md/dsk/d7 /dev/md/rdsk/d7  /usr    ufs     1   no  logging


Reboot:
-------

init 6


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

metattach d4 d24
metattach d6 d26
metattach d7 d27


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.