Guide · Windows Server
Why does the C: drive fill up on a Windows server?
A Windows server with a full C: drive slows down, cannot install updates, may stop services and can eventually stop working. This guide covers the most common reasons the C: drive fills up, how to find what is taking the space, and what you can safely clean up and what you must never touch.
Find it first: what is using the space?
Instead of deleting files on a hunch, find the large folders first. In PowerShell run as administrator, this command sorts the folders at the root of C: by size (it can take a few minutes on large disks):
Get-ChildItem C:\ -Directory -Force -ErrorAction SilentlyContinue | ForEach-Object { $s = (Get-ChildItem $_.FullName -Recurse -Force -File -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum; [pscustomobject]@{ Folder = $_.FullName; GB = [math]::Round($s / 1GB, 1) } } | Sort-Object GB -Descending | Select-Object -First 15
Go into the largest folder and run the same command for it to work your way down. Large files at the root, such as pagefile.sys and hiberfil.sys, are listed by Get-ChildItem C:\ -Force -File.
The most common causes
- WinSxS and update leftovers:
C:\Windows\WinSxSholds Windows components and older versions of updates, and grows over the years. Its size in Explorer looks larger than it really is, because most of its files are shared with other locations. - Windows Update cache: downloaded updates pile up in
C:\Windows\SoftwareDistribution\Download. - IIS logs: by default IIS writes its logs under
C:\inetpub\logs\LogFilesand never deletes them. On a busy web server they can reach tens of GB a year. - Application and SQL Server files: if SQL Server put its data, log and backup files on C: at installation, the disk fills as the databases grow. Error logs and trace files take space too.
- User profiles: on remote desktop servers every user's profile and temporary files build up under
C:\Users. - Temporary files:
C:\Windows\Tempand theAppData\Local\Tempfolders in profiles. - Memory dumps:
C:\Windows\MEMORY.DMP, written after a crash, can be as large as the memory; small dumps collect inC:\Windows\Minidump. - Page and hibernation files:
pagefile.sysgrows with the amount of memory. Servers rarely need hibernation; ifhiberfil.sysexists,powercfg /h offremoves it. - Shadow copies: previous versions (shadow copies) take space on the same disk.
vssadmin list shadowstorageshows how much is reserved.
Safe cleanup
- Clean up the component store. First see how much you would gain:
Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore. Then remove old components:Dism.exe /Online /Cleanup-Image /StartComponentCleanup. It can take a while; run it outside working hours. - Use Disk Cleanup. On installations with the Desktop Experience, "Clean up system files" in
cleanmgrsafely removes Windows Update leftovers and temporary files. - Delete IIS logs regularly. Set up a scheduled task that deletes logs older than a given number of days, or move the log folder to another disk. Set the retention to match your company's log retention rules.
- Delete old memory dumps. Once the cause of a crash has been examined, old dump files can go.
- Remove unused profiles. Delete the profiles of users who have left from System Properties › User Profiles; do not delete the folders by hand.
- Move growing data. Databases, backups and shared files belong on a separate data disk, not on C:. Moving SQL Server files needs planning; do it in a maintenance window.
- Extend the disk if needed. On virtual servers, extending C: is often the quickest way out. But extending it without fixing why it fills up only delays the problem.
Never delete by hand
- Files inside
C:\Windows\WinSxS: clean it only with DISM. Deleting by hand can break updates and Windows itself. C:\Windows\Installer: the repair and uninstall files of installed programs. Without them programs cannot be updated or removed.- Files under
C:\Windows\System32andC:\Program Files. pagefile.sys: change the page file in System Properties; never delete the file.- SQL Server data (.mdf) and log (.ldf) files: if a log file has grown, the fix is a log backup or a look at the recovery model; deleting the file breaks the database.
Prevent it from the start
When you install a new server, keep C: for the operating system and programs only. Put databases, backups, shared files and web logs on a separate data disk, and point the applications to it at installation. Give C: enough room for updates and growth; extending it later is not always possible. On virtual servers, separate data disks also make backup and migration easier.
Hear about it before it fills up
The best cleanup is the one done before the disk is full. Secura RMM watches the free space of every disk: it sends a warning when free space drops below 10%, and a critical alert below 5%; you can change the thresholds. The disk capacity and growth report shows which disk is filling and how fast. The agent only reads and reports; it never deletes a file. See alerts for details.
Frequently asked questions
Can I delete the WinSxS folder?
No. Shrink the WinSxS folder only with Dism.exe /Online /Cleanup-Image /StartComponentCleanup or with Disk Cleanup.
How much free space should C: have?
There is no fixed number, but leaving at least 10–15% and a few tens of GB free for updates and temporary files is a good start.
I cleaned the disk but it filled up again a few weeks later. Why?
Something is growing: usually log files, a database or backups. Compare the large folders a few weeks apart to find which one grows.
Related: Alerts · Windows server monitoring · SQL Server monitoring