Tuesday, August 17, 2010

Mirroring ZFS rpool

OK, time to mirror my rpool. Apparently, it rendered for that works with FreeBSD, but does not with Solaris. (WTF!?)
# zpool attach rpool c0t0d0 c0t1d0
cannot label 'c0t1d0': EFI labeled devices are not supported on root pools.
Ewww... :-(

Here is the steps to cure this illness:
  1. format -e will give you all the drives available.
  2. If you found one it needs to be formatted, use fdisk and create 100% Solaris2 partition.
  3. Your drive supposed to be in /dev/rdsk/ somewhere (don't forget to look in "rdsk", instead in "dsk"). In my case /dev/rdsk/c0t1d0
  4. Fix broken bones for the Disk Format:
    prtvtoc /dev/rdsk/c0t0d0 | fmthard -s - /dev/rdsk/c0t1d0
    Then fmthard should tell you something like: "New volume table of the contents now in place". If it didn't — you're out of luck and try to figure out why. :-)
  5. Try to attach a drive to rpool, but it may scream, something like this:
    zpool attach rpool c0t0d0 c0t1d0
    invalid vdev specification
    use '-f' to override the following errors:
    /dev/dsk/c0t0d0 overlaps with /dev/dsk/c0t1d0

    Well, so be it. Use '-f' option to force it:

    zpool attach -f rpool c0t0d0 c0t1d0

    Please be sure to invoke installgrub(1M) to make 'c0t1d0' bootable.
    Make sure to wait until resilver is done before rebooting.
  6. Normally, you're done: zpool status should show you a mirrored rpool. But you're almost there: still you need to install GRUB.
  7. Install GRUB this way:
    installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t1d0
Basically this is it, now you might try to boot from another drive. But wait your rpool resilvered though... :-)

No comments: