Cleaning up a server's C:\ drive. All known ways
Lastly, it would be nice to get an idea of what drive size you use for c:\ for whatever version of Windows you use.
Server 2003: We use 15GB C: drives for these now. We used to use 10GB ones, but the patch-dirs ate us out of house and home. We're not spinning up many of these any more, but if we do, 15GB is it.
Server 2008 & 2008R2: Microsoft itself is saying that 30GB is the number you should be aiming at. Seeing as how they made the patch-dirs nigh undeleteable with these server versions, I'm not going to doubt them. Currently we make our C: drives 20GB, but that's because we made our VM templates before this guidance emerged. We need to change it. 40 is probably better once you factor in 3rd party installers that resolutely stash things on C: no matter what you tell them.
I've used 'junction' by sysinternals to redirect folders like the software distribution directory, or windows search. You can also use the built in mklink command, but junction works on older versions of windows and can be standardized against in automated deployment scripts.
It works wonders for getting a server install running off of a space restricted EEEpc.
For more information on mklink: directory junction vs directory symbolic link?
For a step by step guide regarding specifically the patches directory, try this blog. Entry is appended below with some formatting modifications:
REDIRECTING UPDATES AND THE SOFTWARE DISTRIBUTION FOLDER USING JUNCTION TO ANOTHER HARD DRIVE
Scenario
You have a server with an 8 GB system partition and it keeps filling up. The software distribution folder used by windows updates is a major source of bloat and Microsoft support has said there is nothing you can do to move this folder from the C drive.
Solution
Using the Microsoft Junction Tool found on the Systernals site create a symbolic link to another hard drive or partition. I will use the terms symbolic link and junction interchangeably in this post.
Process
Stopping the Windows Update Service and renaming the folder
Start>Run type
cmd
and press enter typenet stop wuauserv
and press enter typerename c:\windows\SoftwareDistribution softwaredistribution.old
and press enterCreating a symbolic link using Junction
In this example the software distribution folder will be redirected from C:\WINDOWS\SoftwareDistribution to the D:\WINDOWS\SoftwareDistribution
Creating the Junction
To create the target directory from the command prompt
C:\>md D:\Windows\SoftwareDistribution
To create the Junction
C:\>junction C:\WINDOWS\SoftwareDistribution "D:\WINDOWS\SoftwareDistribution"
Restart the Windows Update Service
type
net start wuauserv
and press enterOnce everything has been verfieid to be working normally delete the softwaredistribution.old folder.
Jeff Loucks
(You may optionally copy the .old directory's contents into the new location).
In the interest of preserving the information in case the TechNet article moves, here is how to "activate" the Microsoft disk cleanup utility on server 2008 or 2008 R2:
Windows Server 2008 R2
64-bit
C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe
Windows Server 2008 R2
64-bit
C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui
Windows Server 2008
64-bit
C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui
Windows Server 2008
64-bit
C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe.mui
Windows Server 2008
32-bit
C:\Windows\winsxs\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_5dd66fed98a6c5bc\cleanmgr.exe.mui
Windows Server 2008
32-bit
C:\Windows\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe
Once you’ve located the files move them to the following locations:
Cleanmgr.exe should go in %systemroot%\System32.
Cleanmgr.exe.mui should go in %systemroot%\System32\en-US.
You can now launch the Disk cleanup tool by running Cleanmgr.exe from the command prompt.
IIS logs and Windows Error Reports.
- C:\inetpub\logs\LogFiles
- %LOCALAPPDATA%\CrashDumps
Find a program like SpaceMonger to find the space hogs.