From time to time, Windows patches will fail to install because a server doesn’t have enough space to install them. Finding the ginormous files are that are hogging all the space on the C drive is really tedious if you do it by clicking around in Windows Explorer, but there’s a better way.
Download the free Sysinternals Du.exe utility and you can find the behemoths in minutes, if not seconds. If you have Unix experience, you might think this utility sounds similar to the Unix du utility. You would be correct. Download the utility, extract the zip file, save the executable somewhere in your system path–some people frown on copying tools straight into C:\Windows but I do it anyway–then open a command prompt and go to town.
Here’s an example of how I put it to work:
DU -L 1 \\servername\c$
I used capital letters for clarity, but the command isn’t case-sensitive. This command immediately tells me the size of every subdirectory right off the root of the drive. Then, when I see what high-level directory is hogging space, I can drill down another level:
DU -L 1 \\servername\c$\users
Often the biggest hogs on a server are the user profiles because a sysadmin copies installation files onto his or her desktop, performs the installation, then leaves the files there just in case, where they sit for the better part of a decade. Some companies have cryptic usernames, so to find out who’s hogging the space if you can’t figure it out, copy the user ID, then compose an e-mail message in Outlook (assuming you’re an Exchange shop), paste the user ID into the To: field, and hit <Ctrl-K> to resolve the name. While you’re there, you might as well go ahead and compose a message asking the person to go clean out the profile to free up some space.
For better speed, you can also run it straight on the server.
DU -L 1 c:\
DU -L 1 c:\users
Don’t forget to look in the root directory. On one server I found an obnoxious 4 gb log file from a software installation someone did in 2011 sitting in the root directory. The log file was taking more space on the server than the application itself, so I have no idea what was up with that.
Once you find the giant files that are keeping you from securing the machines, move them to a different drive or a different machine, compress them, or delete them–whatever you have to do.
After the cleanup, if you have time and can get two maintenance windows, think about defragmenting the drive before you patch. This will make the patching and subsequent reboot go faster, in addition to improving performance during the day and making future patch/reboot cycles go faster.
For doing large numbers of servers, you can script DU as well.