Pages

Thursday, 11 June 2015

19 ways to reduce your Windows Server 2008/2012 R2 disk space consumption

The other day I came accross a poorly provsioned VM that had a measly 20GB of disk space allocated for Windows Server 2008 R2 - while the server was just about running OK despite the lack of disk; upgrading the server to 2012 R2 was simply not going to be feasable since the disk only had around 1GB of free space!

So I decided to comprise a checklist of pretty much anything that can be done to reduce disk usage (albeit some of them are only temporary measures!)

1. Disk Cleanup with Administrative Rights (The obvious choice - but somewhat limited too): This utility is not actually available with 2008 R2 by default and requires the

"Desktop Experience" feature to be installed manually. This utility cleans up the WinSXS directory (which is the home for windows components) - which can grow prety large.

2. CCleaner: Another obvious choice - but again does not cover everything! http://www.piriform.com/ccleaner/download

3. Ensuring the following files / directories are clear:

- C:\Windows\Temp
- C:\Users\%USERNAME%\AppData\Local\Temp
- C:\Users\%USERNAME%\AppData\LocalLow\Temp
- %SystemRoot%\MEMORY.DMP

4. Disable Pagefile: This should be treated as a temporary measure (unless you really know what you are doing) - Right-hand click "Computer" >> Properties >> Advanced

Settings >> Performance Settings >> Advanced >> Virtual Memory >> Change >> Untick "Automatically manage paging file size for all drives" >> Select "No paging file".

5. Moving Windows Search Indexing Database (If installed): Start >> Search for "Indexing" >> Indexing Options >> Advanced >> Set "Index Location" >> Restart Indexing service.

6. Manually compressing any files that are not often accessed.

7. Use Microsoft's 'junction' utility to create symbolic links from your system drive to another fixed drive. E.g. you could re-locate your software distribution / updates

folder to another drive:

Stop the Windows Update service: sc stop wuauserv
Rename C:\WINDOWS\SoftwareDistribution to C:\WINDOWS\SoftwareDistribution.old
Create the destination directory on the other drive: D:\WINDOWS\SoftwareDistribution
Download the junction utiltiy from SysInternals: https://technet.microsoft.com/en-gb/sysinternals/bb896768.aspx
Create a symbolic link like follows: junction "C:\WINDOWS\SoftwareDistribution" "D:\WINDOWS\SoftwareDistribution" -q
Start the Windows Update service: sc start wuauserv
Ensure Windows Updates are working as expected.
Delete C:\WINDOWS\SoftwareDistribution.old

8. dism /online /cleanup-image /spsuperseded

9. Remove any unnesasery Windows Features / third party software

10. IIS Log Files (If applicable): Ensure C:\inetpub\logs\LogFiles is clear

11. Clear Event Logs (Not reccomended)

12. Removing old installer packages: Installer packages for your software are stored within C:\Windows\Installer - although sometimes you can get a fair few orphaned installers -

so to save space we can use a utiliy called "msizap" (provided by Microsoft - but no longer available / supported) but still works the OS's I have tried it on (Windows 7, 8.1

and Server 2008 R2). Do not simply delete all of the files within this directory - as installed software rely on these packages to perform maintainence like repairing,

uninstalling software etc. I have provided a direct link to msizap below:

<msizap dl>

Simply run 'msizap !g' to remove any orphaned packages.

You can also run the following script that will identify packages (.msp files) that are currnetly in use:

http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-01-56-98-47/WiMsps.zip

13. Deleting Internet Explorer Web Cache: WebCacheV01.dat - This file contains recourses such as cookies, images etc.

C:\Users\%USER%\AppData\Local\Microsoft\Windows\WebCache\WebCacheV01.dat

14. Delete unnecessary fonts and drivers

15. .NET Framework - The assemblies (C:\Windows\assembly\NativeImages_VX.X) assosiated with each version can easily take up around 500MB for each version - consider uninstalling unneeded versions via Add or Remove Roles / Programs and Features.

16. Clear all wallpapers (Except default): %SystemRoot%\Web\Wallpaper

17. Delete any unnecessary user profiles: Right-hand click computer >> Properties >> Advanced >> User Profiles >> Settings.

*Warning: While the following tweaks they could negatively affect user experience - only perform them if you know what you are doing!*

18. Remove Windows Help files: Delete all of the '.h1s' files in C:\Windows\Help\Windows\en-US

19. Verify folders within C:\ProgramData - identifying any folders related to orphaned software 


No comments:

Post a Comment