注意, 本文所涉及到的方法和步驟僅供在工作機上使用, 請不要在伺服器上使用, 否則後果自負. 當然, 工作機上使用除了錯後果也還是自負的. 呵呵.
筆者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