diff options
Diffstat (limited to 'tothebank.sh')
-rwxr-xr-x | tothebank.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tothebank.sh b/tothebank.sh new file mode 100755 index 0000000..9522f6f --- /dev/null +++ b/tothebank.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Mastodon Media Audit: Find orphaned .part.* dirs & estimate space wasted +# For mounted MinIO (e.g., /assets/minio-data/mastodon) + +TARGET="/assets/minio-data/mastodon/" +LOG="/tmp/mastodon_zombie_audit.log" +REPORT="/tmp/mastodon_zombie_report.txt" + +echo "[*] Auditing .part.* zombie files under: $TARGET" | tee "$LOG" + +# Find all part.1 or similar that are actually directories +find "$TARGET" -type d -name "part.*" > "$REPORT" + +TOTAL=$(cat "$REPORT" | wc -l) +SIZE=$(du -shc $(cat "$REPORT" 2>/dev/null) 2>/dev/null | tail -1 | awk '{print $1}') + +echo "[✔️] Found $TOTAL suspicious .part.* directories" | tee -a "$LOG" +echo "[📦] Estimated wasted space: $SIZE" | tee -a "$LOG" + +echo "Top offenders:" | tee -a "$LOG" +du -sh $(cat "$REPORT" | head -n 20) 2>/dev/null | sort -hr | tee -a "$LOG" + +echo -e "\n🚨 To delete these, run:\n sudo xargs rm -rf < $REPORT" | tee -a "$LOG" |