Guide to Freeing up Disk Space under Windows Vista
I've got a smallish C: drive, about 140G, but noticed that in the last week or so I'd had only 200megs free. Not cool. A few hours later, I have 84.4G free. Here's now:
- vsp1cln.exe - After you install Vista SP1, it leaves around the original files so you can uninstall the Service Pack if you want. After a few months with the Service Pack, I've decided for myself that it's a good thing and decided I don't need the option.
Open up an administrative command prompt. That means, click the Start Menu, type cmd.exe, then right-click on it and click "Run as Administrator." Alternatively, you can press Ctrl-Shift-Enter to run something as Administrator.
Next, type "vsp1cln" at the command prompt. If you select yes, you'll get back around 2 to 3 gigs. The only thing, again is that you can't uninstall SP1.
- Disk Cleanup - It's amazing to me the number of people who DON'T run Disk Cleanup. It's even better in Vista. Just run it. Often.
- Disable Hibernate - I have a desktop, and I prefer just three power states, sleeping, on or off. I don't use Hibernate. Plus, I have 8 gigs of RAM, and hibernation uses as much disk space as you have RAM. From an administrative command prompt, type "powercfg -h off" to get that space back. Got me back 8gigs.
- %TEMP% Files - Even though Disk Cleanup is great, sometimes for whatever reason it doesn't get stuff out of the TEMP folder. I recommend you try to delete the TEMP folder. I do this from the command line. Open up an administrative console, type "cd /d %TEMP%" (without the quotes, of course). Then, go up one folder with "cd .." and type "rd /s temp"
Do be warned, this command says to TRY to delete the whole folder and everything underneath it. It's very unambiguous. If you don't feel comfortable, don't do it. If you feel in over your head, don't do it. If it screws up your computer, don't email me. Next, I do a "dir temp" to see if the folder really got deleted. It usually doesn't because almost always some other program has a temp file open and the command can't get remove everything. If it DOES remove the folder, just "md temp" to get it back fresh and empty. This got me back 2.5 gigs. I'm sure you'll be surprised and get lots back. - Clean up System Restore - Vista keeps backups of lots of system files every time something major (driver installation, some software installations, etc) happens, and after a while this can take up lots of space. It uses a service/subsystem called ShadowCopies and can be administered with a tool called vssadmin.
Now, the EASIEST way to handle this is just to run Disk Cleanup, then click More Options and "Clean up…" which will delete all but the most recent System Restore data. That's what I did. That got me back lots of space back on my C: drive.
Alternatively, you can use the vssadmin tool from an admin command prompt to to do important things. One, you can set a max size for the System Restore to get. Two, you can set an alternative drive. For example, you could have the D: drive be responsible for System Restore for the C: drive.
You can use the commands like this. Note that you can put whatever drive letters you have in there. I ran it for each of my three drives. Note that this isn't just used for System Restore, it's also used for the "Previous Versions" feature of Vista that keeps some number of Shadow Backups in case you delete something and didn't mean it. Kind of a mini, local time machine. Point is, this isn't a feature you probably want off, just one you want kept to a max.
vssadmin Resize ShadowStorage /On=C: /For=C: /MaxSize=15GB - Check Folder Sizes with WinDirStat - I've used a large number of Windows Folder Size checkers, and the one I keep coming back to is WinDirStat. It used to be OverDisk, but OverDisk isn't smart about NTFS Junction Points and tends to get confused in Vista generally. Plus, it's been on version 0.11 for something like 4 years. WinDirStat is actively developed, it's Open Source, and it works great in Vista. It's wonderfully multi-threaded and is generally fabulous. It'll help you find those crazy large log files you've forgotten about deep in %APPDATA%. It saved me 5gigs of random goo.
- NTFS Compression - That's right, baby, Stacker (kidding). This is a great feature of NTFS that more people should use. If you've got a bunch of folders with old crap in them, but you don't want to delete them, compress. If you've got a folder that fills up with text files or other easily compressed and frequently access stuff, compress 'em. I typically compress any and all folders that are infrequently accessed, but I'm not ready to toss. That is about 30-40% of my hard drive. Why bother to compress when Disk Space is so cheap? Well, C: drive space usually isn't. I've got a 10,000 RPM drive, and it's small. I'd like to get as much out of it as I can without the hassle of moving my Program Files to D:. More importantly, Why the heck not? Why shouldn't I compress? It's utterly painless. Just right click a folder, hit Properties, then Advanced, then Compress. Then forget about it. As long as you're not compressing a bunch of ZIP files (won't do much) then you're all set. You might consider defragging when you're done, just to tidy up.
- Remove Old Stuff - Just go into Add/Remove Programs or Programs and Features and tidy up. There's likely a pile of old crap in there that's taking up space. I removed some Games and Game Demos and got back 5 gigs.
- Wasteful TempFiles/ScratchFiles Settings in Popular Programs - Most programs that need scratch space have a way to set a ceiling on that Max Space. Go into Internet Explorer or Firefox, into the options and delete the Temporary Internet Files. Set a reasonable size like 250 megs or 500 megs. I've seen those cache sizes set to gigs. If you've got a speedy connection to the internet, that's just overkill.
- Find Fat Temp File Apps and squash them - Google Earth and Microsoft Virtual Earth 3D are really fast and loose with the disk space. You can poke around for a while and next thing you know you're down 2 gigs or more. If you don't use the app a lot, delete the caches when you exit, or better yet, make the cache size for each app small.
- ADVANCED: Use Junction Points/Hard Links/Reparse Points to move temp file folders - This is an advanced technique. If this technique kills your beloved pet cat, don't email me. You have been warning. Also, note that I'm only saying it works for me.
I use my Zune all the time, and like many portable media players, it transcodes (squishes) video that it downloads from the web to its preferred size and codec. For example, if I download an ABCNews Podcast, it might be 600 megs, but then Zune automatically squishes it to say, 300 megs. It puts that in %AppData%\Local\Microsoft\Zune\Transcoded Files Cache. I'm not sure how to move that folder, and I've looked all over the Zune app. I know I can set the Max Size, but I want it off my drive. So, I make a SymLink. This is a way to fake out apps (Unix people know this) by making a folder POINT to another place.
From an admin command prompt, I went into the Zune temp folder and deleted that Transoded Files Cache directory. Then I typed:
mklink /d "Transcoded Files Cache" "d:\Zune Transcoded Files Cache"
So that directory really points to one on my D: drive. I can confirm it with dir:
Directory of C:\Users\Scott\AppData\Local\Microsoft\Zune
10/19/2008 02:24 PM <DIR> .
10/19/2008 02:24 PM <DIR> ..
10/19/2008 02:25 PM <DIR> Art Cache
07/15/2008 08:56 AM <DIR> DeviceInbox
10/19/2008 02:24 PM <SYMLINKD> Transcoded Files Cache [d:\Zune Transcoded Files Cache]
Again, this is really dangerous, especially if you forget you did it. Also, not every application understands these and older disk management or directory management apps can get confused. You have been warned. I like it for me. This got me back 8 gigs of space.
What did I miss, Dear Reader? I'm sure I missed something.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
You can also set the recycle bin to automatically delete forever... but that also has it's drawbacks.
I used to do all of what you suggested...and then I found CCleaner. Works great on Vista x64
I would just like to add "Delete the thousands and thousand of old emails" to the list.
I used to just let emails stick around, but having a better achiving strategy saves alot of space.
Thanks..!
About WinDirStat, you say that it's "beautifully multi-threaded". Maybe I'm missing something, or I'm using an old version (1.1.2.80 on Windows XP), but for me it is "uglily single-threaded". Don't get me wrong, it is a great free application, but I wouldn't call it multi-threaded.
It does, actually, have multi-threaded parts, like the drive selection dialog. But the most important part, drive scanning, is single-threaded (seen with Process Explorer). Just start a scan and click on a menu. The animations stop and so does the scanning process. So it is not so beautifully multi-threaded.
Anyway, great article.
Random idea: a public wiki that any Microsoft employee can edit, with useful stuff like this.
Sorry, off topic. When I used to game, my screen shots and demos folder would fill up extremely quickly.. make sure to get all those.
than C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
it can grow quite a lot if you are working on multiple projects and trying out different samples.
thanks for the tip on removing SP1, great work
Cheers !!!
Deepesh
Install Vista/Server 2008 using unattend.xml, configuring the Users directory and ProgramData to be on one of the data drives. Start out from http://support.microsoft.com/kb/949977
There are some gotchas:
* You probably still want to create junctions for ProgramData and Users pointing from C: to the new locations on D:, for badly behaved programs that may hardcode these paths.
* Your first Windows Update run after a fresh install may have some "issues", at the time I did this Windows Update couldn't handle the location of ProgramData for some updates, but that may since have been fixed. The KB article above refers to a servicing stack update which may or may not address this.
* Doing this will also block upgrades using the Windows installer. This is not a problem for me since I always install a new OS release from scratch, but it may be for you.
http://www.tech-archive.net/Archive/Windows/microsoft.public.windowsupdate/2007-09/msg01074.html
Thanks for the tips, Scott :o)
Space free: 17GB
After
Space free: 35.9GB
Very cool Scott, I very like this blog.
It's very very used memory, you have the same problem ? and i want to resolve this problem :(
Please help me, I can't wait vista SP2, 3, 4 or 5 :)
Saved me 60 Gb as few months ago ( no idea what the 60gigs of crap actually were, but windows exploer couldn't see them). Details here: http://rbonini.wordpress.com/2008/08/29/hard-drive-troubles/
WinDirStat FTW!!!!
This operation will make Windows Vista Service Pack 1 permanent on this computer.
Upon completion you will not be able to remove Windows Vista Service Pack 1 from this system.
It sounds more user friendly.
As opposed to something like "You are about to delete original installation files for SP1".
One of the many great things about it is that you can tell it which cookies you do not want to delete. Once you've got your whitelist setup, it's just that much more beneficial!
Scott... now you just need to write a powershell script that does all this for you/us and put it up on your blog.
BOb
There's also a shed load of log files in c:\windows\logs
Now if only we could clean down WinSXS safely.
Thanks for that. Will remember that in future.
Roberto.
PS I really dig the openID. Makes life a lot easier.
non movable (except with joins), full of copies (and JIT) of every ASP.Net file you ever launched on your computer in up to 4 versions.
A major pain for developpers, and maybe a big pain for ASP.Net servers with many web sites on it.
Anyone knows HOW to move this to another partition ?
Maybe you know about this problem then, because I haven't had any luck googling it or asking about in MS's newsgroups:
Due to company policy, my "Documents" folder gets relocated to a folder on
our SBS server. As far as I can tell, my only option if want to include
these files in my Vista search index is to make these files offline
accessible.
When I do this, Vista makes a local copy of the files somewhere under
c:\users\myusername\AppData.
My problem is, that my main drive is a fairly small 70Gig 10.000rpm WD
drive, and it is filling up with the local copies of the contents of my
Documents folder.
I can relocate almost all other folders in c:\users\myusername, or use
junction points, to point folders to other drives, but i can't find any way
to do this with the AppData folder. (BTW junction points isn't that great
when you're using Photoshop CS - it's file dialogs doesn't understand them)
Is it possible to relocate the AppData folder, or even better c:\users -
on a running Vista install or is it necessary to make a clean install and
relocate c:\users as Leon explains it above?
Regards
Jesper Hauge
WinDirStat is free, and free is always nice. But when you need a professional tool for the job, I think FolderSizes (http://www.foldersizes.com) is the way to go.
http://w3.win.tue.nl/nl/onderzoek/onderzoek_informatica/visualization/sequoiaview/
El
You can move the temporary aspnet files by modifying the compilation section of your machine config file
%WinDir%\Microsoft.NET\Framework\v2.0.50727\Config\Machine.config
In the <system.web> section find the compilation node and add the tempDirectory attribute
<system.web>
<compilation tempDirectory="E:\temp\Temporary ASP.NET Files\2.0" >
.....
.....
....
</compilation>
......
.......
.....
</system.web>
------------------------------------------------------------------
My pet peeve : C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
non movable (except with joins), full of copies (and JIT) of every ASP.Net file you ever launched on your computer in up to 4 versions.
A major pain for developpers, and maybe a big pain for ASP.Net servers with many web sites on it.
Anyone knows HOW to move this to another partition ?
folbec
However - note to the Windows team - we can do without the "Hibernate is disabled on this machine" alert bubble on every boot. We like Hibernate off - I know it's your pet feature but it really doesn't matter to us as much as it does to you - stop pestering us about it !
C:\Users\<username>\to a new location, for instance:
D:\UserData\<username>\
Vista will automatically virtualize those paths so that any attempts to access files/folders in the original locations will be redirected to the new locations. You can move them pretty much anywhere you want, as often as you want.
There are quite a few how-to's online covering this topic. Here's one: http://blogs.zdnet.com/Bott/?p=215. There are also third-party tools that enable you to accomplish a similar feat under XP.
However, there is no built-in support for virtualizing the AppData folder, so using Junction Points is likely the simplest technique for that.
Whenever I start a sentence with something like "I've got a smallish C: drive, about ___" or "I've only got ___ RAM" or "my screen resolution is only ____ x ____", I feel a bit ungrateful. That's because my first IBM XT clone from Zenith had a 10MB (sic) hard drive, 256KB (sic) RAM, and a 16-colour (sic) 320 x 200 (sic) display and cost consumers way back then CDN $8400. Recently, I bought my wife a Compaq laptop (some people call them notebooks) at Future Shop for CDN$500. It's got 2GB RAM, 160GB hard drive, wide monitor, et cetera. Weight: about 2.7Kg (c. 6#) ~~ approximately 60% of the weight of the hard drive alone of my first XT clone.
Comments are closed.