Tuesday, March 4, 2008

Howto Unmirror a File System That Cannot Be Unmounted Solaris 10

Use this task to unmirror file systems, including root (/), /usr, /opt, and swap, that cannot be unmounted during normal system operation.

  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.
  3. # metastat mirror
  4. Detach the submirror that will continue to be used for the file system.
  5. # metadetach mirror submirror
  6. Use one of the following commands, depending the file system you want to unmirror:

    • For the /usr, /opt, or swap file systems, change the file system entry in the /etc/vfstab file to use a non-Solaris Volume Manager device (slice).

    • For the root (/) file system only: run the metaroot command.
  7. # metaroot rootslice
  8. Reboot the system.
  9. # reboot
  10. Clear the remaining mirror and submirrors.
  11. # metaclear -r mirror

Example Unmirroring the root (/) File System
# metastat d0
d0: Mirror
Submirror 0: d10
State: Okay
Submirror 1: d20
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 40541184 blocks (19 GB)

d10: Submirror of d0
State: Okay
Size: 40541184 blocks (19 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s0 0 No Okay Yes

d20: Submirror of d0
State: Okay
Size: 40541184 blocks (19 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s0 0 No Okay Yes
# metadetach d0 d20
d0: submirror d20 is detached
# metaroot /dev/dsk/c0t0d0s0
# reboot
# metaclear -r d0
d0: Mirror is cleared
d10: Concat/Stripe is cleared
# metaclear d20
d20: Concat/Stripe is cleared

Example Unmirroring the swap File System
# metastat d1
d1: Mirror
Submirror 0: d11
State: Okay
Submirror 1: d21
State: Okay
# metadetach d1 d21
d1: submirror d21 is detached
Edit the /etc/vfstab file to change the entry for swap from metadevice to slice name
# vi /etc/vfstab
In this example, the /etc/vfstab file contains the following entry for the swap file system:
/dev/md/dsk/d1 - - swap - no -
Change the entry to read as follows:
/dev/dsk/c0t0d0s1 - - swap - no -
# reboot
# metaclear -r d1
d1: Mirror is cleared
d11: Concat/Stripe is cleared
# metaclear d21
d21: Concat/stripe is cleared