diff options
Diffstat (limited to 'squeakyclean.sh')
| -rwxr-xr-x | squeakyclean.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/squeakyclean.sh b/squeakyclean.sh new file mode 100755 index 0000000..bb1e754 --- /dev/null +++ b/squeakyclean.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +echo "=== LXD Storage Pool Check and Cleanup Helper ===" + +# List all containers with their active storage pool +echo +echo "Container -> Storage Pool:" +for container in $(lxc list --format csv -c n); do + pool=$(lxc config device get "$container" root pool 2>/dev/null) + echo "$container -> ${pool:-default}" +done + +echo +echo "=== Checking for leftover partial volumes in /mnt/infernode_lxd (NFS) ===" +if mountpoint -q /mnt/infernode_lxd; then + leftovers=$(find /mnt/infernode_lxd -mindepth 1 -maxdepth 1) + if [[ -z "$leftovers" ]]; then + echo "No leftover volumes found. Clean as a whistle!" + else + echo "Found leftover items:" + echo "$leftovers" + echo + read -p "Do you want to remove these? (y/n) " confirm + if [[ "$confirm" == "y" ]]; then + sudo rm -rf /mnt/infernode_lxd/* + echo "Leftovers removed!" + else + echo "Leaving leftovers untouched for now." + fi + fi +else + echo "NFS mount not found at /mnt/infernode_lxd. Skipping leftover check." +fi + +echo +echo "=== Done! ===" |
