BlogHow ToSolarisZFS

Adventures in ZFS: Mirrored Rpool

It always makes sense to have a mirrored rpool for your production systems, however, that is not always how they are configured.  This really simple procedure is also critical.

Create a Mirrored Zpool

Check the existing devices to identify the one currently in use.

# zpool status rpool<br />

  pool: rpool<br />

 state: ONLINE<br />

 scan: none requested<br />



 rpool ONLINE 0 0 0<br />

 c0t5000CCA0436359CCd0 ONLINE 0 0 0</p>

<p>errors: No known data errors

Once we know which one is currently in use, we need to find a different one to mirror onto.

# format<br />

Searching for disks…done</p>


  1. c0t5000CCA0436359CCd0 &lt;HITACHI-H109030SESUN300G-A606-279.40GB&gt;<br />

 /scsi_vhci/disk@g5000cca0436359cc<br />

 /dev/chassis/SPARC_T5-2.AK00176306/SYS/SASBP/HDD0/disk<br />

  1. c0t5000CCA043650CD8d0 &lt;HITACHI-H109030SESUN300G-A31A cyl 46873 alt 2 hd 20 sec 625&gt; solaris<br />

 /scsi_vhci/disk@g5000cca043650cd8<br />

 /dev/chassis/SPARC_T5-2.AK00176306/SYS/SASBP/HDD1/disk<br />

Specify disk (enter its number):

Then we can build our mirrored rpool, this part is exactly the same as creating a mirror for any other zpool.

# zpool attach rpool c0t5000CCA0436359CCd0 c0t5000CCA043650CD8d0<br />

vdev verification failed: use -f to override the following errors:<br />

/dev/dsk/c0t5000CCA043650CD8d0s0 contains a ufs filesystem.<br />

/dev/dsk/c0t5000CCA043650CD8d0s6 contains a ufs filesystem.<br />

Unable to build pool from specified devices: device already in use

Now in some cases, the new disk will have an existing file system on it, in that case we will need to force it, however please use caution when using force, this could cause you problems if you have multiple zpools on a system.

# zpool attach -f rpool c0t5000CCA0436359CCd0 c0t5000CCA043650CD8d0<br />

Make sure to wait until resilver is done before rebooting.

Now that will start the resilvering process, and we must wait for that to finish completely before rebooting.  So depending on the size of your disks it might be time for coffee or lunch.

# zpool status rpool<br />

 pool: rpool<br />

 state: DEGRADED<br />

status: One or more devices is currently being resilvered. The pool will<br />

 continue to function in a degraded state.<br />

action: Wait for the resilver to complete.<br />

 Run ‘zpool status -v’ to see device specific details.<br />

 scan: resilver in progress since Fri Nov 28 10:11:03 2014<br />

 224G scanned<br />

 6.67G resilvered at 160M/s, 2.86% done, 0h23m to go<br />



 rpool DEGRADED 0 0 0<br />

 mirror-0 DEGRADED 0 0 0<br />

 c0t5000CCA0436359CCd0 ONLINE 0 0 0<br />

 c0t5000CCA043650CD8d0 DEGRADED 0 0 0 (resilvering)</p>

<p>errors: No known data errors

Lets check again and see if this is nearly ready.

# zpool status rpool<br />

pool: rpool<br />

state: ONLINE<br />

scan: resilvered 224G in 0h27m with 0 errors on Fri Nov 28 10:38:25 2014<br />



rpool ONLINE 0 0 0<br />

mirror-0 ONLINE 0 0 0<br />

c0t5000CCA0436359CCd0 ONLINE 0 0 0<br />

c0t5000CCA043650CD8d0 ONLINE 0 0 0</p>

<p>errors: No known data errors

Now if you are just trying to mirror any zpool that is the end of it.  However if this is rpool then your mirror will not be worth anything if it doesn’t include the boot blocks.

Install Boot Blocks on SPARC

If your system is SPARC, you will use the installboot utility to install the boot blocks on the disk to ensure you will be able to boot from it in the event of primary disk failure.

# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0t5000CCA043650CD8d0s0<br />

WARNING: target device /dev/rdsk/c0t5000CCA043650CD8d0s0 has a versioned bootblock but no versioning information was provided.<br />

bootblock version installed on /dev/rdsk/c0t5000CCA043650CD8d0s0 is more recent or identical<br />

Use -f to override or install without the -u option

Again if this disk is not brand new it might have existing boot blocks on it which we will need to force overwrite.

# installboot -f -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0t5000CCA043650CD8d0s0

This wraps it up for a SPARC installation, it, of course, makes sense to test booting to the second disk as well.

Install Boot Blocks on x86

If you are using an x86 system, then you will need to use the installgrub utility.

# installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t5000CCA043650CD8d0s0

There you have it.  We have successfully mirrored our x86 system as well.

Leave a Reply

Your email address will not be published.