20

I have a c:\ on a server that is filling up, most likely due to the accumulation of patches over the years.

I'm told by Microsoft PSS Support that it is unwise to simply delete the compressed uninstall directories within the \Windows directories. Considering that we have 100's of windows servers, this scattering of patches is consuming at significant amount of space on our SAN (these windows servers are in VMWare).

Can you tell me what I can do, besides the list below, to clean up space on the C:\ drive? I'm hoping that you may have more insight than the recommendation I received.

  1. Don’t set your Virtual Memory pagefile.sys on C drive.(System Properties\Performance settings\Advanced\change Virtual memory)

  2. Clear temp files (C:\windows\temp and C:\Users\%Username%\AppData\Local\Temp).

  3. Don’t set your temporary Internet files on C drive.(Internet Options\Browsing history settings\move folder)

  4. Move the Windows Search Service Database. If you have started Microsoft Search services, please move Windows.edb file to another drive.

    ( C:\ProgramData\Microsoft\Search\Data\Applications\Windows )

  5. Compress folders to save disk space and use disk cleanup

  6. Use mount point to mount an additional drive.

  7. “Compln.exe” can only be used to clean Service Pack, such as (RTM and SP1). In your system Windows server 2008 r2, it don’t contain any service pack. It cannot clean the patches in your system.

  8. ???? (not sure what this idea is) "Microsoft provide the built-in tool – disk cleanup .(You need to install a feature called "Desktop Experience" to get Disk Cleanup.) "

What other things can be done to clean up your server and free up space?

Lastly, it would be nice to get an idea of what drive size you use for c:\ for whatever version of Windows you use.

Alex.K.
  • 167
  • 2
  • 2
  • 8
makerofthings7
  • 8,821
  • 28
  • 115
  • 196
  • No definite answer, might be best as a wiki – Bart Silverstrim Sep 29 '10 at 14:02
  • That said...not wise to delete the compressed patches in c:\Windows, but if they're old (and won't see having to uninstall the patches), I've been known to move them to temporary consolidated storage, then delete them if there's no side effects. Also if backups are taken religiously then moving the compressed patch dirs shouldn't cause much headache to restore if they're needed. Not the best practice I'm first to admit, but it sheared some excess storage for us (and nothing horrible happened.) – Bart Silverstrim Sep 29 '10 at 14:04
  • For future reference, you can "activate" the built in Microsoft drive cleaner utility without installing the desktop experience. Follow the steps outlined in [this](https://technet.microsoft.com/en-us/library/ff630161%28v=ws.10%29.aspx) technet article. – Viertaxa Feb 09 '15 at 14:40
  • did anyone find a solution to this?I am experiencing the same problem –  Jun 09 '15 at 08:36

8 Answers8

8

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 type net stop wuauserv and press enter type rename c:\windows\SoftwareDistribution softwaredistribution.old and press enter

  • Creating 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 enter

    Once 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).

Ape-inago
  • 271
  • 1
  • 3
  • 8
8

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.

Viertaxa
  • 201
  • 2
  • 6
  • For older in installs this can free up 10+ GBs. Make sure you click the "Clean up system files" button and it'll nuke all the accumulated windows update install files that have already been applied. – Molomby May 14 '17 at 15:09
7

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.

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296
  • 3
    We are finding that 40GB is too small for 2008 these days with the continual growth of the Winsxs folder. Every time a patch, service pack or new DLL is installed, that folder can grow larger. – Doug Luxem Sep 29 '10 at 14:35
6

IIS logs and Windows Error Reports.

  1. C:\inetpub\logs\LogFiles
  2. %LOCALAPPDATA%\CrashDumps

Find a program like SpaceMonger to find the space hogs.

floyd
  • 1,530
  • 4
  • 18
  • 30
3

If it's 2008 R2, you can attempt to run dism /online /cleanup-image /spsuperseded. That will get back some space if you've installed SP1 since the initial install. If it was slipstreamed, I doubt you'll get any space back, however.

Bigbio2002
  • 2,763
  • 11
  • 34
  • 51
  • Related link: http://blogs.technet.com/b/askpfeplat/archive/2015/02/09/how-to-reduce-the-size-of-the-winsxs-directory-and-free-up-disk-space-on-windows-server-2012-r2-and-windows-8-1-or-do-we-even-need-to.aspx – makerofthings7 Feb 23 '15 at 18:28
3

A little less known but worth mentioning: Windows Update stores the updates it downloads in C:\Windows\SoftwareDistribution\Download; and they are not deleted after having been installed, thus the folder can grow to be quite large over time.

After new updates are installed, you can safely empty that folder and reclaim some disk space.

Massimo
  • 68,714
  • 56
  • 196
  • 319
3

There are two more clean up commands that help reducing system, of course after running them such updates will not be able to be uninstalled.

For Service Packs:

  • dism /Online /Cleanup-Image /SPSuperseded /HideSP

For Windows UpDates:

  • dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase

Both can take a lot of time to run.

Just some advice:

  1. Do not run them if you want to uninstall updates
  2. New updates will be able to be uninstalled until you re-run the command
  3. They must be run with admin rights
  4. They can take a lot of time, on my virtual Windows 10 Home, it took hours after cumulative updates
  5. Do not run them just after updates, let the computer reboot between updates and then clean
  6. If on Windows 10, do not just reboot, do a power off and power on; it is very different than just reboot (on Windows 10 reboot is like hibernating, but only the kernel, a lot of problems if using VeraCrypt or other filesystem mount tools)

That commands do a big clean up on Service Packs and on WinSXS folder respectively. They only delete/remove files not needed anymore (assuming you will not want to uninstall Service Packs/Updates that are already installed).

Please note that they do not block future Services Packs / updates from being uninstalled.

The main idea of them is: They remove what is needed to uninstall the updates that are installed and old system files versions that are not in use anymore.

Just check the Microsoft website description to know more.

Cory Knutson
  • 1,866
  • 12
  • 20
Laura
  • 1
  • 1
0

To automate this process you can find PowerShell script on link below.

How to Clean up the WinSxS Directory and Free Up Disk Space

???? (not sure what this idea is) "Microsoft provide the built-in tool – disk cleanup .(You need to install a feature called "Desktop Experience" to get Disk Cleanup.) "

Also, on link above you will find steps for disk cleanup(cleanmgr.exe) how to:

1) install

2) run

3) use

Alex.K.
  • 167
  • 2
  • 2
  • 8