Creating a ZFS Root Mirror in OpenSolaris

Unfortunately OpenSolaris doesn’t (or didn’t at the time of installing) provide a way of creating a root mirror when installing. So after completing your initial installation you have to manually create this.

Being a newcomer to Solaris/OpenSolaris I did a little searching and have put together a quick howto tutorial for creating a ZFS root mirror.

Creating your ZFS Root Mirror

  1. Install OpenSolaris to your first disk (will be referred to as Disk A from here on in). I’m not going to cover how to install OpenSolaris its fairly fool proof and if not there a plenty of guides out there.
  2. After installation remove your installation media and reboot.
  3. Login to your new installation.
  4. Open a terminal and get a list of your disks, use the format command and it will list all of your disks.
  5. In my case c4t0d0 is the disk i installed to (Disk A) and c4t1d0 is the disk I want to mirror to (Disk B).
  6. Select your mirror destination disk (Disk B – c4t1d0).
  7. Select fdisk.
  8. Create a standard Solaris partition over the full disk and then exit out of format.
  9. Now we must copy the partition table from Disk A to Disk B. prtvtoc is used to report information about a disk geometry and partitioning – the following combination of commands is used to copy a partition table from one disk to another. Again from the terminal run the command “prtvtoc /dev/rdsk/c4t0d0s2 | fmthard -s – /dev/rdsk/c4t1d0s2″. You should get a confirmation message stating “fmthard: New volume table of contents now in place.”
  10. Now we must attach Disk B to the ZFS Root Pool. To do this run the command “zpool attach -f rpool c4t0d0s0 c4t1d0s0″. You will get a confirmation reminding you to install grub and to wait for the sync (resilver) process to complete before rebooting.
  11. Lastly we must install Grub (bootloader) on to Disk B. Run the command “installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c4t1d0s0″.
  12. That is our ZFS Root Mirror created. Before rebooting, you should wait for the mirror to sync. You can check its status by running the command “zpool status rpool”. It will give its sync status and progress.
  13. Once sync is complete reboot and your are now running your rpool from a zfs mirror.

Testing / Recovering your ZFS Root Mirror

  1. You will probably want to test your mirror is good at this point. Pull Disk A and make sure everything still works and that you can boot and operate without Disk A being in place. Really do this now! You don’t want to find out down the line that things aren’t working…..
  2. Should the worst happen and a disk fails in the future, simply pull out the faulty disk, replace with a new disk, reboot and repeat the steps above. This using Disk B as the source and Disk C as the destination.

2 comments to Creating a ZFS Root Mirror in OpenSolaris

Add Comment Register

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>