diff --git a/roles/debian_server/files/btrfs-scrub b/roles/debian_server/files/btrfs-scrub index ac980d35477713f3f7284d53a0c3bd9a5c3a9483..28e124011e5d2548d2bcdd5c83eacd05f0a450be 100755 --- a/roles/debian_server/files/btrfs-scrub +++ b/roles/debian_server/files/btrfs-scrub @@ -5,6 +5,9 @@ for mp in $(lsblk --list --noheadings --output fstype,mountpoint | \ awk '$1 == "btrfs" {print $2}' | \ sort -u) do + # In case there are no btrfs volumes, the for loop will execute once with an + # empty string for mp. Validate that indeed we're passed a mountpoint. + [ -d "$mp" ] || continue status="$(btrfs scrub status "$mp" | awk '$1 == "Status:" {print $2}')" if [ "$status" = 'running' ] then