I converted my .vmdk to .qcow2 using "qemu-img convert vmfile.vmkd -O qcow2 vmfile.qcow2".
Here are my shrink commands. MAKE BACKUPS FIRST!
=================================================================================
#!/bin/bash
# Run as root in VM
service apache2 stop
service mysql stop
#dd fill all of the unused space with zeros for qcow2 compression
dd if=/dev/zero of=/tmp/zerofile
sync
rm -f /tmp/zerofile
shutdown -h 0
=================================================================================
#!/bin/bash
# Run as root on Proxmox
qemu-img convert /ssd/100/vm-100-disk-1.qcow2 -O qcow2 /var/lib/vz/images/100/vm-100-disk-1.qcow2.small
mv /var/lib/vz/images/100/vm-100-disk-1.qcow2 /var/lib/vz/images/100/vm-100-disk-1.qcow2.old
mv /var/lib/vz/images/100/vm-100-disk-1.qcow2.small /var/lib/vz/images/100/vm-100-disk-1.qcow2
qm start 100
# If all is ok then delete the old file
rm /var/lib/vz/images/100/vm-100-disk-1.qcow2.old
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.