SVM how to mirror a root disk

Before attempting this procedure, you must have first created at least 2 state databases (replicas) on unused slices using the metadb command.

metadb -a -f -c 2 c0t0d0s5 c1t0d0s5

The -a and -f options are used together to create the initial state database replicas. The -c 2 option puts two state database replicas on each specified slice, creating a total of four replicas. By spreading the state database replicas across controllers, you can increase metadevice performance and reliability.

Also, it is assumed that you have formatted the second disk exactly like the original root disk (use prtvtoc and fmthard for ease). Each corresponding slice on each disk must be the same size.

For this example, we will be mirroring all the slices on the root disk (c0t0d0) to another equally sized disk (c1t0d0). You will have to make the appropriate changes.

For each partition on your root disk (/, /usr, /var, /opt, /export/home, or any other partition you may have), the following commands must be run:


For each slice, you must create 3 new metadevices: one for the existing slice, one for the slice on the mirrored disk, and one for the mirror. To do this, make the appropriate entries in the[1] file. For example, for slice 0, we’ll create the following entries:

d10 1 1 /dev/dsk/c0t0d0s0
d20 1 1 /dev/dsk/c1t0d0s0
d0 -m d10

As an example for slice 1, we’ll create the following entries in the file:

d11 1 1 /dev/dsk/c0t0d0s1
d21 1 1 /dev/dsk/c1t0d0s1
d1 -m d11

Follow this example, creating groups of 3 entries for each slice on the root disk.

Run the metainit command to create all the metadevices you have just defined in the file. If you use the -a option, all the metadevices defined in the will be created.

metainit -a -f

The -f is required because the slices on the root disk are currently mounted.

Modify the entries in the /etc/vfstab file to reflect metadevices instead of slices. Start off by making a backup copy of the file:

cp /etc/vfstab /etc/vfstab.pre_sds

Then, edit the /etc/vfstab file to change each slice to the appropriate metadevice. Do not update the entry for the root filesystem, it will be changed by the metaroot command in step 4. You will need to edit the swap, /usr, /var, and any other slices in the same manner. For example, you would need to change the swap device line from

/dev/dsk/c0t0d0s1 – – swap – no –


/dev/md/dsk/d1 – – swap – no –

Make sure that you change the slice to the main mirror (in this case, d1) and not to the simple submirror (in this case, d11).

Run the metaroot command for the metadevice you designated for the root mirror. In the example above, we created d0 to be the mirror device for the root partition, so we would run

metaroot d0


For Solstice DiskSuite versions 4.1 or greater and Solaris[TM] 9 LVM it is necessary to lock filesystems before rebooting, so run

lockfs -fa


Reboot the system. This step is necessary. Do not proceed without rebooting your system, or data corruption will occur.

After the system has rebooted, you can verify that root and other slices are under DiskSuite’s control by running the

# df -k
# swap -l

commands. The outputs of these commands should reflect the metadevice names, not the slice names.

Set the dump device to the correct device, using the command

# dumpadm -d swap

Verify that the dump device is set correctly to swap by running the command



Lastly, attach the second submirror to the metamirror device. This attachment, using the metattach command, must be done for each partition on the disk, and will start the syncing of data from the current root disk to the other. To continue our example, to add the mirror for root, enter the command:

metattach d0 d20

Even though this command returns to the shell prompt immediately, the syncing process has begun. To follow the progress of this syncing for this mirror, enter the command

metastat d0

Although you can run all the metattach commands one right after another, it is a good idea to run the next metattach command only after the first syncing has completed. This reduces the amount of head movement on the disk and can speed up the total time it takes to mirror all the slices on the disk.

Once you have attached all the submirrors to the metamirrors, and all the syncing has completed, your root disk is mirrored.

Leave a Reply

Your email address will not be published. Required fields are marked *