Friday, November 13, 2009

Windows Server 2008 - saving space on the C:\ drive

One of the hardest parts of the move from Windows Server 2003 to 2008 for me is disk space - 2008 needs far more of it and some of my tricks on 2003 jsut don't work anymore. That said, disk space is not the killer it used to be since storage is so cheap now, but where we do have issues is small C: drives. Here is some steps to try when the C: drive is full up (most of these are valid for Windows Vista and 7 as well):
  • Pagefile. Find where the pagefile.sys is - it can be anywhere, there is rarely a reason to have it on C:. By default there will be one at c:\pagefile.sys of a system managed size, usually several gigabytes. You won't see it unless you turn on the Folder Option to see protected operating system files. To move it, right click Computer, Properties, Advanced System Settings, Settings (the top one), Advanced tab, Change. Select C: and "no paging file" and Set. Make sure you set another paging file before you click OK, and finally reboot (if you can) to make it take effect.
  • Remove programs. Maybe its obvious, but if you're out of space remove anything you can. Try organising them by size. Acrobat Reader always seems to be suprisingly near the top of the list...
  • Extend the drive! Not an option in Windows XP and 2003, but from Vista and 2008 the C: drive can be easily resized in Disk Management. Assuming you have unpartitioned space of course. It might even be an option to delete subsequent partitions on the drive to create unpartitioned space if there are any on that volume. Right click the C: drive in Disk Management (in Control Panel, Computer Management or Start > Run > diskmgmt.msc) and Extend.
  • Disk Cleanup. This should be among the first things you run as its a quick way of checking temporary files, error logs, etc that can be removed. Bad news is its not included in Server 2008 unless you install the Desktop Experience feature and reboot. After that, its in All Programs, Accessories, System Tools. Check this, even if you don't think you need to and install it on every server, just in case. The reboot requirement might not be an option in an emergency
  • C:\windows\system32\Logfiles. One of the best places to look on a Windows 2003 or 2008 server - especially if it hosts HTTP or FTP. If unused its about 3mb - on a web server though it can easily be gigabytes. The whole contents can be wiped without losing anything apart from the ability to analyse past web traffic (which you might, to be fair, want to do). If its big and you want the contents, right click the folder, click Properties, advanced, tick the Compress checkbox, press OK and Apply. It will apply NTFS compression from then on and save about 3/4 of the space in the directory for no loss of data. And then go into IIS and redirect your logs elsewhere...
  • NTFS Compression. Look for directories with big log files or text files in and compress them! It will slow down access a little but leave the files available and slash the space used. Its not so effective against binary information and useless against a ZIP file so use it sparingly. Remember if you "compress" a folder any new files in it will be compressed from creation. To turn it on, right click something, click properties and advanced. Remember it could slow backups down if that is an issue for you.
  • SQL Server Setup Bootstrap folder. Don't delete this lightly, but if you need space on a SQL Server machine, this can be a useful half gigabyte. It is used if you add components to SQL Server later on - without it you are more likely to need to CD. You might consider this to be a reasonable risk! Its location varies, but for SQL Server 2005 on x64 Windows 2008, it would be at C:\Program Files (x86)\Microsoft SQL Server\90\Setup Bootstrap. You can delete the contents, but leave the actual folder.
  • WinDirStat. [click here...] This is a very fine freeware utility which I've used successfully on a Windows 2008 Server. It analyses the disk space usage surprisingly quickly and gives you an easy to use report on where it all is. Very good for finding which directories have the space (much quicker than lots of right clicking and viewing folder properties!!!). Let's have a screenshot:

  • Windows Installer Cleanup Utility. [click here...] This Microsoft utility can be used to clear down the c:\windows\installer folder on x86 and x64 servers. This folder is, for instance, 3.3gb on my (fairly fresh) Windows 7 PC - probably less on a server as they tend to have less installs. This folder contains the Add/Remove Programs information for your applications so be wary using it, but if you are not going to change your configuration (such as deinstalling the programs) and you're desperate for space, its an option. There is a warning in the readme not to delete the main Office install data.


I'm sure there are lots more tips out there so I'll update this as I find them. Any suggestions would of course be welcome!

No comments:

Post a Comment