How to Split a Root Mirrored With Solaris Volume Manager Prior to Updating Software

Enda O'Connor, April 2009

This article outlines the correct way to split a Solaris Volume Manager mirror prior to updating the software through, for instance, upgrades or software updates (patches). The following procedures should work with all Solaris releases except for How to Mount a Solaris Volume Manager Mirror While Booted From Media, which applies only to the Solaris 10 OS. The examples below were conducted on a Sun Fire x4200 server.

This article covers the following topics:

How to Split the Mirror Before the Software Update

  1. First, determine the layout of the root file system:
  2. root@patchtest-x4200-2 # df -k /
    Filesystem         kbytes    used   avail capacity  Mounted on
    /dev/md/dsk/d10   10085921 1041301 8943761    11%    /
    root@patchtest-x4200-2 # metastat -p d10
    d10 -m d11 d12 1
    d11 1 1 c0t2d0s0
    d12 1 1 c0t3d0s0
  3. Remove the mirror that is not being upgraded (for instance, in the example in Step 1, d12:c0t3d0s0 will not be upgraded).
  4. root@patchtest-x4200-2 # metadetach d10 d12
    d10: submirror d12 is detached
  5. Revert to booting off the physical device that is being upgraded ( d11 disk c0t2d0s0 in this example):
  6. root@patchtest-x4200-2 # metaroot c0t2d0s0

  7. Verify that vfstab is now correct:
  8. root@patchtest-x4200-2 # grep c0t2d0s0 /etc/vfstab
    /dev/dsk/c0t2d0s0     /dev/rdsk/     /     ufs    1 no     -
    root@patchtest-x4200-2 # grep d10 /etc/vfstab
    root@patchtest-x4200-2 #
  9. Reboot the system (which will now boot from c0t2d0s0), and perform any software maintenance steps.

How to Rebuild the Mirror After the Software Update

  1. Redefine the boot device to d10.
  2. #metaroot d10

  3. Reboot the system.
  4. Add back the mirror:
  5. #metaattach d10 d12

  6. Let the sync complete prior to rebooting; examine metastat d10 to observe the sync progress.

How to Mount a Solaris Volume Manager Mirror While Booted From Media

If, for any reason, it becomes necessary to mount a Solaris Volume Manager mirrored metadevice while booted from media, for example, using boot net -s or boot cdrom -s, use the following steps as a guide.

Note: This applies only to the Solaris 10 Operating System.

In this scenario, we need to boot off alternate media and mount the Solaris Volume Manager metadevices, because the mirror was not split before it became necessary to boot off the alternate media. In this case, we need to do some manual work to enable us to mount the /dev/md/dsk/* metadevices onto /a.

So, assume the root disk is laid out as follows:

  • / on d10
  • /var on d20

The following was the state of the metadevices prior to booting off media:

root@oyster # metastat -p d10
d10 -m d11 d12 1
d11 1 1 c0t2d0s0
d12 1 1 c0t3d0s0
root@oyster #  metastat -p d20
d20 -m d21 d22 1
d21 1 1 c0t2d0s1
d22 1 1 c0t3d0s1
  1. First, boot from media, for example:
  2. #boot net -s

  3. Now mount one of the subdisks read-only, so that you cannot accidentally damage the subdisk.
  4. In this example, assume that the underlying disk is still accessible and data has not been corrupted.

    # mount -o ro /dev/dsk/c0t0d0s0 /a

  5. Then set up the current booted environment so that it can use Solaris Volume Manager:
  6. # cp /a/kernel/drv/md.conf /kernel/drv/md.conf
    # umount /a
  7. Update the Solaris Volume Manager driver to load the configuration:
  8. # update_drv -f md

    Note: Ignore any error messages from update_drv.

  9. Now run metainit to initialize all the metadevices.
  10. # metainit -r

  11. If you have mirrors, you should run metasync to get them synced at this point. Use metastat to see if a sync is required or has completed.
  12. After the sync has completed, then you can proceed to mount the meta devices:
# mount /dev/md/dsk/d10 /a
# mount /dev/md/dsk/d20 /a/var

Now you have the Solaris Volume Manager mirror mounted under the mountpoint /a.

For More Information

Here are some additional resources:

Updates

November 2009: Script was extended to collect additional data for detailed patch and package analysis.

Oracle Chatbot
Disconnected