SUN: Mirroring OS w/Solstice Disksuite

Title:SUN: Mirroring OS w/Solstice Disksuite
Author:Douglas O’Leary <dkoleary@olearycomputers.com>
Description:SUN: Mirroring OS w/Solstice Disksuite
Date created:08/2001
Date updated:09/2001
Disclaimer:Standard: Use the information that follows at your own risk. If you screw up a system, don’t blame it on me...

Solstice Disksuite can do quite a bit more than mirror the operating system. That, however, is all I’ve ever used it for. To find out what else it can do, and to find out how to do what else it can do, please see the Solstice Disksuite reference and users’ guide at http://docs.sun.com

The procedures below show how to go about initially configuring Solstice Disk suite, mirroring the / filesystem, then mirroring all operating system filesystems and swap.

State Database Replicas

State Database Replicas contain configuration and state information. There should be at least three of them. The system will continue to run as long as at least half of the state database replicas are available. It will panic if less than half of the state database replicas are available. The system will refuse to boot unless 1 more than half of the state database replicas are available (the old n+1 thing...)

Obviously, the state database replicas should be put on separate disks when/where possible to ensure availability. Use the following table as a guide to state database replica placement:

Disks Placement
1 3 all on one slice.
2-4 2 on each disk
5+ 1 on each disk

The logic for the “2 on each disk” middle entry is simple. Assume you have three disks and 2 state database replicas on one disk and one on the other. Now, the disk with the 2 replicas goes away. You now have less than half of the available replicas and your system panics and won’t reboot because there’s less than half plus one. Bummer.

There are three ways to initially create the State Database Replicas depending on how established your system is:

  1. Starting for scratch. Partition the disks and use slices that will become part of simple metadevices. Note that replicas cannot coexist with /, /usr, swap or any preexisting filesystem:

    metadb -c 2 -a -f c0t1d0s3 c1t1d0s3 c2t1d0s3 c3t1d0s3
    
    • -a

      Attach a new device

    • -f

      Force creation/deletion of database replica on listed device.

    • -c

      # Create the listed number of copies on the listed devices.

  2. Starting with existing empty slices: Ensure the slices are small as the replicas don’t take up a lot of space (517KB).

    1. If necessary, use format to repartition large slices into smaller ones.
    2. Use the metadb command as listed above to create the appropriate number of state database replicas on the (new) partitions.
  3. Starting with no unused slices: Need to steel a slice and repartition it (swap would be a good choice). The checklist below assumes you’re playing with swap. If not, then delete the partition, recreate two new ones, and restore from backup. You did backup the data, didn’t you?

    1. Shutdown and reboot into single user mode
    2. Use swap -l to ID current swap devices.
    3. Turn off swap on IDed partitions (swap -d)
    4. Use format to repartition swap slice. It’s probably easiest if you keep the same partition name for the swap slice. Otherwise, ensure you update /etc/vfstab and dumpadm.
    5. Use the metadb command as listed above to create the state database replicaas on the new partitions.

If, at some future point, you add additional disks and want to increase the number of state database replicas, execute metadb -a ${slice}. To delete state database replicas, execute metadb -d ${slice}

Mirroring /

Use the following procedure to mirror the / filesystem:

  1. Create a single concat using the slice that holds the / filesystem:

    metainit -f d11 1 1 c0t3d0s0
    
    • -f

      Forces the command to continue even if opeating on a mounted filesystem (like /, /usr, etc).

    • d11 The name of the new concat

    • 1 The number of stripes

    • 1 The number of slices making up the stripe

    • c0t3d0s0 Self explanatory; ensure you use the correct driver.

  2. Create a second concat:

    metainit d21 1 1 c1t3d0s0
    
  3. Set up a one-way mirror using the first concat:

    metainit d1 -m d11
    
  4. Run metaroot which updates the /etc/vfstab and /etc/system files w/appropriate disksuite information:

    metaroot d1
    
  5. Sync and flush any transactions:

    lockfs -fa
    
    • -f

      Flushes any active transactions

    • -a

      Do this on all mounted filesytems.

  6. Reboot

  7. Attach the second concat to the mirror:

    matattach d1 d21
    
  8. Record the alternate boot path; create a disk alias to boot from. See SUN: Open boot prom commands for syntax.

Mirroring other OS filesystems

Use the following procedure to mirror all other operating system related slices including swap.

  1. Create the first concat using the targeted mounted filesystem:

    metainit -f d12 1 1 c0t3d0s6
    
  2. Create the second concat on a separate disk:

    metainit d22 1 1 c1t3d0s6
    
  3. Create the one-way mirror using the first concat:

    metainit d2 -m d12
    
  4. Update the /etc/vfstab file to reflect the mirr vs dev for the filesystem. References to /dev/dsk/c0t3d0s6, for instance, should be replaced by /dev/md/dsk/d2

  5. Reboot

  6. Attach the second concat to the mirror:

    metattach d2 d22
    
  7. Do the same for every other operating system related partition. When mirroring swap, execute dumpadm -d /dev/md/dsk/${swap} to update the new dump location.