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 thezpool import -F
command. These commands attempt to roll back the last few pool transactions to an operational state. You can use thezpool status
command to review a damaged pool and the recommended recovery steps. For example:$ zpool status pool: storpool 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 storpool 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 storpool
If you attempt to import a damaged storage pool, you will see messages similar to the following:
$ zpool import storpool cannot import 'storpool': 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 storpool'. 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 storpool Pool storpool 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 thezpool status
command. If the pool isn't in thezpool.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 storpool
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 thezpool 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.