script-drives-fix-btrfs-full 411 B

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