Thick Provisioning to Thin Provisioning

repa

Renowned Member
Nov 18, 2010
38
4
73
Hi,

i have some huge VM's with are thick provisioned in RAW format which i want to change to Thin provisioning.

What is the correct way or is it even possible?

Thanks a lot for your advise!
 
We're migrating from local storage to CEPH.

rbd du -p cephpool1
NAME PROVISIONED USED
vm-100-disk-0 32 GiB 32 GiB
vm-102-disk-0 40 GiB 40 GiB
vm-104-disk-0 41 GiB 41 GiB
vm-107-disk-0 72 GiB 72 GiB
vm-108-disk-0 41 GiB 41 GiB


Backup / Restore is not an option, as we're talking about 300 vm's.
 
What is the correct way or is it even possible?

That depends on your target storage. If you e.g. migrate from RAW file to QCOW2 file, it is possible and all the fstrim magic @spirit wrote about can be used to free up used blocks that are actually free. It also works if you migrate to ZFS, but as you mentioned CEPH (as I read now), the rados device you will use internally, is also thin provisioned, so that should work, too.

Backup / Restore is not an option, as we're talking about 300 vm's.

IIRC, you can do each storage migration from the cli, so that you only need to loop over your VMs.
 
如果您的存储支持丢弃,您可以在您的 vm 磁盘上启用丢弃并执行 fstrim。

或者你可以备份/恢复

(请注意,默认情况下原始格式也是精简配置的,只需执行“du -sh myfile.raw”即可查看实际空间使用情况)

if your storage support discard, you could enable discard on the your vm disk and do an fstrim.

or you can backup/restore

(Note that raw format is thin provisionned too by default, just do a "du -sh myfile.raw" to see the real space usage)
How to set Thick Provisioning?
 
But #3 spirit said: "Note that raw format is thin provisionned too by default", I need disable thin provision
Recreate the RAW file as thick provisioned with dd after creating it or convert it via qemu-img manually (google is your friend). There is no way to do this in PVE itself except with thick LVM and ZFS without the 'sparse' check mark.