Low disk space on Windows Server 2012
Low disk space is the most common issue in Windows Server 2012, comparing with data drives, the system C drive is very likely running out of space. When there is not enough free space left in C drive, to avoid server offline to reinstall, you should do something ASAP. In this article, I’ll give a clue about low disk space in Windows Server 2012 (R2) and how to solve this problem.
Why disk space running low
In daily usage, many types of files can eat up free space in C drive, such as:
- Windows updates, system restore point, hibernation, paging file. These files are in large size, so they use up free space very quickly.
- Logs, temp, cache, browser .etc These files are in small size but more and more produce continuously.
- 3rd-party application files. All applications install to C drive by default, even if you install to other drive, some files go to C drive forcedly.
- All files deleted without pressing Shift go to Recycle Bin, which is in C drive.
Even if the C drive is created large to 100GB when building the server, it runs out of space sooner or later.
Risk of low disk space
When the free disk space running low, you cannot install Windows updates or applications. Some Windows services such as backup and recovery stop working. It also cause operating system running much slower, stuck, reboot unexpectedly or even crash. So you’d better fix this issue as soon as possible, it is too late when the server down, causing data loss and disconnect with your users.
Create low disk space alert on Server 2012
You can setup a notification to alert when the disk drive runs low on disk space, example script as below:
$freespacethreshold = 17
# Setting path to servers.txt file for input later on…
$inputfilepath = $env:USERPROFILE + “\Desktop”
$inputfilename = “servers.txt”
$workingfile = $inputfilepath + “\” + $inputfilename
#does the file exist?
$fileexist = test-path $workingfile
if ($? -eq $false)
Write-Host “$inputfilename does not exist on $infputfilepath” -ForegroundColor Red -BackgroundColor Black
Write-Host “Please Create the file with one server per line that you want checked” -ForegroundColor Red -BackgroundColor Black
#read the file into a variable for later processing
$servers = Get-Content $workingfile
# Step 1 this is to check the disk space and alert if their is 10% or less free
foreach ($s in $servers)
$logicaldisks = Get-WmiObject -ComputerName $s Win32_Logicaldisk
Foreach ($l in $logicaldisks)
$totalsize = $l.size
$freespace = $l.freespace
if ($freespace -gt 0)
$percentagefree = ($freespace / $totalsize ) * 100
Write-Host $l.deviceid ” has ” $percentagefree “% free”
if ($percentagefree -lt $freespacethreshold)
Write-Host “Health Alert!” -ForegroundColor Red -BackgroundColor Black
Write-Host “Drive ” $l.deviceid ” has less the $freespacethreshold % free”
Add/Install Disk Cleanup for Server 2012
When disk space runs low on Windows Server 2012, the first option is freeing up space to reclaim free space. To do this, you may either use 3rd-party software or Windows built-in Disk Cleanup utility. I always suggest using Windows Disk Cleanup, because I’ve used it from Server 2003 many many times. It is easy to use, able to clean many types of files.
Steps to install/enable Disk Cleanup in Server 2012:
Step 1: Click Server Manager on bottom left, click the 2nd option “Add roles and features“.
Step 2: Click Next till you see the Features.
Step 3: Click the check-box in front of “Desktop Experience” and click Next.
Step 4: Within several minutes, the installation complete, click Close.
Step 5: Restart the server to finish adding features.
After booting to desktop, Open Windows Explorer, right click C drive and select Properties, you’ll see Disk Cleanup.
In the pop-up window, select the files you want to delete and click OK, redo this step to clean up system files.
Disk Cleanup is useful to help solve low disk space issue on Windows Server 2012 (R2). However, in some cases, you cannot free up plenty of disk space. Some people create C drive too small when building the server. In these situation, try to take some free space out of other drives and add the space to C drive, otherwise, you’ll encounter this problem in near future.
Increase C drive free space
Step 2: In the pop-up window, type the amount and select C drive in drop-down box.
Step 3: Press Apply button to proceed, done.
Video guide to extend C drive in Windows Server 2012 (R2)
(Recommend full screen by clicking the square at bottom right of this video)