How to fix low disk space issue 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 Server 2012?
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 produced 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, and able to clean many types of files.
However, Disk Cleanup is not installed by default, before using it, you should install and enable.
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, click it.
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 fix 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 free space to C drive, otherwise, you’ll encounter the low disk space problem in near future.
Increase C drive free space
Actually, it is very easy to increase C drive free space by taking from other volumes. However, you should pay attention to Operating System and data safety. A bad program may cause system boot failure or data loss.
NIUBI Partition Editor integrated unique Roll-Back protection technology, which is able to roll back the server to the status before resizing automatically and rapidly, even if power failure or any other hardware issue occurred, so you don’t need to worry about Operating System and all data safety. Furthermore, it is 30% – 300% faster than ANY other tools by strictly testing, because of its unique file-moving algorithm.
Steps to resize partition and expand C drive:
Step 1: Download NIUBI Partition Editor, right click D: drive and select “Resize/Move Volume“.
Step 2: In the pop-up window, drag the left border rightwards to generate free Unallocated space.
You may also input a value for the Unallocated space directly.
Click OK and back to the main window, where you’ll see 20GB Unallocated space created behind C: drive.
Step 3: Drag the right border rightwards to hold the Unallocated space.
Step 4: Click OK and back to the main window, where you’ll see C drive extended to 60GB by robbing 20GB free space from D. Press Apply on top left to execute, done!
Video guide to fix low disk space issue on Server 2012 in fast way