script-drives-fix-btrfs-full 398 B

1234567891011121314151617181920
  1. #!/usr/bin/env bash
  2. # Fix the btrfs out of space error
  3. # Copyright 2021 Bryan C. Roessler
  4. parent="${BASH_SOURCE[0]}"
  5. parent=${parent%/*}
  6. [[ -f $parent/script-functions ]] && . "$parent"/script-functions || exit 1
  7. is_root
  8. fs=( "/mnt/array" "/mnt/backup" )
  9. # Discard empty blocks
  10. for f in "${fs[@]}"; do
  11. btrfs balance start -dusage=0 "$f"
  12. btrfs balance start -musage=0 "$f"
  13. done
  14. exit $?