Monday, January 14, 2008

28. Where's All My Disk Space Going? (Vista)

By: orev

I've seen many questions, and even more incorrect or incomplete replies about missing disk space in Vista. You got a 160GB hard drive and you've only installed a few programs, but you're missing a LOT of disk space! Where did it go? There are numerous possible reasons why your disk is getting used up -- sometimes it's being used by useful services, and other times it's just being wasted.

So where does the space go?

  • Volume Shadow Copy: This is biggest reason for "missing" space in Vista! Instead of explaining it myself, I'll quote wikipedia:
    Shadow Copy (also called Volume Snapshot Service or VSS) is a feature in recent versions of Microsoft Windows that allows taking manual or automatic backup copies or snapshots of a file or folder on a specific volume at a specific point in time. It is used by NTBackup and the Volume Shadow Copy service to backup files. In Windows Vista, it is used by Windows Vista's backup utility, System Restore and the Previous Versions feature.
    This service can be very useful, and is a good idea to keep it enabled. However, it does eat disk space. A LOT of disk space. By default it allocates %15 of the disk to store it's data. On a 160GB disk, that's 24GB! A lot of people have been noticing that after a few weeks of using their new system, free space seems to shrink daily. This is because the space is not allocated right away, only when it's needed. It will stop when it reaches %15. At that point, it will delete older versions to make room for newer ones. For all the details about Shadow Copy, read this article at ZDNet for a really good explanation.
  • Marketing Many people notice missing space right when they open the box. They bought a system with a 160GB hard drive, but Windows shows the total drive capacity as 149GB. That's a difference of 11GB right off the bat. The reason for this has to do with how you measure capacity to begin with. We measure bytes using progressively larger sizes, starting with K (kilobytes), M (megabytes), G (gigabytes), each one standing for a multiple of 1000. So 1K = 1,000, 1M = 1,000,000 (1000 * 1000), and 1G = 1,000,000,000 (1000 * 1000 * 1000). These are the units that companies use when they advertise the size of their disks, so your 160GB drive is 160,000,000,000 bytes in these measurements.

    However, computers are binary systems, and measuring in multiples of 1000 isn't the way they do things. The closest thing we have in binary is 1024. So, for a computer, 1K = 1,024, 1M = 1,048,576 (1024 * 1024), and 1G = 1,073,741,824 (1024 * 1024 * 1024). As a result of this, a computer thinks that 1GB is bigger than what a person typically refers to as 1GB (a difference of 73,741,824 bytes). If we take our example of a disk that's advertised as 160GB, and divide by what a computer thinks is 1GB, we wind up with: 160,000,000,000 / 1,073,741,824 = 149.012, which is what Windows says is the drive capacity.

    This measurement makes it seem like the drive is smaller, which is the reason I call this "marketing". Everyone wants to make their drives seem bigger, so they use the larger number, even if it's not exactly accurate.

    Because of this confusion, new standards of measurement have been devised to help clear this up. Officially, the term "megabyte" refers to 1,000,000 bytes (1000 * 1000), and the term "mebibyte" refers to 1,048,576 bytes (1024 * 1024). The abbreviation for "megabyte" is "MB", like you're used to, and for a "mebibyte" it's "MiB". Notice the "i" in there. It's subtle, but important to make the distinction. You probably won't see these units in use by large companies for a while, but it's something you should be aware of anyway. See mebibyte for more information.

    Here's a table comparing the "marketing" size vs. the computer size for some typical drive sizes:
    Typical drive sizes
    Marketing Computer
    80 GB 74.51 GiB
    100 GB 93.13 GiB
    120 GB 111.76 GiB
    140 GB 130.39 GiB
    160 GB 149.01 GiB
    200 GB 186.26 GiB
    250 GB 232.83 GiB
    300 GB 279.39 GiB
    320 GB 298.02 GiB
    350 GB 325.96 GiB
    400 GB 372.53 GiB

  • Essential System Files Another thing that can use up a lot of disk space are some essential system files, specifically, the pagefile and the hibernation file. The pagefile is part of the virtual memory system, and is required by the system to function correctly. It can take up to a few gibibytes of space, 1GiB - 4GiB, depending on how much RAM you have in the system. The other file, "hiberfil.sys", is used to save the state of your system when you hibernate it. This file is about as large as the amount of RAM you have, and is required for hibernation to work. If you disable hibernation, this space should get freed-up, but then you won't be able to hibernate.
  • Temporary/Working Files Here's another place that space gets eaten quickly. I recently cleared out my temp folder, and found almost 1GiB of data in there. Since this stuff really is "temporary" data, it's pretty safe to delete. A lot of this comes from installer programs -- when you install new stuff it decompresses data into the temp space. Other files that fall into this category are things like temporary internet files, the index for disk searching, thumbnail cache for thumbnails that show up when you view a folder of pictures or videos, etc... Usually you can use the "Disk Cleanup" wizard to clean this stuff out. If you clean it out, it's probably a good idea to reboot.
  • C:\Windows Then, of course, there's Vista itself. Vista can take 6GiB or more on the system. That's not terribly huge, but it is there. Of course, it's sort of required for your system to run, so there's not much you can do about it .
  • Recovery Partition Many, if not most new systems these days come with a "recovery partition" on the disk. This partition often contains all of the software necessary to restore your system to the factory default state. They put it there so if you have serious problems with your software, you can, as a last resort, recover from it. However, this process will delete all of your data.

    The partition can be anywhere from about 5-10GiB, but it can vary. There are ways to get rid of it and reclaim that space, but never do so unless you have burned the "recovery discs" onto some DVDs first. The process to make recovery discs should be detailed in the documentation of your system. Once that is done, you can delete the partition, then expand your C: partition to use that space.
  • Copies of Installation Media Chances are if you copied some DVDs to your hard disk yourself, you know about it. But there's another way this can happen. Your OEM may have copied the entire contents of the Vista Installation disc to your hard drive. This is useful if you want to perform an Anytime Upgrade because Vista will need those files to perform the upgrade. However, that's going to take up a few GiB of space on your disk. If you can find this folder, sometimes called "WAU", you can safely burn this to a DVD and then delete the folder. Even better would be to make a bootable disc that you can use. You can use vLite (freeware) to burn this type of disc.

    Another program that does this is Microsoft Office. When you install Office, it copies the entire contents of the disc onto your hard drive. Unfortunately you cannot remove it, as these files are needed when you do an Office update.

One way you can track down what's taking a lot of space is by using an open source tool like windirstat. Don't go deleting stuff you don't know what it is! Many are the stories of people who reorganized "this c:\windows thing" and for some reason their systems didn't boot anymore!

One principle to keep in mind is that free space can be considered wasted space. If you don't need that space now, let Windows use it for temp files, indexing databases, volume shadow copy, etc... so you can get the benefit of those services. Only when you need that space should you worry about deleting those things.

No comments: