Windows Server 2008: low disk space (SBS 2008 and SBS 2011)
Tuesday, 27 December 2011 05:43
The introduction of Windows Server 2008 brought a lot of remarkable changes compared to Windows Server 2000 / 2003; the most apparent one is its grown appetite for hard drive space. Out of the box Windows Server 2008 consumes a great amount on C-Drive. However it's only the beginning because a 2008 server often accumulates dozens of gigabytes on top of the post-installation size within one year. Low disk space issues and especially running out of spacle can lead to a wide variety of unpleasant consequences including crashing and database corruption.

First let's identify which files or folders might cause the low disk space problem:
  • hibernation file - c:\hiberfil.sys
  • memory swap file - c:\pagefile.sys
  • Windows Error Reporting - C:\programdata\microsoft\windows\wer\reportqueue
  • SharePoint Databases - C:\Windows\SYSMSI\SSEE\MSSQL.2005\
  • Component Store - C:\windows\WinSXS
  • Old LOG files - C:\inetpub\logs\LogFiles
  • Windows Server Update Services - C:\WSUS
plus data related to Small Business Server 2008 or SBS 2011:
  • Redirected Folders
  • User Folders
  • Exchange
  • SharePoint Services
  • WSUS depository
It makes sense to deploy a small (free) utilty Folder Size which would help you identify what takes the most space on your C-Drive. At that point we can start recovering hard drive space.  Even if you have a couple gigabytes available it could easily constitute a "low space problem". For instance an Exchange server would complain and refuse email traffic if it has less than 2GB available on C-drive due to its queue related data-paths (provided that Exchange databases are residing on a different partition). Having said that, we usually find a 10GB threshold to be a reasonable minimum criteria for free hard drive space.

Here we list potential remedies for disk space recovery. Of course, one shouldn't blindly implement any of the instructions below unless it's clearly understood what's being sacrificed or disabled! These recipes are merely a collection of useful actions that worked for us in the past; Allora does NOT guarantee that it'd work smoothly in your case and we take no responsibility for any undesired consequences (use at your own risk!)

Hibernation File

It's a bit unclear why a server would have a need to hibernate however this feature is turned ON by default and it's taking gigabytes of space (the actual number depends on the size of the physical memory). Luckily it's a trivial task to turn it off via Command Prompt:

powercfg.exe /hibernate off

Here's additional details on the subject: How to disable and re-enable hibernation.

Memory Swap File

Hopefully your system has plenty of physical memory and it hardly has to appeal to the Swap file. Although it's possible to disable it altogether we wouldn't recommend doing so by any means. What makes more sense is to transfer the Page file ( c:\pagefile.sys ) to another partition where your system has more space (d-drive, etc). In a nutshell you'd do it this way: right click "Computer" and choose Properties; then switch to Advanced -> Performance / Settings -> Advanced / Virtual Memory -> Change. Disable the swap file on the C-Drive and create one on D. You can find detailed instructions with illustrations at this link.

Windows Error Reporting

We should disable this feature first (provided that you indeed do NOT wish to participate in Microsoft's Error reporting program that helps improving the quality of the software):

  1. jump to Administrative Tools, and then clicking Server Manager.

  2. On the Server Manager home page, expand the Resources and Support area at the bottom.

  3. Click Configure Windows Error Reporting and switch it off.

Now you can safely remove all report files that potentially got accumulated under: C:\programdata\microsoft\windows\wer\reportqueue

SharePoint Databases

Over time SharePoint Databases increase in size considerably. It's fairly easy to remedy this problem provided that you are running SQL Server Express and have Management Studio deployed. Here's a great article with simple step-by-step instructions:

http://www.sharepointboris.net/2008/10/sharepoint-config-database-log-file-too-big-reduce-it/


Windows Update Services

Windows Server Update Services consists of the files carrying updates and a catalog database. Small Business Server management console comes with a simple Wizard that handles the data portion of the task of relocation WSUS data from C Volume to another. It makes sense to move the database as well; both operations are throughly explained at this URL: http://blogs.technet.com/b/sbs/archive/2009/09/23/how-to-move-wsus-content-and-database-files-to-a-different-partition.aspx

If we deal with a plain Windows Server 2008 we'd consider an alternative path:

  1. Moving content
  2. One can find a utility named WsusUtil located under WSUS Tools folder (Program Files\Update Services\Tools). The command for moving the content has this syntax:
    wsusutil movecontent contentpath logfile
    You'd need to create the "contentpath" first. Once the utility is finished the old folder can be deleted. Full instruction set by Microsoft can be found at this page
  • Moving data
    This can be done using the SBS 2008 recipe referenced above. Alternatively we could use a command prompt approach spelled here

Component Store

C:\windows\WinSXS folder is essential to Windows 2008 operations (more on its purpose in this article) and we can only remove a relatively small redundant portion of its data. COMPCLN.EXE is a utiltiy that comes with SP1, SP2 and R2. Typically it'd reduce 1-2GB of WinSXS size by removing files necessary for de-installation of a Service Pack.

Old Log Files

There are various log files pertaining to Windows components such as IIS or Active Directory as well as 3-rd party applications. Before cleaning up any of the logs files it's wise to compress and backup them up for potential audit or troubleshooting purposes.

First we must introduce an invaluable tool that is extremely useful for routine clean-up tasks and other maintenance tasks: CCleaner by Piriform (download CCleaner). It allows cleaning up IIS log files under Advanced section. Temporary directories, Memory dump files are selected for removal automatically which might free up a considerable amount of disk space.

A collegue of ours recommended a short script borrowed from SBSfaq.com that we quote below:
@echo off
rem Script to clean up disk space on SBS 2008 servers
rem Downloaded from SBSfaq.com
rem V1.0 - March 28th, 2010
rem Certificate Services Logs
net stop "Active Directory Certificate Services"
del c:\windows\system32\certlog\*.log
del c:\windows\system32\certlog\*.chk
del c:\windows\system32\certlof\*.jrs
net start "Active Directory Certificate Services"
rem IIS Log Files
Del C:\inetpub\logs\LogFiles\*.log /f /s

It's best used as a "quick&dirty" express recovery from low disk space issues VS an automated routine task because you don't want to delete log files indiscreetly.

SBS Native Wizards

Windows SBS Console comes with several Data migration wizards under Server Storage section. We already dealt with one of these earlier in the WSUS chapter. In our approach running all of them became an intricate part of the initial SBS setup.

Of course it is assumed that you have at least two Volumes on your server (C-drive and D, E, etc) If not we'd humbly recommend a complete reinstall for a number of good reasons that nevertheless falls out of the scope of this article.


If you'd rather outsource this taks and have an Allora technician working it out for you - please don't hesitate to contact us and schedule a service appointment.

 
Hover for comments:
Alexei M. Kisselev (Fri, 11 May 2012 15:36:01 -0400): I’m running Windows 7 – not a server Windows 2008, how do I gain / recover space on my C-Drive?
Allora Consulting (Sun, 17 Jun 2012 19:20:22 -0400): Alexei M. Kisselev, the best tool is probably CCleaner available at http://ccleaner.com for free. The utility is well aware of space hogs like Sun/Java and it does a clean job on identifying superfluous items and cleaning them up. Of course it's a good idea to start with Control Panel's Add/Remove programs in order to get rid of unnecessary programs. Also, you might free up some space via shrinking the Component Store (C:\windows\WinSXS) described above.
Roman Emphonic (Thu, 25 Jul 2013 06:50:30 -0400): Great tips! thx :)
Sherif Khairy (Tue, 13 May 2014 04:24:43 -0400): Thanks.