System Administration Guide
Chapter 8, Administering virtual disks

Mirroring boot, swap, and root onto virtual disks

Mirroring boot, swap, and root onto virtual disks

You may want to mirror your system's boot, swap, and root divisions onto a virtual disk, to provide backup for them. You cannot install the operating system itself onto a disk array, but mirroring provides protection against intermittent disk problems. There are two possible configurations:

Mirroring the boot, swap, and root divisions on a secondary hard disk

This configuration protects against disk I/O errors and it also allows you to reboot your system from the parity disk should the root disk fail.

If you use SCSI disks, the extended SCSI BIOS on most systems can detect the first two disks in the system, and you can sometimes configure this to boot the system from either disk. We recommend that you set up the parity disk as the second SCSI disk in the system. It may also be possible to attach the data and parity disks to separate SCSI buses provided that the host adapters are of the same type.

The storage capacity of the secondary disk must be at least as large as the root disk because the divisions must have the same start and end blocks.


NOTE: We recommend that the root and parity disks have identical capacity, performance, and type (IDE, EIDE, or SCSI). Ideally, use the same model from the same manufacturer for each disk.

The parity disk must have the same size root partition as the root disk. The root partition must not contain any divisions or valid timestamps.


  1. If the parity disk does not contain a valid root partition, use the fdisk(ADM) command to define the partition. For example, enter fdisk -f /dev/rdsk/0s0 to discover the size of the root partition on the root disk. If the replacement disk is the second hard disk defined in the system, enter fdisk -f /dev/rdsk/1s0 to define a root partition on it.

  2. In the Virtual Disk Manager, select Mirror from the Boot menu.

  3. In the Select Divisions window, select Yes for each of the root, swap, and boot divisions. Click on OK to accept this.

  4. In the Piece Allocation window, select Yes to choose automatic piece allocation. Click on OK to accept this.

  5. In the Vdisk parameters window, click on OK to accept the default cluster size of 32. Change the value if you want to use a different cluster size for the mirrored divisions.

  6. Click on Allocate pieces to view the parity piece that will be used to mirror the three divisions. Click on OK to accept this.

  7. Click on Create to make the parity piece, division tables, and masterboot block on the parity disk.

  8. After the kernel has been relinked, exit from the Virtual Disk Manager.

  9. Shut down and reboot the system.

Mirroring any combination of the boot, swap, and root divisions individually onto parity disk pieces

The pieces do not have to exist on the same physical disk as each other, and they can be defined in any order on the same physical disk. Mirroring the divisions in this way only protects against disk I/O errors. You cannot boot your system from these disk pieces. If your root disk fails, you must reinstall the operating system and restore the boot and root filesystems from a backup.

  1. In the Virtual Disk Manager, select Mirror from the Boot menu.

  2. In the Select Divisions window, select which of the root, swap, and boot divisions you want to mirror. Click on OK to accept this. If you choose to mirror all three divisions, select No in the Piece Allocation window to reject automatic piece allocation.

  3. Define the individual disk pieces that will be used to mirror each division. See ``Allocating or modifying disk pieces''.

  4. Allocate a disk piece to each division, and click on Create to write the configuration changes to disk.

  5. After the kernel has been relinked and you have defined parity disks for all the divisions, exit from the Virtual Disk Manager.

  6. Shut down and reboot the system.


NOTE: Although the boot and root parity disks are updated when the system is rebooted, the swap parity disk is not updated because it does not contain any useful information.

Booting your system from a parity disk

If you choose to create a mirror of the root disk, it is possible to reboot a system from the parity disk if the root disk fails. To do this, you may have to reconfigure the system's hardware so that it recognizes the parity disk as the root disk:

IDE or EIDE disks
Remove the failed disk drive and configure the disk containing the mirror of the root disk as the ``Master'' device on the ``Primary'' controller.

SCSI disks
Remove the failed disk drive and configure the disk containing the mirror of the root disk with the same SCSI ID number as the root disk. Note that on most systems, the SCSI ID of the root disk is 0; on some IBM systems, the SCSI ID of the root disk is 6.

Alternatively, the extended SCSI BIOS on most systems can detect both root and parity disks when the machine is first turned on or reset, provided that both disks are attached to the same SCSI bus. If the root disk has failed and has been physically removed, it is usually possible to boot from the parity disk without reconfiguring its SCSI ID.

If the root disk has failed and has not been removed, and the BIOS can still detect its presence, the system will not be able to boot if the masterboot program on the root disk has become corrupted. In this case, use an emergency boot floppy to boot the system and specify an appropriate bootstring at the Boot prompt.

The following example bootstring defines that the executable kernel is located on the second hard disk defined in the system, that this disk is controlled by the SCSI disk driver, and that the root and swap divisions are accessible using the vdisk driver:

hd(72)unix hd=Sdsk root=vdisk(1) swap=vdisk(2) dump=none
For more information, see bootstring(HW).

Unmirroring boot, swap, or root

To remove a mirror from one or more of the root, swap, or boot divisions:

  1. In the Virtual Disk Manager, select Unmirror from the Boot menu.

  2. In the Select Mirrors window, select which of the root, swap, and boot divisions you want to remove mirroring from. Click on OK to accept this.

  3. After the kernel has been relinked, exit from the Virtual Disk Manager.

  4. Shut down and reboot the system.

Replacing a mirrored root or parity disk

To replace a defective root or parity disk when a mirror disk is available:

  1. Shut down the system and remove the failed disk drive.

  2. If the root disk has failed, reconfigure the parity disk to have the same IDE or SCSI configuration as the root disk. Alternatively, for SCSI disks, you can use a boot floppy to reboot the system in steps 4 and 5. In this case, you must specify an appropriate bootstring at the Boot prompt to define where to find the bootable kernel, for example:
    hd(72)unix hd=Sdsk root=vdisk(1) swap=vdisk(2) dump=none
    

  3. Install the replacement disk with the same IDE or SCSI configuration as the disk being replaced. If you reconfigured the parity disk as the root disk, configure the replacement disk as the new parity disk.


    NOTE: The root partition on the replacement disk must be the same size and have the same partition number as the root partition on the original disk. The root partition must not contain any divisions or valid timestamps. If the disk has been used on another system, clear its partition, division, and timestamp tables before using it as a replacement disk.

  4. If the replacement disk does not contain a valid root partition, reboot the system, place it in system maintenance mode, and use the fdisk(ADM) command to define the partition.

  5. Reboot the system and place it in multiuser mode. The system should recognize the replaced disk and start to recreate the data on the mirror.

  6. In the Virtual Disk Manager, select Recreate from the Boot menu.

  7. In the Select Mirrors window, select the divisions whose division table entries you want to recreate. You will normally want to select Yes for all three divisions. Click on OK to make a new division table and masterboot block on the parity disk. This will allow you to boot from this disk if the root disk fails.

See also: