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
This commit is contained in:
Logan G 2023-12-26 22:08:00 -07:00
parent 433dc2d9e7
commit 2952b54717
Signed by: logan
GPG key ID: E328528C921E7A7A

View file

@ -13,27 +13,20 @@ done
PARTITIONS=($(echo ${PARTITIONS[@]} | tr ' ' '\n' | sort -u | tr '\n' ' ')) PARTITIONS=($(echo ${PARTITIONS[@]} | tr ' ' '\n' | sort -u | tr '\n' ' '))
# Reallocate blocks that are less than 95% used # Reallocate blocks that are less than 95% used
# Scrub all partitions
for i in ${PARTITIONS[@]}; do for i in ${PARTITIONS[@]}; do
{ {
echo "Starting balance on $i" echo "Starting balance on $i"
btrfs balance start -dusage=95 "$i" btrfs balance start -dusage=95 "$i"
echo "Finished balance on $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" echo "Starting scrub on $i"
btrfs scrub start -B "$i" btrfs scrub start -B "$i"
echo "Finished scrub on $i" echo "Finished scrub on $i"
} & } &
done done
# Wait for scrub operations to finish # Wait for all operations to finish
wait wait
exit 0 exit 0