From e4a55d533acee1191cf80f097683edcb1c40cd1b Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Sun, 25 Jan 2026 13:33:00 -0300 Subject: [PATCH] feat(lxc): auto-remove snapshots during cleanup --- scripts/utils/cleaner.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/utils/cleaner.sh b/scripts/utils/cleaner.sh index 711550890..ea0d30f52 100755 --- a/scripts/utils/cleaner.sh +++ b/scripts/utils/cleaner.sh @@ -43,6 +43,16 @@ echo -e "\n[ LXC CONTAINERS CLEANUP ]" # Check if LXC is installed if command -v lxc >/dev/null 2>&1; then + # Remove all snapshots from all containers + echo "Removing all LXC snapshots..." + for container in $(lxc list -c n --format csv | grep -v "^$"); do + snapshots=$(lxc list "$container" -c n --format csv -f snapshot) + if [ -n "$snapshots" ]; then + echo "Removing snapshots from container: $container" + lxc snapshot delete "$container" --all + fi + done + for container in $(lxc list -c n --format csv | grep -v "^$"); do echo -e "\nCleaning container: $container"