Improve disk space estimation messages in backup
Add compressed size estimation and better error handling: - Show both uncompressed (for safety) and estimated compressed size - Handle calculation failure gracefully with clear message - Estimate compression ratio at ~90% (divide by 10) - Add conditional check to prevent arithmetic errors Example output: - Espace requis (non compressé + 20%): 1.7GiB - Espace estimé après compression: 170MiB - Archive finale: 55MiB (actual result) This helps users understand why the required space seems larger than the final backup size (compression factor). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -106,7 +106,14 @@ if [ -z "$AVAILABLE_SPACE" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "INFO" "Espace requis (estimé): $(numfmt --to=iec-i --suffix=B "$REQUIRED_SPACE" 2>/dev/null || echo "$REQUIRED_SPACE bytes")"
|
# Calculer estimation avec compression (ratio moyen ~90%)
|
||||||
|
if [ "$REQUIRED_SPACE" -gt 0 ] 2>/dev/null; then
|
||||||
|
ESTIMATED_COMPRESSED=$((REQUIRED_SPACE / 10))
|
||||||
|
log "INFO" "Espace requis (non compressé + 20%): $(numfmt --to=iec-i --suffix=B "$REQUIRED_SPACE" 2>/dev/null || echo "$REQUIRED_SPACE bytes")"
|
||||||
|
log "INFO" "Espace estimé après compression: $(numfmt --to=iec-i --suffix=B "$ESTIMATED_COMPRESSED" 2>/dev/null || echo "$ESTIMATED_COMPRESSED bytes")"
|
||||||
|
else
|
||||||
|
log "INFO" "Espace requis: Impossible à calculer (utilisation du fallback)"
|
||||||
|
fi
|
||||||
log "INFO" "Espace disponible: $(numfmt --to=iec-i --suffix=B "$AVAILABLE_SPACE" 2>/dev/null || echo "$AVAILABLE_SPACE bytes")"
|
log "INFO" "Espace disponible: $(numfmt --to=iec-i --suffix=B "$AVAILABLE_SPACE" 2>/dev/null || echo "$AVAILABLE_SPACE bytes")"
|
||||||
|
|
||||||
# Comparaison sécurisée avec validation
|
# Comparaison sécurisée avec validation
|
||||||
|
|||||||
Reference in New Issue
Block a user