From 6a717f31e67d54c785a899ddc7b7c086eaba7039 Mon Sep 17 00:00:00 2001 From: Christos Longros <98426896+chrislongros@users.noreply.github.com> Date: Mon, 23 Feb 2026 18:41:24 +0100 Subject: [PATCH] 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 Signed-off-by: Chris Longros Closes #18251 Closes #8236 --- cmd/zpool/zpool_main.c | 11 +++++++++-- lib/libzfs/libzfs_pool.c | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 463e3748e..265d7488d 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -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); diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 7da5c218d..0bfc9ff74 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -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); } /*