I am sponsoring the following fast-track for myself. This case introduces additional zpool sub-command options to support pool recovery. The case is requesting micro/patch binding. Timeout is 09/16/2009.
Template Version: @(#)sac_nextcase 1.68 02/23/09 SMI This information is Copyright 2009 Sun Microsystems 1. Introduction 1.1. Project/Component Working Name: zpool recovery support 1.2. Name of Document Author/Supplier: Author: Timothy Haley 1.3 Date of This Document: 09 September, 2009 4. Technical Description OVERVIEW: Uncooperative or deceptive hardware, combined with power failures or sudden lack of access to devices, can result in zpools without redundancy being non-importable. ZFS' copy-on-write and Merkle tree properties will sometimes allow us to recover from these problems. Only ad-hoc means currently exist to take advantage of this recoverability. This proposal aims to rectify that short-coming. PROPOSED SOLUTION: This fast-track proposes two new command line flags each for the 'zpool clear' and 'zpool import' sub-commands. Both sub-commands will now accept a '-F' recovery mode flag. When specified, a determination is made if discarding the last few transactions performed in an unopenable or non-importable pool will return the pool to an usable state. If so, the transactions are irreversibly discarded, and the pool imported. If the pool is usable or already imported and this flag is specified, the flag is ignored and no transactions are discarded. Both sub-commands will now also accept a '-n' flag. This flag is only meaningful in conjunction with the '-F' flag. When specified, an attempt is made to see if discarding transactions will return the pool to a usable state, but no transactions are actually discarded. PROPOSED CHANGES to ZPOOL(1M) PAGE: --- zpool.1m.rogi Thu Aug 27 09:59:14 2009 +++ zpool.1m Wed Sep 9 21:02:25 2009 @@ -18,7 +18,7 @@ zpool attach [-f] pool device new_device - zpool clear pool [device] + zpool clear [-n] [-F] pool [device] zpool create [-fn] [-o property=value] ... [-O file-system-property=value] @@ -44,11 +44,11 @@ zpool import [-o mntopts] [-p property=value] ... [-d dir | -c cachefile] - [-D] [-f] [-R root] -a + [-D] [-f] [-R root] [-n] [-F] -a zpool import [-o mntopts] [-o property=value] ... [-d dir | -c cachefile] - [-D] [-f] [-R root] pool |id [newpool] + [-D] [-f] [-R root] [-n] [-F] pool |id [newpool] zpool iostat [-v] [pool] ... [interval[count]] @@ -761,7 +761,7 @@ - zpool clear pool [device] ... + zpool clear [-n] [-F] pool [device] ... Clears device errors in a pool. If no arguments are specified, all device errors within the pool are @@ -769,7 +769,18 @@ errors associated with the specified device or devices are cleared. + -F Initiates recovery mode for a unopenable pool. + Attempts to discard the last few transactions in the + pool to return it to an openable state. Not all + damaged pools can be recovered by using this option. + If successful, the data from the discarded transactions + is irreversibly lost. + -n Used in combination with the -F flag. Check if + discarding transactions would make the pool openable, + but do not actually discard any transactions. + + zpool create [-fn] [-o property=value] ... [-O file-system- property=value] ... [-m mountpoint] [-R root] pool vdev ... @@ -1016,7 +1027,7 @@ zpool import [-o mntopts] [ -o property=value] ... [-d dir | - -c cachefile] [-D] [-f] [-R root] -a + -c cachefile] [-D] [-f] [-n] [-F] [-R root] -a Imports all pools found in the search directories. Identical to the previous command, except that all pools @@ -1075,6 +1086,17 @@ appears to be potentially active. + -F Recovery mode for a non-importable pool. + Attempt to return the pool to an + importable state by discarding the last + few transactions. Not all damaged pools + can be recovered by using this option. + If successful, the data from the + discarded transactions is irreversibly + lost. This option is ignored if the pool + is importable or already imported. + + -a Searches for and imports all pools found. @@ -1083,10 +1105,17 @@ "none" and the "altroot" property to "root". + -n Used with the -F recovery option. + Determines if a non-importable pool + can be made importable again, but does not + actually perform the pool recovery. For + more details about pool recovery mode, + see the -F option. + zpool import [-o mntopts] [ -o property=value] ... [-d dir | - -c cachefile] [-D] [-f] [-R root] pool | id [newpool] + -c cachefile] [-D] [-f] [-R root] [-F] [-n] pool | id [newpool] Imports a specific pool. A pool can be identified by its name or the numeric identifier. If newpool is specified, @@ -1153,6 +1182,17 @@ tially active. + -F + + Recovery mode for a non-importable pool. Attempt to + return the pool to an importable state by discarding the + last few transactions. Not all damaged pools can be + recovered by using this option. If successful, the data + from the discarded transactions is irreversibly lost. + This option is ignored if the pool is importable or + already imported. + + -R root Sets the "cachefile" property to "none" and the @@ -1159,7 +1199,15 @@ "altroot" property to "root". + -n + Used with the -F recovery mode option. Determines if a + non-importable pool can be made importable again, but + does not actually perform the pool recovery. For more + details about pool recovery mode, see the -F option. + + + zpool iostat [-v] [pool] ... [interval[count]] Displays I/O statistics for the given pools. When given @@ -1669,7 +1717,27 @@ # zpool iostat -v pool 5 + Example 14 Recovering a faulted ZFS pool + If a pool is faulted but recoverable, a message indicating so is + provided by 'zpool status' if the pool was cached (see cachefile + above), or as part of the error output from a failed 'zpool + import' of the pool. + + Recover a cached pool with the zpool clear command: + + # zpool clear -F data + Pool data returned to its state as of Tue Sep 08 13:23:35 2009. + Discarded approximately 29 seconds of transactions. + + If the pool configuration was not cached, use zpool import + with the recovery mode flag: + + # zpool import -F data + Pool data returned to its state as of Tue Sep 08 13:23:35 2009. + Discarded approximately 29 seconds of transactions. + + EXIT STATUS The following exit values are returned: 6. Resources and Schedule 6.4. Steering Committee requested information 6.4.1. Consolidation C-team Name: ON 6.5. ARC review type: FastTrack 6.6. ARC Exposure: open