-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'zpool status -e' flag to see unhealthy vdevs
When very large pools are present, it can be laborious to find reasons for why a pool is degraded and/or where an unhealthy vdev is. This option filters out vdevs that are ONLINE and with no errors to make it easier to see where the issues are. Root and parents of unhealthy vdevs will always be printed. Testing: ZFS errors and drive failures for multiple vdevs were simulated with zinject. Sample vdev listings with '-e' option - All vdevs healthy NAME STATE READ WRITE CKSUM iron5 ONLINE 0 0 0 - ZFS errors NAME STATE READ WRITE CKSUM iron5 ONLINE 0 0 0 raidz2-5 ONLINE 1 0 0 L23 ONLINE 1 0 0 L24 ONLINE 1 0 0 L37 ONLINE 1 0 0 - Vdev faulted NAME STATE READ WRITE CKSUM iron5 DEGRADED 0 0 0 raidz2-6 DEGRADED 0 0 0 L67 FAULTED 0 0 0 too many errors - Vdev faults and data errors NAME STATE READ WRITE CKSUM iron5 DEGRADED 0 0 0 raidz2-1 DEGRADED 0 0 0 L2 FAULTED 0 0 0 too many errors raidz2-5 ONLINE 1 0 0 L23 ONLINE 1 0 0 L24 ONLINE 1 0 0 L37 ONLINE 1 0 0 raidz2-6 DEGRADED 0 0 0 L67 FAULTED 0 0 0 too many errors - Vdev missing NAME STATE READ WRITE CKSUM iron5 DEGRADED 0 0 0 raidz2-6 DEGRADED 0 0 0 L67 UNAVAIL 3 1 0 - Slow devices when -s provided with -e NAME STATE READ WRITE CKSUM SLOW iron5 DEGRADED 0 0 0 - raidz2-5 DEGRADED 0 0 0 - L10 FAULTED 0 0 0 0 external device fault L51 ONLINE 0 0 0 14 Signed-off-by: Cameron Harr <harr1@llnl.gov>
- Loading branch information
Showing
7 changed files
with
143 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_008_pos.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/bin/ksh -p | ||
|
||
# | ||
# CDDL HEADER START | ||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright (c) 2024 by Lawrence Livermore National Security, LLC. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# Verify 'zpool status -e' only shows unhealthy devices. | ||
# | ||
# STRATEGY: | ||
# 1. Create zpool | ||
# 2. Force DEGRADE vdev | ||
# 3. Verify only the DEGRADED vdev and parents show | ||
# | ||
|
||
function mkvdev | ||
{ | ||
for vdev in {1..$children};do | ||
truncate -s $MINVDEVSIZE $TESTDIR/vdev$vdev | ||
done | ||
} | ||
|
||
function cleanup | ||
{ | ||
log_must zinject -c all | ||
datasetexists $TESTPOOL2 && log_must zpool destroy $TESTPOOL2 | ||
rm -f $TESTDIR/vdev_a | ||
} | ||
|
||
log_assert "Verify 'zpool -e'" | ||
|
||
for raid_type in "draid" "raidz1"; do | ||
|
||
parity=1 | ||
data=4 | ||
spare=1 | ||
children=6 | ||
|
||
if [[ "$raid_type" = "draid" ]]; then | ||
raidfmt="draid${parity}:${data}d:${children}c:${spare}s" | ||
else | ||
raidfmt="raidz${parity}" | ||
fi | ||
|
||
log_must mkdir -p $TESTDIR | ||
log_must eval mkvdev | ||
log_must eval "zpool create -f -m /$TESTPOOL2 $TESTPOOL2 $raidfmt " \ | ||
"$TESTDIR/vdev1 $TESTDIR/vdev2 $TESTDIR/vdev3" \ | ||
"$TESTDIR/vdev4 $TESTDIR/vdev5" "$TESTDIR/vdev6" | ||
|
||
log_must check_vdev_state $TESTPOOL2 $TESTDIR/vdev4 "ONLINE" | ||
log_must zinject -d $TESTDIR/vdev4 -A degrade $TESTPOOL2 | ||
log_must eval "zpool status $TESTPOOL2" | ||
log_must check_vdev_state $TESTPOOL2 $TESTDIR/vdev4 "DEGRADED" | ||
log_must eval "zpool status -e $TESTPOOL2" | ||
log_mustnot eval "zpool status -e $TESTPOOL2 | grep ONLINE" | ||
cleanup | ||
done | ||
|
||
log_pass "Verify zpool status -e shows only unhealthy vdevs" |