From 3c397c6f1db34203ab6e057b0e1891d799de7100 Mon Sep 17 00:00:00 2001 From: "andrea.noni" Date: Wed, 30 Oct 2024 19:15:19 +0100 Subject: [PATCH] rewritten disk checks btrfs because of raid1 or single disk discrepances --- disks_checks.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/disks_checks.sh b/disks_checks.sh index f89f3c9..8c9cf09 100755 --- a/disks_checks.sh +++ b/disks_checks.sh @@ -66,12 +66,10 @@ mounted_btrfs_partitions="$(mount | grep btrfs | awk '{print $3}' | tr '\n' ',' for i in ${mounted_btrfs_partitions//,/ } do - # check btrfs errors on mounted device, if all output is 0 then return a single "1" + # check btrfs errors on mounted device, if all output is 0 then return a single "1" if 2 disks raid 1, or a 0 if single disk check_disk_errors=$(btrfs device stats $i | awk '{print $2}' | grep -c 0 -v) - if [ ${check_disk_errors} -eq 1 ] ; then - : # do nothing if output is a single "1" - else + if [ ${check_disk_errors} -gt 1 ] ; then echo Bad: - Btrfs is detecting errors on partition $i, some disk is about to be broken echo Sending alert... curl -k --retry 3 \