From cecc224dea7d5799ae33c4a8fc0640ad0a26d5bb Mon Sep 17 00:00:00 2001 From: BeauTroll <-> Date: Thu, 18 Dec 2025 15:43:12 +0100 Subject: [PATCH] Add disk-usage command to monitor backup server storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new make disk-usage command to display repository statistics and remote server disk space. This helps monitor storage usage and plan capacity. Changes: - Add disk-usage target to display Borg repository statistics - Show original, compressed, and deduplicated sizes - Display free disk space on remote backup server via SSH - Update .PHONY declaration with new target 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index eb58c94..b697c0f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Makefile pour Borgmatic - Agence66 # Usage: make [commande] -.PHONY: help install test backup list restore healthcheck logs status clean +.PHONY: help install test backup list restore healthcheck logs status clean disk-usage # Couleurs pour l'affichage BLUE := \033[0;34m @@ -55,6 +55,15 @@ info: ## Affiche les informations sur le repository @echo "$(BLUE)Informations sur le repository:$(NC)" @sudo bash -c 'set -a && source /etc/borgmatic/.env && set +a && borgmatic info' +disk-usage: ## Affiche l'espace disque utilisé et libre sur le serveur de backup + @echo "$(BLUE)Espace disque sur le serveur de backup:$(NC)" + @echo "" + @echo "$(YELLOW)Espace utilisé par le repository Borg:$(NC)" + @sudo bash -c 'set -a && source /etc/borgmatic/.env && set +a && borgmatic info --json 2>/dev/null | grep -o "\"stats\":{[^}]*}" | sed "s/[{}\"]//g" | tr "," "\n" | grep -E "original_size|compressed_size|deduplicated_size" || borgmatic info | grep -E "Original size|Compressed size|Deduplicated size"' + @echo "" + @echo "$(YELLOW)Espace libre sur le serveur distant:$(NC)" + @sudo bash -c 'set -a && source /etc/borgmatic/.env && set +a && SERVER=$$(echo $$BORG_REPO | sed "s|ssh://||" | cut -d"/" -f1) && ssh $$SERVER "df -h | grep -E \"Filesystem|$$\" | head -2"' + restore: ## Lance le script de restauration interactive @echo "$(BLUE)Restauration interactive...$(NC)" sudo ./scripts/restore.sh