• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1196
  • Last Modified:

Disk Mirroring Request


I am a complete novice to Solaris but I have an urgent need to mirror two disks in a V210 running Solaris 9 - patched with the 9_recommended cluster.

Here is the config:

Two 36gb

Disks - c1t0d0 & c1t1d0

c1t0d0 is partitioned as follows:

0 - root - 6.5gb
1 - swap - 1gb (Machine has 512mb RAM)
2 - backup
3 - var - 7gb
4 - opt - 7gb
5 - export - 10gb
7 - meta  - 50mb

I need step by step instructions on how to mirror these two disks - I have followed as many alledged step by step instructions but I just can't get my head around it.

Sorry for being such a newbie.
1 Solution
type format, select your master disk (probably 0)
type 'p' for partition, then 'name'
give your disk a name (eg master)
'q' to leave the partition menu, then 'disk' to get a list of disks, select your second disk (1)
type 'p' for partition, 'select', chose your pre-defined label (master), then label, then quit.
Now your mirrors match each other.
To create your metadatabases, type:
metadb  -a  -f  -c  2  c1t0d0s7  c1t1d0s7
then for each partition, i.e. var type
  metainit  -f  d31  1  1  c1t0d0s3
  metainit  d32  1  1  c1t1d0s3
  metainit  d30  -m  d31
Edit the /etc/vfstab to make /dev/md/dsk/d30 & /dev/md/rdsk/d30 the devices for /var
Do then same for export (using d51, d52 & d50) opt (d40), swap (d10) and last of all root (d0)
then type
metaroot  d0
lockfs  -fa
You don't need to edit the vftab for root (/) the metaroot command will do that for you.
reboot the machine
When it comes back (if it doesn't it is usually a typo in the /etc/vfstab, so make sure it is correct before you reboot, or you'll have to boot off the cd in singl-user mode and re-edit it manually)

metattach  d0  d2
metattach  d1  d12
metattach  d30  d32
You may want to space out the commands, as mirroring disks can be very I/O intensive, (you can check the progress with metastat)

Copy any errors / outputs / vfstab that you are not sure about into this Q
Here's the procedure about disk mirroring:

Basic mirroring with Solaris DiskSuite
Home Personal Technical Webcam Journal

The following describes a procedure for using the DiskSuite component of the Solaris Easy Access Server to set up mirroring of the main system disk of a Solaris 8 machine. It presumes both drives are of identical geometry, and that the operating system is already installed on c0t0d0, and that the spare disk is c0t1d0.

Installing the software:
Change to the packages directory on the Solaris 8 "2-of-2" CD, add the requisite packages, and reboot:

acadie# cd /cdrom/sol_8_1000_sparc_2/Solaris_8/EA/products/DiskSuite_4.2.1/sparc/Packages
acadie# pkgadd -d . SUNWmdr SUNWmdg SUNWmdu SUNWmdx
acadie# shutdown -y -g0 -i6

Disk layout for both system disks:
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -   344      256.05MB    (345/0/0)     524400
  1       swap    wu     345 -  1034      512.11MB    (690/0/0)    1048800
  2     backup    wm       0 - 11696        8.48GB    (11697/0/0) 17779440
  3 unassigned    wm    1035 -  1036        1.48MB    (2/0/0)         3040
  4        var    wm    1037 -  2416        1.00GB    (1380/0/0)   2097600
  5 unassigned    wm    2417 -  2418        1.48MB    (2/0/0)         3040
  6        usr    wm    2419 - 10316        5.72GB    (7898/0/0)  12004960
  7       home    wm   10317 - 11696        1.00GB    (1380/0/0)   2097600

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

Naming convention:
d0 - metadevice to be mounted instead of s0
d10 - metadevice containing original submirror of s0
d20 - metadevice containing second submirror of s0

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

Slices 3 and 5 will hold the meta databases. Create those as follows:

acadie# metadb -a -f c0t0d0s3 c0t0d0s5 c0t1d0s3 c0t1d0s5

Mirroring the root disk:
Create a metadevice out of the original root:

acadie# metainit -f d10 1 1 c0t0d0s0

Create a metadevice for the root mirror:

acadie# metainit d20 1 1 c0t1d0s0

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

acadie# metainit d0 -m d10

Add an entry to /etc/vfstab so that / is now mounted from the mirror:

acadie# metaroot d0

Flush any UFS logging of the master filesystem:

acadie# lockfs -fa


acadie# shutdown -y -g0 -i6

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

acadie# metattach d0 d20

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

acadie# ls -l /dev/rdsk/c0t1d0s0

Mirroring the remaining system slices:
Create a metadevice from the original /var partition:

acadie# metainit -f d14 1 1 c0t0d0s4

Create a metadevice from the mirror /var/partition:

acadie# metainit -f d24 1 1 c0t1d0s4

Create the /var mirror metadevice as a one-way mirror of the /var metadevice:

acadie# metainit d4 -m d14

Create metadevices for the /usr mirror:

acadie# metainit -f d16 1 1 c0t0d0s6
acadie# metainit -f d26 1 1 c0t1d0s6

Create a mirror metadevice for /usr:

acadie# metainit d6 -m d16

Create metadevices for the /home mirror:

acadie# metainit -f d17 1 1 c0t0d0s7
acadie# metainit -f d27 1 1 c0t1d0s7

Create a mirror metadevice for /home:

acadie# metainit d7 -m d17

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


acadie# shutdown -y -g0 -i6

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

acadie# metattach d4 d24
acadie# metattach d6 d26
acadie# metattach d7 d27

Wait until disk activity stops before doing much else. 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.


also, have a look at:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now