When working with Windows computers, especially Windows servers, I often run into situations where the hard drive is running out of disk space. In fact, I have often seen drives literally have no available space on a SharePoint or SQL server. There are too many reasons why a drive can run out of space, or continue to run out of space even if you keep freeing more disk space. In this article I won’t be going into the details of the reasons why drives run out of space but I can tell you that trace logs, SharePoint_Config_log.ldf file on SharePoint 2010, and cache files in %windir%\winsxs\ManifestCache folder on the server and PST files, temporary files, and thumbnails, eating up the disk on the workstation are a few common reasons. I have also blogged about other reasons in the past. The purpose of this article is to show you how to find out the size of some of the largest files on your computer so you can take action and delete them if they are not needed.
Not all large files are needed. If they are not needed then there is no sense in keeping them on your computer. Obviously, you can delete a lot of small junk files but The question is how to find out which are the largest files. A simple way to find out the size of the largest files is to write a PowerShell script. You can then pipe the results of the script to a file and look at them one by one. Here’s a sample script that will display in GB the 5 largest files on your server or workstation. You can change the number 5 at the end of the script to display more or fewer large files.
@echo off
Powershell -noexit “Get-PSdrive | where { $_.Used -gt 0 } | foreach { Get-ChildItem $_.Root -recurse -force -ErrorAction SilentlyContinue | Select Name,DirectoryName, @{Label=’Size’;Expression={($_.Length/1GB).ToString(‘F04′)}} | Sort Size -descending | select -first 5}”
As an example, on a SQL Server 2008 R2 if you run out of disk space, you can delete the file that ends with _blobs.bin (e.g. a368b368b28d9265_blobs.bin) in the %windir%\winsxs\ManifestCache folder. According to Microsoft, this file is used by Windows Update mechanism and it is safe to delete this file. However, do not delete or mess with any other files in the WinSxS foder. Even if you delete all the files in the ManifestCache folder, they may appear later after a Windows Update or a reboot but will likely be not as large. Just keep an eye on these files and deleted them when necessary. Here a post from Joseph Conway on TechNet that describes in detail what the WinSxS folder is all about. Unfortunately, there is no known solution to this problem of Windows servers and workstations running out of disk space. Until Microsoft comes up with a solution, here’s a workaround.
Here’s how you can delete files in the Windows\WinSxS\ManifestCache folder.
Scheduling Cleanup of ManifestCache folder
The ManifestCache folder will continue to grow in the future but you can create a batch file to cleanup the content occasionally. I would recommend that you clean up the folder only if you need disk space because the cache files will improve performance. This solution is for people who are in desperate need of additional disk space. Here’ a batch file that I use on my SharePoint 2010 server and my SQL Server 2008 R2 server. I saved the content of this batch file in Notepad and named the file CleanManifestFolder.bat. I run this file at the elevated Command Prompt.
@echo off
cls
net stop trustedinstaller
takeown /f %windir%\winsxs\ManifestCache\*
Icacls %windir%\winsxs\ManifestCache\* /grant Administrators:f
del /q %windir%\winsxs\ManifestCache\*
net start trustedinstaller
You can also schedule to run this file with Task Scheduler if necessary.
Disk Cleanup Tool
At this point you may want to go through additional files and delete them if they are safer to delete. On some operating systems, such as Windows 7, you also have the option Disk Cleanup on the drive properties. However, this tool is designed to delete only certain types of files that are safe to delete, such as downloaded program files, temporary Internet files, setup log files, temporary files, thumbnails, etc. It won’t find other files that can be very large and often useless. I still encourage you to go through these and delete them. Especially, the temporary files and thumbnails. I noticed that on my PC, the thumbnails were 79MB but the temporary files were a whopping 13.7GB. Your mileage may vary but the results may surprise you.
Contact E-mail | Terms of Use | Privacy Policy
Copyright © 2013 Zubair Alexander. All rights reserved.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Apr | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||
29 queries. 0.672 seconds