vmware虚拟机安装linux清理磁盘

注意:
操作前一定要确保现有硬盘的剩余空间大于现有的虚拟磁盘空间,例如现在需要清理的虚拟磁盘空间大小为200G,那么这个虚拟磁盘所在的硬盘分区最少得有200G的剩余空间才能操作成功。如果怕需要清理虚拟磁盘的时候现有硬盘剩余空间不够,那可以在创建虚拟机磁盘文件的时候选择将虚拟磁盘拆分成多个文件,这样后面如果要清理的话那硬盘剩余的空间大小只要大于虚拟磁盘最大的那个文件就可以了。
还有就是虚拟在最好安装vm-tools,不论windows系统还是linux系统。都最好安装。

用内容为二进制0的文件,填充所有磁盘空间,删除这个文件.

dd if=/dev/zero of=/zero.file bs=2M

sync // 把内容都同步到磁盘

rm -rf /zero.file

原因:

– 虚拟机在操作磁盘镜像的时候,类似于只操作扇区,不考虑其上的文件系统的类型和内容;

– 磁盘镜像的存储类似于稀疏矩阵的存储,只有数据全0的时候空间才能被释放。

之后关闭虚拟机,点编辑虚拟机设置—硬盘—压缩。完成了。

压缩之前需要此虚拟机磁盘文件的根目录剩余空间大于虚拟磁盘的大小。

sanradar
sanradar
文章: 104

92 评论

  1. Very well written! The points discussed are highly relevant. For further exploration, check out: LEARN MORE. Keen to hear everyone’s opinions!

  2. You really make it appear so easy with your presentation however I to find this topic to be actually one thing that
    I feel I would never understand. It sort of feels too complicated and extremely extensive for me.
    I am taking a look ahead for your subsequent post, I’ll attempt to get the grasp of it!
    Escape roomy lista

  3. I seriously love your site.. Excellent colors & theme. Did you develop this site yourself? Please reply back as I’m planning to create my very own website and would love to find out where you got this from or what the theme is called. Many thanks!

  4. I’m impressed, I have to admit. Rarely do I come across a blog that’s both educative and entertaining, and without a doubt, you’ve hit the nail on the head. The issue is something which too few folks are speaking intelligently about. Now i’m very happy that I came across this in my hunt for something concerning this.

  5. Aw, this was an exceptionally good post. Taking the time and actual effort to generate a good article… but what can I say… I hesitate a lot and never seem to get anything done.

  6. Greetings! Very helpful advice within this article! It’s the little changes that make the most significant changes. Many thanks for sharing!

  7. After I initially commented I appear to have clicked the -Notify me when new comments are added- checkbox and from now on each time a comment is added I receive 4 emails with the exact same comment. There has to be a way you are able to remove me from that service? Appreciate it.

  8. You are so awesome! I don’t think I’ve truly read through a single thing like this before. So great to find somebody with some genuine thoughts on this issue. Seriously.. many thanks for starting this up. This site is one thing that is required on the web, someone with a little originality.

  9. I absolutely love your website.. Very nice colors & theme. Did you build this amazing site yourself? Please reply back as I’m attempting to create my own personal website and would like to find out where you got this from or exactly what the theme is called. Thanks.

  10. I truly love your blog.. Excellent colors & theme. Did you develop this website yourself? Please reply back as I’m wanting to create my own blog and want to learn where you got this from or exactly what the theme is named. Kudos.

  11. Oh my goodness! Incredible article dude! Thank you so much, However I am having issues with your RSS. I don’t understand why I cannot subscribe to it. Is there anybody getting identical RSS issues? Anyone that knows the answer will you kindly respond? Thanx!!

  12. It’s hard to come by knowledgeable people in this particular topic, but you seem like you know what you’re talking about! Thanks

  13. I must thank you for the efforts you’ve put in penning this website. I really hope to view the same high-grade blog posts by you in the future as well. In fact, your creative writing abilities has motivated me to get my very own blog now 😉

  14. This is a good tip especially to those fresh to the blogosphere. Simple but very precise info… Many thanks for sharing this one. A must read post!

  15. You are so awesome! I do not believe I have read through something like that before. So good to find somebody with genuine thoughts on this topic. Really.. thanks for starting this up. This website is one thing that’s needed on the web, someone with some originality.

  16. I truly love your blog.. Pleasant colors & theme. Did you develop this web site yourself? Please reply back as I’m hoping to create my own personal blog and would love to know where you got this from or exactly what the theme is called. Kudos!

  17. You’re so interesting! I do not believe I have read through anything like this before. So good to discover someone with a few genuine thoughts on this subject. Really.. thank you for starting this up. This site is something that’s needed on the web, someone with a little originality.

  18. I’m amazed, I have to admit. Seldom do I come across a blog that’s both educative and amusing, and without a doubt, you’ve hit the nail on the head. The problem is something which not enough men and women are speaking intelligently about. I am very happy I stumbled across this during my hunt for something relating to this.

  19. I blog often and I really appreciate your content. Your article has really peaked my interest. I am going to book mark your website and keep checking for new information about once per week. I opted in for your RSS feed too.

  20. I’m amazed, I must say. Seldom do I come across a blog that’s equally educative and amusing, and without a doubt, you’ve hit the nail on the head. The problem is something which not enough folks are speaking intelligently about. I am very happy that I found this during my search for something relating to this.

  21. I’m more than happy to find this website. I need to to thank you for ones time for this particularly wonderful read!! I definitely appreciated every bit of it and i also have you saved as a favorite to check out new information in your blog.

  22. Greetings! Very useful advice within this post! It is the little changes that produce the most important changes. Thanks for sharing!

  23. I’m impressed, I must say. Rarely do I come across a blog that’s equally educative and amusing, and let me tell you, you’ve hit the nail on the head. The problem is something that not enough folks are speaking intelligently about. I am very happy I came across this in my hunt for something regarding this.

  24. After checking out a number of the blog articles on your website, I seriously like your way of blogging. I book marked it to my bookmark site list and will be checking back soon. Please visit my web site as well and let me know what you think.

  25. You’re so awesome! I do not think I’ve truly read a single thing like that before. So great to find someone with some genuine thoughts on this issue. Seriously.. thanks for starting this up. This site is one thing that’s needed on the web, someone with a bit of originality.

  26. Oh my goodness! Incredible article dude! Thanks, However I am having difficulties with your RSS. I don’t understand why I am unable to join it. Is there anybody else having the same RSS problems? Anybody who knows the solution will you kindly respond? Thanks!!

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注