Disk Full and Crashing: How to Urgently Recover Windows Disk Space
Published: May 13, 2026
Sometimes, you come across Windows machines that are crashing because they’ve run out of disk space. And even after you do the regular cleanup, it either fills up quickly or you need more space. Here’s something to add to your arsenal.
A .dmp files
Look for .dmp files. Use powershell to search for all dmp files and delete them.
B .msp files
There are these .msp files which are Windows Installer Patch files. There’s a high chance that some have been orphaned and Windows doesn’t delete them. Run the following in an elevated powershell window. We ran this on a three year old Windows machine and recovered 20GB, enough to give you time to get a new SSD or go through the documents.1
1: Check total size of the Windows Installer folder
"{0:N2} GB" -f ((Get-ChildItem "C:\Windows\Installer" -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum / 1GB)
2: Identify orphaned .msp files not registered to any installed product
$orphanedMsp = Get-ChildItem "C:\Windows\Installer" -Filter *.msp |
Where-Object {
$path = $_.FullName
$found = $false
Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData" -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.GetValueNames() -contains "LocalPackage" } |
ForEach-Object { if ($_.GetValue("LocalPackage") -eq $path) { $found = $true } }
-not $found
}
3: Report how many orphaned files were found and their total size
$orphanedMsp | Measure-Object -Property Length -Sum | Select-Object Count, @{N="GB";E={"{0:N2}" -f ($_.Sum/1GB)}}
4: Move orphaned .msp files to a safe backup location first
New-Item -ItemType Directory -Path "C:\temp\patch_backup" -Force
$orphanedMsp | Move-Item -Destination "C:\temp\patch_backup" -Verbose
5: Verify the move was successful
(Get-ChildItem "C:\temp\patch_backup").Count
6: Once satisfied, permanently delete them to reclaim the space
Remove-Item "C:\temp\patch_backup\*.msp" -Verbose
7: Confirm free space recovered
Get-PSDrive C | Select-Object Used, Free
C Stop Volume Shadow Copy
Generally this is taking up upwards of 3GB. If you’re desperately needing space, you can delete the copy and turn off the service.
In an elevated terminal, run these:
- Query
vssadmin list shadowstorage
- To delete
vssadmin delete shadows /for=C: /all /quiet
- To disable it thereafter
sc config vss start= disabled
- To verify everthing went okay, run the first ’list’ command again.
D Run compaction
In an elevated terminal, run these:
- Query the state of compaction and if the system allowed it be compacted
compact /CompactOs:query
- Fore-enable compaction
compact /CompactOs:always
- Force-disable compaction
compact /CompactOs:never
E Disable hibernation
- So you can delete hiberfile.sys which is always in several GBs.
Note
- Always use WinDirStat to get the state of disk usage first.
😁
-
Tested on Windows 11 Home Premium Build 26200, May 2026. ↩︎