Forum Stats

  • 3,827,532 Users
  • 2,260,790 Discussions
  • 7,897,293 Comments

Discussions

Part 8 - Mirroring the ZFS Root Pool

steph-choyer-Oracle
steph-choyer-Oracle Member Posts: 101 Red Ribbon
edited Nov 17, 2016 2:12PM in Solaris 11

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:

[email protected]:~# zpool status rpool

  pool: rpool

state: ONLINE

  scan: none requested

config:

    NAME      STATE    READ WRITE CKSUM

    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:

[email protected]:~# zpool attach rpool c8t0d0 c8t3d0

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

[email protected]:~# 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

config:

    NAME        STATE    READ WRITE CKSUM

    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:

[email protected]:~# 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

[email protected]:~# zpool status rpool

  pool: rpool

state: ONLINE

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

config:

    NAME        STATE    READ WRITE CKSUM

    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

Comments

  • Your illustration shows how to mirror the data of rpool (the boot pool) but does not mention of replicating the boot block on the mirrored boot disks.    Oracle provides documentation for this: https://support.oracle.com/epmos/faces/DocumentDisplay?id=1020196.1.  The end of the article explains the differences between Solaris 10/11 and SPARC/x86

    Yura Scheglyuk
  • Your illustration shows how to mirror the data of rpool (the boot pool) but does not mention of replicating the boot block on the mirrored boot disks.    Oracle provides documentation for this: https://support.oracle.com/epmos/faces/DocumentDisplay?id=1020196.1.  The end of the article explains the differences between Solaris 10/11 and SPARC/x86

    Stephen

    Good evening. First, I'm sorry for delay to answer, but I was very sick and hospitalized.

    About the article, you are right. When I sent the article to Oracle, I skipped this part because I sent a previous version of article. That's my fault. I'm working on a fix and I'll be updating it soon. I'm sorry for mistake.

    Have a nice day and thanks for your message.

    Akexandre.

  • Hello ,

    Can I have any ACE contributions related to Solaris Cluster 4.3 ?

    Please suggest me with the link where I can find it

    -Thanks,

    Chowdary

  • 1055392
    1055392 Member Posts: 1

    Hi,

    My experience with ZFS is  the mirror is not working like in ufs. ZFS mirror disks can be boot from primary disk and mirror boot disk (secondary) if the mirror is not broken. otherwise wont' work.

    zfs Mirror is useful only when any of the disk failed (among disk1 ann disk2). I asked this question in all seminar and training session that why broken zfs mirror is not working like in ufs. No one know the correct answer and reason.

    you can update here if any one know.