#!/bin/bash # Find Real 351GB Usage in System Data # Since purgeable space test failed, the space is actually being used set -e echo "=== Find Real 351GB Usage in System Data ===" echo "" echo "The 50GB file creation FAILED, which means:" echo " - The 351GB is NOT purgeable" echo " - It's actually being used" echo " - We need to find what's using it" echo "" echo "📊 Container Analysis:" CONTAINER_TOTAL=$(diskutil info / | grep 'Container Total' | awk '{print $4, $5}') 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 " Container Total: $CONTAINER_TOTAL" echo " Container Free: $CONTAINER_FREE" echo " Container Used: $CONTAINER_USED" echo "" echo "📦 APFS Volume Breakdown:" diskutil apfs list 2>/dev/null | grep -E "Volume|Capacity Consumed" | while read line; do if echo "$line" | grep -q "Volume"; then VOL_NAME=$(echo "$line" | sed 's/.*Name: *\([^(]*\).*/\1/') echo " Volume: $VOL_NAME" elif echo "$line" | grep -q "Capacity Consumed"; then SIZE=$(echo "$line" | awk '{print $3, $4}') echo " Size: $SIZE" fi done echo "" echo "📸 APFS Snapshots:" APFS_SNAPS=$(diskutil apfs listSnapshots / 2>/dev/null) if [ -n "$APFS_SNAPS" ]; then echo "$APFS_SNAPS" | head -20 | sed 's/^/ /' echo "" echo " ⚠️ The OS update snapshot may be holding space" echo " This snapshot is NOT purgeable and can't be deleted" else echo " No snapshots found" fi echo "" echo "🔍 Large System Directories:" echo " /System:" sudo du -h -d 2 /System/Volumes/Data/System 2>/dev/null | sort -hr | head -5 | awk '{printf " %8s %s\n", $1, $2}' echo "" echo " /Library:" sudo du -h -d 2 /System/Volumes/Data/Library 2>/dev/null | sort -hr | head -5 | awk '{printf " %8s %s\n", $1, $2}' echo "" echo "🔍 Searching for large files (>10GB)..." echo " (This may take a moment)" LARGE_FILES=$(sudo find /System/Volumes/Data -type f -size +10G 2>/dev/null | head -5) if [ -n "$LARGE_FILES" ]; then echo "$LARGE_FILES" | while read file; do SIZE=$(sudo du -h "$file" 2>/dev/null | awk '{print $1}') echo " $SIZE $file" done else echo " No files >10GB found" fi echo "" echo "=== Analysis ===" echo "" echo "The 351GB in System Data is likely:" echo "" echo "1. **APFS Snapshot Overhead** (Most Likely)" echo " - The OS update snapshot (12.2GB visible)" echo " - May be holding 300+ GB of deleted file space" echo " - APFS snapshots preserve deleted files" echo " - This space is NOT purgeable until snapshot is deleted" echo "" echo "2. **Time Machine Local Snapshots**" echo " - The stuck snapshot entry" echo " - May be holding space even though it's a 'ghost'" echo "" echo "3. **System Reserved Space**" echo " - macOS reserves space for operations" echo " - Shown in System Data but not easily identifiable" echo "" echo "=== Solution ===" echo "" echo "The OS update snapshot CANNOT be deleted (it's required)." echo "However, you can try:" echo "" echo "1. **Update macOS** (if available):" echo " System Settings → General → Software Update" echo " Installing updates may clear old snapshots" echo "" echo "2. **Check for macOS Install Data** (11GB found):" echo " sudo rm -rf /System/Volumes/Data/macOS\ Install\ Data" echo " (Safe to delete after installation completes)" echo "" echo "3. **The space may be in APFS snapshot overhead**:" echo " This is space held by the OS update snapshot" echo " It will be released when you update macOS" echo "" echo "4. **Check Storage Management for details**:" echo " Apple Menu → About This Mac → Storage" echo " Hover over 'System Data' for more details" echo ""