Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A collection of patches for pool recovery #4186

Closed
wants to merge 2 commits into from

Conversation

behlendorf
Copy link
Contributor

The per-vdev nvlist configuration information can be automatically
regenerated given a valid zpool.cache file. Extend the existing
'-F' recovery option to add this behavior for missing or corrupt
labels.

Signed-off-by: Brian Behlendorf behlendorf1@llnl.gov

@behlendorf
Copy link
Contributor Author

I'm posting this for review and feedback. I was able to use this patch to recreate all the vdev labels on a pool given only its cache file so it could be recovered. I'm not entirely thrilled with overloading the -F argument like this, but I'm also not sure we to add yet another command line option.

@ilovezfs
Copy link
Contributor

ilovezfs commented Jan 9, 2016

Given the way ZFS handles zpool.cache, the file is inherently transient and may or may not exist.

If this PR works well, would it make sense to start storing older copies of the zpool.cache file (on analogy to log rotation) rather than just updating it (import of pool already in cache file), adding a pool to it (import of pool not in cache file), expunging a pool from it (export of pool with other pools remaining), or deleting it (export of pool with no other pools remaining) in place?

I have for a while been keeping a zpool.cache.bak around which works fine for re-importing -c an exported pool when the real zpool.cache was either blown away or had the pool I want to import expunged from it due to export.

If zpool.cache is useful for recovery scenarios, it seems it would be a shame not to have a recent copy or copies of it deliberately kept around just in case.

@behlendorf
Copy link
Contributor Author

Log rotating the cache file is a interesting idea. I think that could make a lot of sense.

@richardelling
Copy link
Contributor

FWIW, it is common to implement the following in illumos:

  1. zpool import with cachefile (one per pool)
  2. sysevent watcher that triggers on one or more config changes (ESC_ZFS_config_sync at least) that then copies the cachefile or takes a snapshot of the cachefile's filesystem

The system default cachefile is really just a convenience and when it ceases to be convenient, it becomes hard to find a general-purpose solution. For example, /etc is node-specific, so /etc/zfs/* isn't general-purpose. That said, a directory of cachefiles approach is IMHO better than a single cachefile containing all pools.

@behlendorf behlendorf changed the title Allow -F to regenerate missing vdev labels A collection of patches for pool recovery Jun 7, 2016
The per-vdev nvlist configuration information can be automatically
regenerated given a valid zpool.cache file.  Extend the existing
'-F' recovery option to add this behavior for missing or corrupt
labels.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This patch will disable the logic which prevents you from rolling
back to an arbitrary txg.  Normally a txg which is older than the
last label update cannot be used for import.  There is no way to
know that the given txg is consistent with the current configuration.
This should only be used as a last resort for pool recovery when
you encounter the following failure mode.

$ zpool import -o readonly=on -T 123456 tank
cannot import 'tank': one or more devices is currently unavailable

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue openzfs#2452
@rlaager
Copy link
Member

rlaager commented Sep 27, 2016

The consensus seems to be for dropping this in favor of Pavel Zakharov's pending work, as discussed in the "SPA import and pool recovery" lightning talk.

@behlendorf
Copy link
Contributor Author

Sounds good, I'm looking forward to Pavel's patch. Closing.

@behlendorf behlendorf closed this Sep 27, 2016
@mailinglists35
Copy link

where can we track progress for the mentioned work/patch?

@rlaager
Copy link
Member

rlaager commented Oct 3, 2016

@mailinglists35 It's not published anywhere yet, as far as I know. It's mentioned here:
http://open-zfs.org/wiki/OpenZFS_Developer_Summit

ratson added a commit to ratson/zfs that referenced this pull request Jun 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants