Managing ZFS File Systems in Oracle® Solaris 11.2

Exit Print View

Updated: December 2014
 
 

Repairing ZFS Storage Pool-Wide Damage

If the damage is in pool metadata and that damage prevents the pool from being opened or imported, then the following options are available to you:

  • You can attempt to recover the pool by using the zpool clear –F command or the zpool import –F command. These commands attempt to roll back the last few pool transactions to an operational state. You can use the zpool status command to review a damaged pool and the recommended recovery steps. For example:

    # zpool status
    pool: tpool
    state: UNAVAIL
    status: The pool metadata is corrupted and the pool cannot be opened.
    action: Recovery is possible, but will result in some data loss.
    Returning the pool to its state as of Fri Jun 29 17:22:49 2012
    should correct the problem.  Approximately 5 seconds of data
    must be discarded, irreversibly.  Recovery can be attempted
    by executing 'zpool clear -F tpool'.  A scrub of the pool
    is strongly recommended after recovery.
    see: http://support.oracle.com/msg/ZFS-8000-72
    scrub: none requested
    config:
    
    NAME      STATE     READ WRITE CKSUM
    tpool     UNAVAIL      0     0     1  corrupted data
    c1t1d0    ONLINE       0     0     2
    c1t3d0    ONLINE       0     0     4 

    The recovery process as described in the preceding output is to use the following command:

    # zpool clear -F tpool

    If you attempt to import a damaged storage pool, you will see messages similar to the following:

    # zpool import tpool
    cannot import 'tpool': I/O error
    Recovery is possible, but will result in some data loss.
    Returning the pool to its state as of Fri Jun 29 17:22:49 2012
    should correct the problem.  Approximately 5 seconds of data
    must be discarded, irreversibly.  Recovery can be attempted
    by executing 'zpool import -F tpool'.  A scrub of the pool
    is strongly recommended after recovery.

    The recovery process as described in the preceding output is to use the following command:

    # zpool import -F tpool
    Pool tpool returned to its state as of Fri Jun 29 17:22:49 2012.
    Discarded approximately 5 seconds of transactions

    If the damaged pool is in the zpool.cache file, the problem is discovered when the system is booted, and the damaged pool is reported in the zpool status command. If the pool isn't in the zpool.cache file, it won't successfully import or open and you will see the damaged pool messages when you attempt to import the pool.

  • You can import a damaged pool in read-only mode. This method enables you to import the pool so that you can access the data. For example:

    # zpool import -o readonly=on tpool

    For more information about importing a pool read-only, see Importing a Pool in Read-Only Mode.

  • You can import a pool with a missing log device by using the zpool import –m command. For more information, see Importing a Pool With a Missing Log Device.

  • If the pool cannot be recovered by either pool recovery method, you must restore the pool and all its data from a backup copy. The mechanism you use varies widely depending on the pool configuration and backup strategy. First, save the configuration as displayed by the zpool status command so that you can re-create it after the pool is destroyed. Then, use the zpool destroy –f command to destroy the pool.

    Also, keep a file describing the layout of the datasets and the various locally set properties somewhere safe, as this information will become inaccessible if the pool is ever rendered inaccessible. With the pool configuration and dataset layout, you can reconstruct your complete configuration after destroying the pool. The data can then be populated by using whatever backup or restoration strategy you use.