Part 8 - Mirroring the ZFS Root Pool

Version 20

    in Oracle Solaris 11.1


    by  Alexandre Borgesace-icon.gif

    Part 8 of a series that describes the key features of ZFS in Oracle Solaris 11.1 and provides step-by-step procedures explaining how to use them. This article focuses on how to mirror the ZFS root pool to minimize the risk of data loss.



    In many environments, it's advisable that the boot disk be mirrored to minimize the risk of loss. While this operation can take some time, the recipe for doing it is relatively simple.


    The boot disk is usually in a ZFS root pool called rpool. The first step to check is the pool's health:


    root@solaris11-1:~# zpool status rpool

      pool: rpool

    state: ONLINE

      scan: none requested




        rpool     ONLINE      0    0    0

        c8t0d0    ONLINE      0    0    0


    errors: No known data errors


    Now that we have confirmed that rpool is healthy, take a disk of equal or bigger size than the original rpool.


    Note: In previous Oracle Solaris versions, we had to prepare the chosen disk by relabeling it before including it in a mirrored pool. Starting in Oracle Solaris 11.1, a disk is automatically relabeled when it is attached to a pool.


    To mirror the rpool disk, including all its file systems and any snapshots in it, to a new disk named c8t3d0, run the following command:


    root@solaris11-1:~# zpool attach rpool c8t0d0 c8t3d0


    Make sure you wait until the resilvering is done before rebooting.


    root@solaris11-1:~# 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 Tue Jul  1 09:30:30 2014

        2.46M scanned out of 38.2G at 74.0K/s, 150h12m to go

        2.45M resilvered, 0.01% done





        rpool       DEGRADED    0    0    0

        mirror-0    DEGRADED    0    0    0

        c8t0d0      ONLINE      0    0    0

        c8t3d0      DEGRADED    0    0    0  (resilvering)


    errors: No known data errors


    If you want to monitor the newly attached disk's resilvering process, create the following simple shell script:


    root@solaris11-1:~# while true

    > do

    > zpool status | grep done

    > sleep 2

    > done

        2.11G resilvered, 5.54% done

        2.17G resilvered, 5.70% done

        2.19G resilvered, 5.74% done

        2.23G resilvered, 5.85% done

        2.26G resilvered, 5.92% done

        2.28G resilvered, 5.99% done

        2.33G resilvered, 6.12% done


    7.6G resilvered, 98.53% done

        37.7G resilvered, 98.81% done

        37.8G resilvered, 99.04% done

        37.9G resilvered, 99.32% done

        38.0G resilvered, 99.54% done

        38.1G resilvered, 99.82% done

        38.1G resilvered, 99.93% done

        38.2G resilvered, 100.03% done


    root@solaris11-1:~# zpool status rpool

      pool: rpool

    state: ONLINE

      scan: resilvered 38.2G in 2h4m with 0 errors on Tue Jul  1 10:30:15 2014




        rpool       ONLINE      0    0    0

        mirror-0    ONLINE      0    0    0

        c8t0d0      ONLINE      0    0    0

        c8t3d0      ONLINE      0    0    0


    Everything worked well, so the system can be booted using the alternative disk (use BIOS to initialize the system from the mirrored disk). For example, if this test is being done using Oracle VM VirtualBox, the alternative disk can be chosen by using the F12 key.


    See Also


    Here are some links to other things I've written:



    And here are some Oracle Solaris 11 resources:



    About the Author


    Alexandre Borges is an Oracle ACE for Oracle Solaris and has been teaching courses on Oracle Solaris since 2001. He worked as an employee and a contracted instructor at Sun Microsystems, Inc. until 2010, teaching hundreds of courses on Oracle Solaris (such as Administration, Networking, DTrace, and ZFS), Oracle Solaris Performance Analysis, Oracle Solaris Security, Oracle Cluster Server, Oracle/Sun hardware, Java Enterprise System, MySQL Administration, MySQL Developer, MySQL Cluster, and MySQL tuning. He was awarded the title of Instructor of the Year twice for his performance teaching Sun Microsystems courses. Since 2009, he has been imparting training at Symantec Corporation (NetBackup, Symantec Cluster Server, Storage Foundation, and Backup Exec) and EC-Council [Certified Ethical Hacking (CEH)]. In addition, he has been working as a freelance instructor for Oracle education partners since 2010. In 2014, he became an instructor for Hitachi Data Systems (HDS) and Brocade.


    Currently, he also teaches courses on Reverse Engineering, Windows Debugging, Memory Forensic Analysis, Assembly, Digital Forensic Analysis, and Malware Analysis. Alexandre is also an (ISC)2 CISSP instructor and has been writing articles on the Oracle Technical Network (OTN) on a regular basis since 2013.


    Follow us:
    Blog | Facebook | Twitter | YouTube