summaryrefslogtreecommitdiff
path: root/tothebank.sh
diff options
context:
space:
mode:
authordoc <doc@filenotfound.org>2025-06-30 20:11:52 +0000
committerdoc <doc@filenotfound.org>2025-06-30 20:11:52 +0000
commit41e897f4945aaf8fbcdf0b12ac2f08c5e6ae0458 (patch)
treedb7c3520fd91abc3cf56b1a52095d23f3a80d059 /tothebank.sh
commit of legacy codeHEADmaster
Diffstat (limited to 'tothebank.sh')
-rwxr-xr-xtothebank.sh23
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"