See 2.1.1 below for Hipster (GPT) partitions.
First, we list the connected disks in the system. You can replace type(disk) with other options for different types of hardware configurations also. Try running cfgadm -al
# cfgadm -s "select=type(disk)" Ap_Id Type Receptacle Occupant Condition sata0/0::dsk/c3t0d0 disk connected configured ok sata0/1::dsk/c3t1d0 disk connected configured ok # zpool status rpool pool: rpool state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 c3t0d0s0 ONLINE 0 0 0
So c3t0d0 is disk 0 in rpool and c3t1d0 is disk 1, the disk we want to use as a mirror.
Now (on x86 only) we need to apply a default Solaris fdisk partition to a disk:
# pfexec format (choose disk 1, then run fdisk (here, choose Y to select the 100% Solaris partition))
Alternatively, this applies the same configuration automatically:
# pfexec fdisk -B c3t1d0p0 (p0 is the whole disk starting from the MBR)
Now we set up an SMI label with same partitioning as disk 0 on disk 1.
# pfexec prtvtoc /dev/rdsk/c3t0d0s2 | pfexec fmthard -s - /dev/rdsk/c3t1d0s2
Now we add the 2nd drive to our rpool by issuing:
# pfexec zpool attach -f rpool c3t0d0s0 c3t1d0s0
Now we wait for the resilver to finish on the 2nd drive (check with zpool status -v rpool).
Now it's time to make the second mirror half bootable.
# pfexec installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c3t1d0s0
Only thing left to do on an x86 system is add disk 1 to the BIOS' list of bootable devices!
ZFS handles mirroring rpools automagically (see: /etc/sysevent/config/SUNW,EC_zfs,ESC_ZFS_bootfs_vdev_attach,sysevent.conf) It will install grub onto the new attached disk.
Note: This should work but there is a bug: https://www.illumos.org/issues/6160#change-15117
So while this will work in the future because of the script that is ran on the add event, right now you still have to manually install the boot loader to the disk you add. I installed the bootloader after I Mirrored the rpool below.
So New disk is c2t50014EE65AC68D37d0
Find the full path that has the s0 on it then:
installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c2t50014EE65AC68D37d0s0
I had to change the dsk to rdsk. (Difference: http://www.unix.com/filesystems-disks-and-memory/6224-difference-dsk-rdsk.html)
root@host:~# zpool status pool: rpool state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 c2t50014EE65AC710BCd0 ONLINE 0 0 0 errors: No known data errors root@host:~# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c2t50014EE65AC68D37d0 <ATA-WDCWD10JFCX-68N-0A82 cyl 60798 alt 2 hd 255 sec 126> /scsi_vhci/disk@g50014ee65ac68d37 1. c2t50014EE65AC710BCd0 <ATA-WDC WD10JFCX-68N-0A82-931.51GB> /scsi_vhci/disk@g50014ee65ac710bc Specify disk (enter its number): ^C root@host:~# zpool attach rpool c2t50014EE65AC710BCd0 c2t50014EE65AC68D37d0 Make sure to wait until resilver is done before rebooting.
Be sure to configure your hardware to boot from both devices in case of failure.