Files
nas-tools/check_space_after_unmount.sh
T

65 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# Check Space After Unmounting Photo Volume
set -e
echo "=== Space Check After Unmounting Photo Volume ==="
echo ""
FREE_SPACE=$(df / | tail -1 | awk '{print $4}')
FREE_SPACE_GB=$(echo "scale=2; $FREE_SPACE / 1024 / 1024" | bc)
CONTAINER_FREE=$(diskutil info / | grep 'Container Free' | awk '{print $4, $5}')
CONTAINER_USED=$(diskutil apfs list 2>/dev/null | grep "Capacity In Use" | awk '{print $6, $7}')
echo "📊 Current Status:"
echo " Free space: ${FREE_SPACE_GB}GB"
echo " Container free: $CONTAINER_FREE"
echo " Container used: $CONTAINER_USED"
echo ""
# Check if photo is still mounted
if mount | grep -q photo; then
echo "⚠️ Photo volume is still mounted"
else
echo "✅ Photo volume is unmounted"
fi
echo ""
echo "🔍 What's Actually Using Space:"
echo ""
echo "Top directories in /System/Volumes/Data:"
sudo du -h -d 1 /System/Volumes/Data 2>/dev/null | sort -hr | head -10 | awk '{printf " %8s %s\n", $1, $2}'
echo ""
echo "Your home directory:"
du -h -d 1 ~ 2>/dev/null | sort -hr | head -10 | awk '{printf " %8s %s\n", $1, $2}'
echo ""
echo "=== Analysis ==="
echo ""
if (( $(echo "$FREE_SPACE_GB < 5" | bc -l) )); then
echo "⚠️ Still critically low on space!"
echo ""
echo " The photo volume unmount didn't free space because:"
echo " - Those files were on the NAS (network), not local"
echo " - The 179GB was just the size of the network mount"
echo " - It wasn't actually consuming local disk space"
echo ""
echo " Your REAL space usage:"
echo " - Container: 492.9GB used (99.7% full)"
echo " - Your home: 130GB"
echo " - Other system files: ~360GB"
echo ""
echo " To free space, you need to:"
echo " 1. Clean Downloads: 8.7GB"
echo " 2. Clean Library/Caches: ~6GB"
echo " 3. Review Documents: 40GB (move large files to NAS)"
echo " 4. Review .ollama: 17GB (remove unused models)"
echo ""
else
echo "✅ You have ${FREE_SPACE_GB}GB free - this should be enough!"
fi
echo ""