From 2952b54717eb9f32b5e0347e5f30ffee749e3953 Mon Sep 17 00:00:00 2001 From: Logan G Date: Tue, 26 Dec 2023 22:08:00 -0700 Subject: [PATCH] Merged scrub and balance loops I could not think of a good reason why I separated these, and it takes less time if they are in the same loop, so I merged them together --- usr/local/bin/btrfs-maintenance | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/usr/local/bin/btrfs-maintenance b/usr/local/bin/btrfs-maintenance index 8f96954..153e0ea 100755 --- a/usr/local/bin/btrfs-maintenance +++ b/usr/local/bin/btrfs-maintenance @@ -13,27 +13,20 @@ done PARTITIONS=($(echo ${PARTITIONS[@]} | tr ' ' '\n' | sort -u | tr '\n' ' ')) # Reallocate blocks that are less than 95% used +# Scrub all partitions for i in ${PARTITIONS[@]}; do { echo "Starting balance on $i" btrfs balance start -dusage=95 "$i" echo "Finished balance on $i" - } & -done -# Wait for balance operations to finish -wait - -# Scrub all partitions -for i in ${PARTITIONS[@]}; do - { echo "Starting scrub on $i" btrfs scrub start -B "$i" echo "Finished scrub on $i" } & done -# Wait for scrub operations to finish +# Wait for all operations to finish wait exit 0