raw Shrink Disk

NetRock

Renowned Member
Apr 23, 2015
78
1
71
Hi ...
With version 5.2 how can I shrink a KVM raw disk size:
'qm resize' is not supported to shrink,
'qemu-img resize -f raw /var/lib/vz/images/103/vm-103-disk-1.raw 500G' is not working also.

Thank you for your help.
 
Hi,

It's not so easy...

You first need to reduce the file system size and the partition size inside the guest, only then you can shrink it, then you additonally need to tell qemu-img that you know what you do, and that dta loss is expected if you did not reduced the guests FS/Parition boundaries with the qemu-img '--shrink' option.

I really recommend that you test this procedure on a test VM with unimportant data, else you may have a bad time...
 
hello, I tried to reduce the image but tells me that it does not find the file I have the directories, even if the path is correct, I would need to resize these raw images, you did it?
thank you