I'd like to convert a KVM virtual machine disk image in raw file from a thin privisioning format to preallocated.
In the first place I've got a preallocated 20Gb raw image file:
image: /var/lib/libvirt/images/ArchLinux.img file format: raw virtual size: 20G (21474836480 bytes) disk size: 20G
I used the following command to make the backup disk file:
sudo qemu-img -O qcow2 -cp ArchLinux.img BackupArchlinux.qcow2
After that I tried to get the first image file back using:
sudo qemu-img -O raw -p BackupArchlinux.qcow2 Archlinux.img
but I get a thin privisioned raw format as you can see here:
image: .../ArchLinux.img file format: raw virtual size: 20G (21474836480 bytes) disk size: 1.6G
How can I convert this raw file to preallocated format back?
Note: qemu-img version 2.11.0