Solaris Volume Manager Administration Guide

ProcedureHow to Unmirror a File System

Use this procedure to unmirror a file system that can be unmounted while the system is running. To unmirror root (/), /var, /usr, or swap, or any other file system that cannot be unmounted while the system is running, see How to Unmirror a File System That Cannot Be Unmounted.

Before You Begin

Read Creating and Maintaining RAID-1 Volumes.

  1. Make sure that you have root privilege and that you have a current backup of all data.

  2. Verify that at least one submirror is in the Okay state.


    # metastat mirror
    
  3. Unmount the file system.


    # umount /file-system
    
  4. Detach the submirror that will continue to be used for the file system.


    # metadetach mirror submirror
    

    For more information, see the metadetach(1M) man page.

  5. Clear the mirror and remaining subcomponents.


    # metaclear -r mirror
    

    For more information, see the metaclear(1M) man page.

  6. Edit the /etc/vfstab file to use the component detached in Step 4, if necessary.

  7. Remount the file system.


    # mount /file-system
    

Example 11–21 Unmirroring the /opt File System


# metastat d4
d4: Mirror
    Submirror 0: d2
      State: Okay        
    Submirror 1: d3
      State: Okay        
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 2100735 blocks (1.0 GB)

d2: Submirror of d4
    State: Okay         
    Size: 2100735 blocks (1.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c0t0d0s0          0     No            Okay   Yes 


d3: Submirror of d4
    State: Okay         
    Size: 2100735 blocks (1.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t0d0s0          0     No            Okay   Yes 

...
# umount /opt
# metadetach d4 d2
d4: submirror d2 is detached
# metaclear -r d4
d4: Mirror is cleared
d3: Concat/Stripe is cleared
(Edit the /etc/vfstab file so that the entry for /opt is changed from d4 to the underlying slice or volume)
# mount /opt

In this example, the /opt file system is composed of a two-way mirror, d4. The submirrors of the mirror are d2 and d3. The submirrors are composed of slices /dev/dsk/c0t0d0s0 and /dev/dsk/c1t0d0s0. The metastat command verifies that at least one submirror is in the “Okay” state. (A mirror with no submirrors in the “Okay” state must be repaired first.) The file system is unmounted. Then, submirror d2 is detached. The metaclear -r command deletes the mirror and the other submirror, d3.

Next, the entry for /opt in the /etc/vfstab file is changed to reference the underlying slice.

In this example the /etc/vfstab file contains the following entry for the /opt file system:


/dev/md/dsk/d4  /dev/md/rdsk/d4  /opt ufs  2  yes -

Change the entry to read as follows:


/dev/md/dsk/d2  /dev/md/rdsk/d2  /opt ufs  2  yes -

By using the submirror name, you can continue to have the file system mounted on a volume. Finally, the /opt file system is remounted.

By using d2 instead of d4 in the /etc/vfstab file, you have unmirrored the mirror. Because d2 consists of a single slice, you can mount the file system on the slice name (/dev/dsk/c0t0d0s0) if you do not want the device to support a volume.