如何安全地解放C盘剩余磁盘空间?
注意, 本文所涉及到的方法和步骤仅供在工作机上使用, 请不要在服务器上使用, 否则后果自负. 当然, 工作机上使用除了错后果也还是自负的. 呵呵.
笔者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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律