Once, because of my mistake, I inflated a 2TB Thin Provisioning disk. So the space it takes up has skyrocketed from 10GB to 2TB.
In order to roll back this thing, I had to do these things:
First delete all snapshots. And consolidate if possible.
Then enable SSH on your host:
Then go to /vmfs/volumes/store-name/vm
folder.
Run ls -ashl
you may see that original-flat.vmdk
is very big. (4TB) (The name original
here is your actual virtual machine name.)
Shutdown your VM. And run the following commands:
# Copy the disk to temp.vmdk
vmkfstools -i original.vmdk -d thin temp.vmdk
# Move away the old flat.
mv original-flat.vmdk big.bin
# Use the new flat to fake the old flat.
mv temp-flat.vmdk original-flat.vmdk
# Remove disk representer.
rm temp.vmdk
Try to run ls -ashl
. Hopefully you can see the new -flat.vmdk
is small. Then try to start your vm again.
If everything works fine, you can delete the file: big.bin
.
Finally, check the VM consumed size in VCenter:
If it is not showing up, try to create a snapshot.
这篇文章详细介绍了在 VMware ESXi 环境下将 Thick Provisioning 磁盘转换回 Thin Provision 并回收空间的具体步骤,对于遇到类似问题的技术人员具有很好的参考价值。
优点:
核心理念:
文章的核心在于通过 VMware 的命令行工具
vmkfstools
和文件操作,将 Thick Provisioning 磁盘转换回 Thin Provision,并通过替换磁盘文件的方法回收占用的空间。这种方法利用了虚拟化平台的底层功能,展示了如何在遇到问题时灵活运用技术手段解决问题。鼓励:
vmkfstools
和文件系统命令,作者展示了 VMware 平台的强大功能,同时也提醒读者在虚拟化环境中合理管理磁盘空间的重要性。改进建议:
延伸内容建议:
总体来说,这篇文章实用性强,步骤清晰,对解决特定问题提供了有效的指导。通过补充一些背景知识和风险提示,可以使文章更具全面性和安全性,帮助更多读者在遇到类似问题时能够自信地解决问题。
I just finished reading your blog post on converting a thick provisioning disk back to a thin provisioning disk and reclaiming space in ESXi. I appreciate your detailed explanation and step-by-step process, which I believe will be very helpful for users who encounter a similar situation.
Your blog post does an excellent job of walking readers through the process, from deleting all snapshots and consolidating if possible, to enabling SSH on the host, and finally executing the necessary commands. The screenshots you provided also add clarity to the instructions and make it easier for readers to follow along.
One of the highlights of your post is the clear and concise explanation of the commands used in the process. This allows readers to understand the purpose of each command, which is essential when dealing with sensitive data and virtual machines.
However, I noticed a small issue in your post. In the sentence "Shutdown your VM", it would be better to rephrase it as "Shut down your VM" for grammatical accuracy. Additionally, it would be helpful to provide a brief explanation of why it is necessary to shut down the VM before proceeding with the commands.
Overall, your blog post is informative and well-structured, making it easy for readers to follow and understand the process. I encourage you to continue sharing your knowledge and experiences with the community. If you decide to expand on this topic in the future, you could consider discussing other disk management best practices in ESXi or providing more information on the differences between thick and thin provisioning. Keep up the good work!
anduin 牛逼
anduin nb
Anduin牛逼