注意, 本文所涉及到的方法和步骤仅供在工作机上使用, 请不要在服务器上使用, 否则后果自负. 当然, 工作机上使用除了错后果也还是自负的. 呵呵.
笔者C盘磁盘空间只有44GB. 经常只剩下一两个G的空间, 多打开几个网页, 解压点什么东西, 或者看个dump, C盘空间就不够了.
笔者在Windows基本维护上水平很烂, 一个大学刚毕业的小伙儿帮了我的忙.
除了使用Windows自带的清理磁盘工具(可以清楚IE缓存等), 如下文件夹中的内容可以安全地删除.
C:\Windows\Installer\$PatchCache$\Managed
C:\Windows\temp
C:\Users\<Username>\AppData\Local\Temp
如果去掉隐藏系统文件的Windows Explorer选项, 可以看到下面两个很大的文件, hiberfil.sys和pagefile.sys.
他们其中一个是休眠的缓存文件, 另一个是虚拟内存文件.
关于休眠, 请参考下面的文字.
Windows has two power management modes that you can choose from:
One is Sleep Mode, which keeps the PC running in a low power state so you can almost instantly get back to what you were working on.
The other is Hibernate mode, which completely writes the memory out to the hard drive, and then powers the PC down entirely, so you can even take the battery out, put it back in, start back up, and be right back where you were.Hibernate mode uses the hiberfil.sys file to store the the current state (memory) of the PC, and since it’s managed by Windows, you can’t delete the file.
可以使用下面的命令行来关闭休眠(Hibernate), 执行之后开始菜单里的Hibernate选项就不见了, 而且hiberfil.sys也不见啦.
powercfg -h off
至于虚拟内存文件, 可以参考下图对其所在位置进行修改.
重启后该选项的修改生效.
经过这些修改, 笔者的C盘空间一下子多出来了15个G! 呵呵.
现在磁盘很便宜, 如果没有特别需求, 最好一次性给C盘留足空间, 免得日后麻烦. 已经用上了的机器数据挪来挪去不方便, 故为之.
参考资料
========================
The Patch Cache and Freeing Space
http://blogs.msdn.com/b/heaths/archive/2007/01/17/the-patch-cache-and-freeing-space.aspx
How to Turn Off and Disable Hibernation in Windows Vista
http://www.mydigitallife.info/how-to-turn-off-and-disable-hibernation-in-windows-vista/
What is hiberfil.sys and How Do I Delete It?
http://www.howtogeek.com/howto/15140/what-is-hiberfil.sys-and-how-do-i-delete-it/
Optimizing Your Paging File (PAGEFILE.SYS)
http://support.microsoft.com/kb/99768
Is it safe to Remove All Files from the Windows Temp ?
http://www.tomshardware.com/forum/230573-45-safe-remove-files-windows-temp
Windows 7 - What is C:\Users\PC\AppData\Local\Temp ?
http://www.sevenforums.com/general-discussion/205609-what-c-users-pc-appdata-local-temp.html