Hello,
I'm trying to create sparse disks using the GUI, so far no success, I can only create VMDK and it would be automatically sparse (occupying the actual used disk space not the maximum disk space),
but not for qcow2 and raw.
Using SCSI with VirtIO SCSI controller and with discard option on in hope that the non-used free space will be reclaimed by host, but no success.
I tried so far almost every combinations of bus types and image formats to no avail.
With qcow2, It was possible to get it sparsed by creating a raw image and converting it to qcow2, using qemu-img convert command:
Now checking the space occupied by the newly converted image it will report only 200MB and not 32GB, that's perfect.
But converting back again to raw format:
Sadly, It will occupy again the full 32GB and not only the used space of 200MB.
Using another technique to sparsify a disk image:
by filling the empty space inside the guest with zeroes using the dd command and syncing the changes, then delete the file, and trying to cp with --sparse=always parameter after turning of the guest machine:
Sadly also this method failed.
So is there any things on the host that I'm not aware of, is my host system filesystem doesn't support sprase files.
Any help or tip is highly appreciated
Host Informations:
I installed proxmox using the proxmox repository and I have the latest upgrades as of today
I'm trying to create sparse disks using the GUI, so far no success, I can only create VMDK and it would be automatically sparse (occupying the actual used disk space not the maximum disk space),
but not for qcow2 and raw.
Using SCSI with VirtIO SCSI controller and with discard option on in hope that the non-used free space will be reclaimed by host, but no success.
I tried so far almost every combinations of bus types and image formats to no avail.
With qcow2, It was possible to get it sparsed by creating a raw image and converting it to qcow2, using qemu-img convert command:
Code:
qemu-img convert -f raw -O qcow2 vm-100-disk-2.raw vm-100-disk-2.qcow2
Now checking the space occupied by the newly converted image it will report only 200MB and not 32GB, that's perfect.
But converting back again to raw format:
Code:
qemu-img convert -f qcow2 -O raw vm-100-disk-2.qcow2 vm-100-disk-2.raw
Sadly, It will occupy again the full 32GB and not only the used space of 200MB.
Using another technique to sparsify a disk image:
by filling the empty space inside the guest with zeroes using the dd command and syncing the changes, then delete the file, and trying to cp with --sparse=always parameter after turning of the guest machine:
Code:
dd if=/dev/zero of=zerofile bs=1M
sync
rm zerofile
Code:
cp --sparse=always vm-100-disk-2.raw vm-100-disk-2-sparsed.raw
Sadly also this method failed.
So is there any things on the host that I'm not aware of, is my host system filesystem doesn't support sprase files.
Any help or tip is highly appreciated
Host Informations:
I installed proxmox using the proxmox repository and I have the latest upgrades as of today