Improve misleading error messages for ZPOOL_STATUS_CORRUPT_POOL

When devices are missing or claimed by another subsystem (e.g.
mdadm, LVM), zpool import reports "The pool metadata is corrupted"
and suggests destroying the pool. This is misleading because the
metadata is not necessarily corrupted -- it may simply be incomplete
due to inaccessible devices.

Update the status, action, and recovery messages to acknowledge
that missing devices can trigger this status, and suggest checking
device availability before resorting to pool destruction.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chris Longros <chris.longros@gmail.com>
Closes #18251
Closes #8236
This commit is contained in:
Christos Longros 2026-02-23 18:41:24 +01:00 committed by GitHub
parent bbf0106c6b
commit 6a717f31e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -3456,7 +3456,7 @@ show_import(nvlist_t *config, boolean_t report_error)
case ZPOOL_STATUS_CORRUPT_POOL:
(void) printf_color(ANSI_YELLOW, gettext("The pool metadata is "
"corrupted.\n"));
"incomplete or corrupted.\n"));
break;
case ZPOOL_STATUS_VERSION_OLDER:
@ -3704,6 +3704,12 @@ show_import(nvlist_t *config, boolean_t report_error)
(void) printf(gettext("Set a unique system hostid with "
"the zgenhostid(8) command.\n"));
break;
case ZPOOL_STATUS_CORRUPT_POOL:
(void) printf(gettext("The pool cannot be imported due "
"to missing or damaged devices. Ensure\n"
"\t%sall devices are present and not in use by "
"another subsystem.\n"), indent);
break;
default:
(void) printf(gettext("The pool cannot be imported due "
"to damaged devices or data.\n"));
@ -10616,7 +10622,8 @@ print_status_reason(zpool_handle_t *zhp, status_cbdata_t *cbp,
case ZPOOL_STATUS_CORRUPT_POOL:
(void) snprintf(status, ST_SIZE, gettext("The pool metadata is "
"corrupted and the pool cannot be opened.\n"));
"incomplete or corrupted and the pool cannot be "
"opened.\n"));
zpool_explain_recover(zpool_get_handle(zhp),
zpool_get_name(zhp), reason, zpool_get_config(zhp, NULL),
action, AC_SIZE);

View File

@ -2053,7 +2053,9 @@ zpool_explain_recover(libzfs_handle_t *hdl, const char *name, int reason,
no_info:
(void) strlcat(buf, dgettext(TEXT_DOMAIN,
"Destroy and re-create the pool from\n\ta backup source.\n"), size);
"Ensure all pool devices are present and accessible, then "
"retry the import.\n\tIf the problem persists, destroy and "
"re-create the pool from a backup source.\n"), size);
}
/*