resize/compress vmdk files

weblike

Renowned Member
May 29, 2013
27
0
66
hi, we have large vmdk files, but the data from VM's is got smaller . it is possible to compress the vmdk files? thank you
 
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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!