Create a boot disk mirror on Solaris 10 x86

I�m setting up a boot disk mirror on Solaris 10 x86. I�m used to doing it on SPARC, where you can copy the partition table using fmthard. My x86 boot disk has 2 primary partitions, a Solaris one and a diagnostic one. Is there a way to copy those 2 primary partitions to the second disk without having to manually do it using fdisk? I can�t seem to find a method to do it. I would like to be able to do this from the command line so I can use it as part of a script to mirror the boot disk and as part of my script for disaster recovery.

fdisk -B /dev/rdsk/${Secondary_disk}p0

only creates a Solaris fdisk Primary Partition on Secondary disk, so I wouldn�t have the diag partition.

Boot disk - 0

format> fdisk
               Total disk size is 36351 cylinders
               Cylinder size is 16065 (512 byte) blocks
   
                                                 Cylinders
        Partition   Status    Type          Start   End   Length    %
        =========   ======    ============  =====   ===   ======   ===
            1                 Diagnostic        1     7       7      0
            2       Active    Solaris2          8  36337    36330    100
  

why not using ZFS to setup a mirrored rpool?

I agree with the "use zfs mirrored rpool" response. But if you want to use SVM to mirror the boot disk:

prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2

(man installgrub)
/usr/sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0

All good answers, however:
1-Boot disk is using UFS, so ZFS root pool mirroring is out.
2-prtvtoc ... | fmthard ... only copies the Solaris primary partition, not the diag primary partition. See below the result when I tried it earlier:

format> fdisk
             Total disk size is 36351 cylinders
             Cylinder size is 16065 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    Solaris2          1  36350    36350    100

HOWTO: Migrate a UFS Root Filesystem to ZFS � Col's Tech
and
Solaris � convert a single root UFS to a root ZFS mirror | Sonia Hamilton

To copy fdisk partition tables:

fdisk -W - /dev/rdsk/${primary_disk}p0 | fdisk -F - /dev/rdsk/${Secondary_disk}p0

Thanks, I just tried that before seeing your post and I can confirm that's what I needed to do. Then I would copy the boot disk Solaris partition table to the second disk:

prtvtoc /dev/rdsk/${Primary_disk}s2 | fmthard -s - /dev/rdsk/${Secondary_disk}s2

and

/sbin/installgrub -fm /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/${Secondary_disk}s0

then do the usual SVM commands for the slices

Finally, update the secondary disk as alternate bootpath in /boot/solaris/bootenv.rc file. (This can be done
by executing the eeprom command)

Example: eeprom altbootpath=�"
If you are not sure what the physical path is that belongs in the above ��. It is recommended you run the
following command:

# ls -la /dev/dsk/c#t#d#s#
This example was taken from an X2100 platform:

# ls -la /dev/dsk/c2d0s0
lrwxrwxrwx 1 root root 48 Sep 5 21:35 /dev/dsk/c2d0s0 -> ../../devices/pci@0,0/pci-ide@7/ide@1/cmdk@0,0:a
so the path that needs to added to the bootenv.rc file is eeprom

ls -la /dev/dsk/${Secondary_disk}s0

# eeprom altbootpath=�/pci-ide@7/ide@1/cmdk@0,0:a�

Did I miss any other weird x86 stuff?

---------- Post updated at 05:50 PM ---------- Previous update was at 05:35 PM ----------

I think I need to do this before installgrub:

Make the secondary submirror bootable with a master boot program.

Specify the master boot program.
# fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c1t1d0p0

    The following screen appears:

                 Total disk size is 31035 cylinders
                 Cylinder size is 1146 (512 byte) blocks

                                                   Cylinders
          Partition   Status    Type          Start   End   Length    %
          =========   ======    ============  =====   ===   ======   ===
              1        Active   Solaris           1  31034    31034    100


    SELECT ONE OF THE FOLLOWING:
       1. Create a partition
       2. Specify the active partition
       3. Delete a partition
       4. Change between Solaris and Solaris2 Partition IDs
       5. Exit (update disk configuration and exit)
       6. Cancel (exit without updating disk configuration)
    Enter Selection: 5

And this near the end:
Define the alternative boot path in the menu.lst file.

To enable the system to boot off of the disk that holds the secondary submirror, configure the system to
see the disk as the alternate boot device. In the current example, c1t1d0s0, the alternative path is on
the first slice of the first fdisk partition on the second disk. Thus, you would edit the menu.lst with
the following entry:

title alternate boot
 root (hd1,0,a)
 kernel /boot/multiboot
 module /boot/x86.miniroot-safe