Adventures in ZFS: Mirrored Rpool

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
  pool: rpool
 state: ONLINE
 scan: none requested
config:

 NAME STATE READ WRITE CKSUM
 rpool ONLINE 0 0 0
 c0t5000CCA0436359CCd0 ONLINE 0 0 0

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
Searching for disks...done

AVAILABLE DISK SELECTIONS:
 0. c0t5000CCA0436359CCd0 <HITACHI-H109030SESUN300G-A606-279.40GB>
 /scsi_vhci/disk@g5000cca0436359cc
 /dev/chassis/SPARC_T5-2.AK00176306/SYS/SASBP/HDD0/disk
 1. c0t5000CCA043650CD8d0 <HITACHI-H109030SESUN300G-A31A cyl 46873 alt 2 hd 20 sec 625> solaris
 /scsi_vhci/disk@g5000cca043650cd8
 /dev/chassis/SPARC_T5-2.AK00176306/SYS/SASBP/HDD1/disk
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
vdev verification failed: use -f to override the following errors:
/dev/dsk/c0t5000CCA043650CD8d0s0 contains a ufs filesystem.
/dev/dsk/c0t5000CCA043650CD8d0s6 contains a ufs filesystem.
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
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
 pool: rpool
 state: DEGRADED
status: One or more devices is currently being resilvered. The pool will
 continue to function in a degraded state.
action: Wait for the resilver to complete.
 Run 'zpool status -v' to see device specific details.
 scan: resilver in progress since Fri Nov 28 10:11:03 2014
 224G scanned
 6.67G resilvered at 160M/s, 2.86% done, 0h23m to go
config:

 NAME STATE READ WRITE CKSUM
 rpool DEGRADED 0 0 0
 mirror-0 DEGRADED 0 0 0
 c0t5000CCA0436359CCd0 ONLINE 0 0 0
 c0t5000CCA043650CD8d0 DEGRADED 0 0 0 (resilvering)

errors: No known data errors

Lets check again and see if this is nearly ready.

# zpool status rpool
pool: rpool
state: ONLINE
scan: resilvered 224G in 0h27m with 0 errors on Fri Nov 28 10:38:25 2014
config:

NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c0t5000CCA0436359CCd0 ONLINE 0 0 0
c0t5000CCA043650CD8d0 ONLINE 0 0 0

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
WARNING: target device /dev/rdsk/c0t5000CCA043650CD8d0s0 has a versioned bootblock but no versioning information was provided.
bootblock version installed on /dev/rdsk/c0t5000CCA043650CD8d0s0 is more recent or identical
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 a 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.

 

2 thoughts on “Adventures in ZFS: Mirrored Rpool

    1. matthew.mattoon Post author

      The process has changed to install the boot blocks in 11.1 but it is still required on x86.

      # bootadm install-bootloader