Mirroring a ZFS root pool.

A quick guide to mirror a ZFS root pool:

1. Attach the new device to your root pool:
# zpool attach

2. Install the bootblock on the new device:
# installgrub /boot/grub/stage1 /boot/grub/stage2

# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk

3. Make sure your OS of choice knows about this. On Sparc you need to add the device to the OBP variable “boot-device”, and on x86 to the BIOS settings.

ZFS/zpool problems during boot.

Every now and then ZFS/a zpool can have problems during boot time, and here’s a way to solve them.

ok boot -m milestone=none
# mount / as writeable
/sbin/mount -o rw, remount /
# Remove or move the zpool cache, so ZFS "forgets" that zpools exist on this system
rm /etc/zfs/zpool.cache
# Determine which pools may have problems with
fmdump -eV
# boot to
svcadm milestone all
# then import the pools one by one, but skip the ones with reported problems
zpool import

This should get you on your way, and if all else fails rtfm. 😉