Skip to content
  • Drive: 240 GB SSD (C:)
  • Goal: Maintain 50+ GB free for comfortable WSL development
  • Baseline: Windows + apps require ~150-170 GB, leaving 70-90 GB working space

  • Delete WSL crash dumps (~21 GB)

    Terminal window
    Remove-Item -Path "$env:TEMP\wsl-crashes" -Recurse -Force
  • Empty Recycle Bin (~3.4 GB)

    Terminal window
    Clear-RecycleBin -Force
  • Clear User Temp folder (~2 GB when accumulated)

    Terminal window
    Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
  • Investigate .gemini folder (9.2 GB) - unusually large

    Terminal window
    Get-ChildItem "C:\Users\Admin\.gemini" -Force | Select-Object Name, Length
    • Determine if safe to clear cache/temp data
  • Clear Chrome cache (up to 5 GB)

    • Chrome → Settings → Privacy → Clear browsing data → Cached images/files
    • Or: chrome://settings/clearBrowserData
  • Remove Playwright browsers if not actively using (~2 GB each location)

    • Windows: Remove-Item -Path "$env:LOCALAPPDATA\ms-playwright" -Recurse -Force
    • WSL: rm -rf ~/.cache/ms-playwright (run inside WSL)
  • Consolidate AI IDE caches (~5 GB recoverable)

    • Current: .vscode (2.2 GB), .windsurf (1.7 GB), .cursor (1.4 GB), .codeium (1.1 GB), .trae (1.1 GB)
    • Keep primary IDE, consider removing unused ones
    • Decision: Keep __________, remove __________
  • Review C:\xfer\bak (was 4.8 GB)

    • Archive to another drive or delete if obsolete
  • Relocate kopia cache (6.3 GB) to D: drive if possible


Save as C:\Scripts\cleanup-c-drive.ps1:

Terminal window
# Monthly C: drive cleanup
Write-Host "Starting C: drive cleanup..."
# Clear WSL crash dumps
if (Test-Path "$env:TEMP\wsl-crashes") {
$size = (Get-ChildItem "$env:TEMP\wsl-crashes" -Recurse | Measure-Object Length -Sum).Sum / 1GB
Remove-Item -Path "$env:TEMP\wsl-crashes" -Recurse -Force
Write-Host "Cleared WSL crashes: $([math]::Round($size, 2)) GB"
}
# Clear Temp folder (files older than 7 days)
Get-ChildItem -Path $env:TEMP -Recurse -Force -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-7) } |
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
# Report free space
$free = [math]::Round((Get-PSDrive C).Free / 1GB, 2)
Write-Host "Free space: $free GB"
  • Run Windows Disk Cleanup with system files

    Terminal window
    cleanmgr /d C /sageset:1 # Configure (first time)
    cleanmgr /d C /sagerun:1 # Run cleanup
  • Compact WSL virtual disk (after cleaning inside WSL)

    Terminal window
    wsl --shutdown
    wsl --manage Ubuntu-24.04 --set-sparse true
  • Check free space target

    Terminal window
    $free = [math]::Round((Get-PSDrive C).Free / 1GB, 2)
    if ($free -lt 30) { Write-Warning "Low disk space: $free GB" }

Add to %USERPROFILE%\.wslconfig:

[wsl2]
# Disable crash dumps (optional - loses debugging ability)
# crashReportFolder=
# Limit memory usage
memory=8GB
# Limit swap
swap=4GB
  • Use pnpm exclusively (already done ✓)
  • Periodically clean node_modules in inactive projects
  • Run pnpm store prune to clean unused packages
  • Inside WSL: sudo apt autoremove && sudo apt clean

ComponentTarget SizeNotes
Windows 11~40 GBSystem files
Program Files~25 GBBoth directories
WSL15-20 GBKeep compacted
User AppData~30 GBAfter cleanup
Working space50+ GBTarget free space
Total~190 GBLeaves ~50 GB buffer

Terminal window
# Check current free space
[math]::Round((Get-PSDrive C).Free / 1GB, 2)
# Find largest folders in AppData
Get-ChildItem "$env:LOCALAPPDATA" -Directory | ForEach-Object {
$size = (Get-ChildItem $_.FullName -Recurse -Force -EA 0 | Measure-Object Length -Sum).Sum
[PSCustomObject]@{ Folder = $_.Name; SizeGB = [math]::Round($size/1GB, 2) }
} | Sort-Object SizeGB -Descending | Select-Object -First 10
# Check WSL disk size
Get-ChildItem "$env:LOCALAPPDATA\Packages\*Ubuntu*\LocalState\*.vhdx" |
Select-Object Name, @{N='SizeGB';E={[math]::Round($_.Length/1GB, 2)}}