Initial commit: combine nas_tool, nas_webdav, sync-utils

This commit is contained in:
Gan, Jimmy
2026-02-18 22:59:43 +08:00
commit 526c6a5521
77 changed files with 7898 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
#!/bin/bash
# Check Real Disk Space - Verify what's actually using space
# Sometimes the snapshot is a ghost but space is actually available
set -e
echo "=== Real Disk Space Analysis ==="
echo ""
# Multiple methods to check space
echo "Method 1: df command:"
df -h / | tail -1
echo ""
echo "Method 2: diskutil info:"
diskutil info / | grep -E "Volume (Free|Used|Total) Space" | sed 's/^/ /'
echo ""
# Check if snapshot actually exists
echo "Method 3: APFS Snapshot Check:"
APFS_TM_SNAPS=$(diskutil apfs listSnapshots / 2>/dev/null | grep -i "timemachine" || echo "None")
if [ "$APFS_TM_SNAPS" = "None" ]; then
echo " ✅ No Time Machine snapshot in APFS (ghost entry only)"
else
echo " ⚠️ Found: $APFS_TM_SNAPS"
fi
echo ""
# Check Time Machine status
echo "Method 4: Time Machine Status:"
TM_RUNNING=$(tmutil status 2>/dev/null | grep "Running" | awk '{print $3}' | tr -d ';')
if [ "$TM_RUNNING" = "1" ]; then
echo " ⚠️ Time Machine is running (may be creating new snapshots)"
else
echo " ✅ Time Machine is not running"
fi
echo ""
# Calculate actual space
FREE_KB=$(df / | tail -1 | awk '{print $4}')
FREE_GB=$(echo "scale=2; $FREE_KB / 1024 / 1024" | bc)
echo "=== Summary ==="
echo " Current free space: ${FREE_GB}GB"
echo ""
if (( $(echo "$FREE_GB < 5" | bc -l) )); then
echo "⚠️ Still low on space. The ghost snapshot entry is not the issue."
echo ""
echo "The real issue: Your disk is actually full (or nearly full)."
echo ""
echo "The 20GB from deleted files may have been:"
echo " 1. Used by Time Machine creating a new snapshot"
echo " 2. Used by other processes/files"
echo " 3. Actually freed but macOS hasn't updated the count yet"
echo ""
echo "Solutions:"
echo ""
echo "1. **Restart your Mac** - This will:"
echo " - Release any held snapshots"
echo " - Update disk space accounting"
echo " - Clear stuck processes"
echo ""
echo "2. Check what's really using space:"
echo " du -h -d 1 ~ | sort -hr | head -20"
echo ""
echo "3. Clean up large files:"
echo " - Downloads folder: $(du -sh ~/Downloads 2>/dev/null | awk '{print $1}')"
echo " - Library/Caches: $(du -sh ~/Library/Caches 2>/dev/null | awk '{print $1}')"
echo ""
echo "4. The ghost snapshot entry is harmless - ignore it."
echo " It will clear when Time Machine successfully backs up."
else
echo "✅ You have ${FREE_GB}GB free - this should be enough!"
echo ""
echo "The ghost snapshot entry can be ignored - it's not using space."
fi
echo ""