Solstice DiskSuite 4.2.1 User's Guide

How to Create a Mirror From a File System That Can Be Unmounted (Command Line)

Use this procedure to mirror an existing file system that can be unmounted.

Note -

To use the command line to mirror /usr, /opt, or swap, refer to "How to Create a Mirror From a File System That Cannot Be Unmounted (Command Line)". To use the command line to mirror root (/), refer to "SPARC: How to Create a Mirror From root (/) (Command Line)", or "x86: How to Create a Mirror From root (/) (Command Line)".

The high-level steps in this procedure are:

Check the prerequisites ("Prerequisites for Creating DiskSuite Objects"), and the preliminary information ("Preliminary Information for Creating Mirrors"), before beginning. Refer to the metainit(1M) and metattach(1M) man pages for more information.

Caution - Caution -

Do not create a multi-way mirror. Rather, create a one-way mirror with the metainit(1M) command then attach the additional submirrors with the metattach(1M) command. When the metattach(1M) command is not used, no resync operations occur and data could become corrupted. Also, do not create a two-mirror for a file system without first unmounting the file system and editing the /etc/vfstab file to reference the mirror metadevice before attaching the second submirror.

Example -- Creating a Two-Way Mirror

# metainit -f d1 1 1 c1t0d0s0
d1: Concat/Stripe is setup
# metainit d2 1 1 c2t0d0s0
d2: Concat/Stripe is setup
# metainit d0 -m d1
d0: Mirror is setup
# umount /master
(Edit the /etc/vfstab file so that the file system references the mirror)
# mount /master
# metattach d0 d2
d0: Submirror d2 is attached

The -f option forces the creation of the first concatenation, d1, which contains the mounted file system /master on /dev/dsk/c1t0d0s0. The second concatenation, d2, is created from /dev/dsk/c2t0d0s0. (This slice must be the same size or greater than that of d1.) The metainit command with the -m option creates the one-way mirror, d0, from d1.

Next, /master is unmounted and its entry changed in the /etc/vfstab file to reference the mirror. For example, the following line:

/dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 /master ufs 2 yes -

should be changed to:

/dev/md/dsk/d0 /dev/md/rdsk/d0 /master ufs 2 yes -

Finally, the /master file system is remounted and submirror d2 attached to the mirror, causing a mirror resync. (The system verifies that the concatenations and the mirror are set up, and that submirror d2 is attached.)