From 6a2770b559d94cea6c9ad7f0cac4072afdcbea6a Mon Sep 17 00:00:00 2001 From: Eric Lavigne Date: Mon, 28 Jul 2025 13:27:46 -0600 Subject: [PATCH] =?UTF-8?q?SERVER-108254:=20Only=20execute=20du=20on=20fil?= =?UTF-8?q?esystems=20that=20are=20getting=20full=20t=E2=80=A6=20(#39215)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitOrigin-RevId: 76b6940ec0849d442695a85d965e2cdc2e606f95 --- evergreen/full_disk_debug.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/evergreen/full_disk_debug.sh b/evergreen/full_disk_debug.sh index d287906cf55..82baec7bc7b 100755 --- a/evergreen/full_disk_debug.sh +++ b/evergreen/full_disk_debug.sh @@ -1,24 +1,30 @@ # What percent a filesystem has to be filled to be considered "full" FULL_DISK_THRESHOLD=90 HAS_FULL_DISK=false +declare -a FULL_DISKS # This will output the percent each filesystem is full in the following format: -# 91% /dev/root -# 7% /dev/nvme0n1p15 -# 34% /dev/nvme1n1 -FILESYSTEMS=$(df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }') +# 91% /dev/root / +# 7% /dev/nvme0n1p15 /System/Volumes/Data +# 34% /dev/nvme1n1 /System/Volumes/Update +FILESYSTEMS=$(df -H | grep -vE '^Filesystem|tmpfs|cdrom|map' | awk '{ print $5 " " $1 " " $9 }') while read -r output; do usep=$(echo "$output" | awk '{ print $1}' | cut -d'%' -f1) partition=$(echo "$output" | awk '{ print $2 }') + mountpoint=$(echo "$output" | awk '{ print $3 }') if [ $usep -ge $FULL_DISK_THRESHOLD ]; then echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" HAS_FULL_DISK=true + FULL_DISKS+=("$mountpoint") fi done <<<"$FILESYSTEMS" if $HAS_FULL_DISK; then - # print all files that are above one megabyte sorted - du -cha / 2>/dev/null | grep -E "^[0-9]+(\.[0-9]+)?[G|M|T]" | sort -h + echo "Checking disks" + for item in "${FULL_DISKS[@]}"; do + # print all files that are above one megabyte sorted + du -cha "$item" 2>/dev/null | grep -E "^[0-9]+(\.[0-9]+)?[G|M|T]" | sort -h + done else echo "No full partitions found, skipping" fi