Howto Unmirror a File System That Cannot Be Unmounted Solaris 10

Posted on Updated on


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

One thought on “Howto Unmirror a File System That Cannot Be Unmounted Solaris 10

    gabe said:
    January 2, 2009 at 7:56 am

    what if i want to break the root mirror because I have a 3rd party vendor doing an upgrade (and in the past it ended in a rm -rf)

    metadetach mirror submirror

    now they screw it up and and i need to use that submirror as the root partition?

    In testing, I broke the mirror and then remounted that submirror slice somewhere else and it said it was not clean and i had to run fsck on it. Not sure if I lost data or not but it didn’t feel right. Is there a cleaner way of breaking the mirror?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s