Disk Size of Backups
#!/bin/bash FILE_PATH="/BTRFS/ns/pveQNAP/vm/100/2026-03-27T19:00:06Z/drive-virtio0.img.fidx" TOTAL_SIZE=0 COUNT=0 while read -r line; do hash=$(printf '%s' "$line" | tr -d '"') length=$(printf '%s' "$hash" | wc -c) if [ "$length" -ne 64 ]; then continue fi prefix=$(printf '%s' "$hash" | cut -c1-4) path="/BTRFS/.chunks/${prefix}/${hash}" if [ -f "$path" ]; then # Usa du per ottenere la dimensione in byte size=$(du -b -- "$path" 2>/dev/null | awk '{print $1}') if [ -n "$size" ]; then TOTAL_SIZE=$((TOTAL_SIZE + size)) COUNT=$((COUNT + 1)) fi else echo "FILE NON TROVATO: $path" fi done < <(proxmox-backup-debug inspect file "$FILE_PATH") # Formatta il totale in modo leggibile if [ "$TOTAL_SIZE" -ge 1099511627776 ]; then total_human="$((TOTAL_SIZE / 1099511627776)) TB" elif [ "$TOTAL_SIZE" -ge 1073741824 ]; then total_human="$((TOTAL_SIZE / 1073741824)) GB" elif [ "$TOTAL_SIZE" -ge 1048576 ]; then total_human="$((TOTAL_SIZE / 1048576)) MB" elif [ "$TOTAL_SIZE" -ge 1024 ]; then total_human="$((TOTAL_SIZE / 1024)) KB" else total_human="$TOTAL_SIZE byte" fi echo "" echo "====================================================" echo "Riepilogo:" echo " File trovati: $COUNT" echo " Dimensione totale: $total_human ($TOTAL_SIZE byte)" echo "===================================================="