qemu-img: output file is smaller than input file ?

niuk

New Member
Feb 20, 2017
27
0
1
60
I am trying to convert PA-VM-KVM-8.0.0.qcow2 image to disk in the VM I just created (see VM config 101.conf). It says output file is smaller than input file , why ?

root@pve:/var/lib/vz/images# cat /etc/pve/nodes/pve/qemu-server/101.conf
bootdisk: virtio0
cores: 1
ide2: none,media=cdrom
memory: 2048
name: pan-os-8.0
net0: virtio=DE:5F:17:16:D1:3C,bridge=vmbr0
numa: 0
ostype: l26
scsihw: virtio-scsi-pci
smbios1: uuid=4c337c77-5489-40d5-8f21-3cb56f43e70a
sockets: 1
virtio0: local-lvm:vm-101-disk-1,size=16G
root@pve:/var/lib/vz/images# find / -name vm-101-disk-1
/dev/pve/vm-101-disk-1
root@pve:/var/lib/vz/images# ls -lh
total 1.9G
-rw-r--r-- 1 root root 1.9G Mar 17 09:22 PA-VM-KVM-8.0.0.qcow2
root@pve:/var/lib/vz/images# qemu-img convert -O raw -p -n PA-VM-KVM-8.0.0.qcow2 local-lvm:vm-101-disk-1
qemu-img: Unknown protocol 'local-lvm'

root@pve:/var/lib/vz/images# qemu-img convert -O raw -p -n PA-VM-KVM-8.0.0.qcow2 local-lvm:vm-101-disk-1
qemu-img: Unknown protocol 'local-lvm'

root@pve:/var/lib/vz/images# qemu-img convert -O raw -p -n PA-VM-KVM-8.0.0.qcow2 /dev/pve/vm-101-disk-1
qemu-img: output file is smaller than input file
 
I am trying to convert PA-VM-KVM-8.0.0.qcow2 image to disk in the VM I just created (see VM config 101.conf). It says output file is smaller than input file , why ?

root@pve:/var/lib/vz/images# cat /etc/pve/nodes/pve/qemu-server/101.conf
bootdisk: virtio0
cores: 1
ide2: none,media=cdrom
memory: 2048
name: pan-os-8.0
net0: virtio=DE:5F:17:16:D1:3C,bridge=vmbr0
numa: 0
ostype: l26
scsihw: virtio-scsi-pci
smbios1: uuid=4c337c77-5489-40d5-8f21-3cb56f43e70a
sockets: 1
virtio0: local-lvm:vm-101-disk-1,size=16G
root@pve:/var/lib/vz/images# find / -name vm-101-disk-1
/dev/pve/vm-101-disk-1
root@pve:/var/lib/vz/images# ls -lh
total 1.9G
-rw-r--r-- 1 root root 1.9G Mar 17 09:22 PA-VM-KVM-8.0.0.qcow2
root@pve:/var/lib/vz/images# qemu-img convert -O raw -p -n PA-VM-KVM-8.0.0.qcow2 local-lvm:vm-101-disk-1
qemu-img: Unknown protocol 'local-lvm'

root@pve:/var/lib/vz/images# qemu-img convert -O raw -p -n PA-VM-KVM-8.0.0.qcow2 local-lvm:vm-101-disk-1
qemu-img: Unknown protocol 'local-lvm'

root@pve:/var/lib/vz/images# qemu-img convert -O raw -p -n PA-VM-KVM-8.0.0.qcow2 /dev/pve/vm-101-disk-1
qemu-img: output file is smaller than input file
Hi,
does the qcow2-file fit in the logical volume?
Code:
qemu-img info /var/lib/vz/images/PA-VM-KVM-8.0.0.qcow2
lvdisplay /dev/pve/vm-101-disk-1
In this case the qcow2-file allready on the local storage (if defined as image-storage) - you can simply add them to config, like this:
Code:
mkdir /var/lib/vz/images/101
mv /var/lib/vz/images/PA-VM-KVM-8.0.0.qcow2 /var/lib/vz/images/101/vm-101-disk-1.qcow2
echo "virtio0: local:101/vm-101-disk-1.qcow2,size=16G" >> /etc/pve/nodes/pve/qemu-server/101.conf
# remove the line "virtio0: local-lvm:vm-101-disk-1,size=16G" in the config.
After the VM work, you can migrate the storage with the gui.

Udo
 
  • Like
Reactions: niuk
I had the same error ("output file is smaller than input file") while importing a vhd disk from external to a VM using Ceph storage target (with command "qm importdisk"). I solved by firstly converting from vhd to raw using "qemu-img convert" and then running "qm importdisk" worked!
 
I have the same issue trying to import an VHDX-File to a Volume Group:

$ qm importdisk 100 drive0.vhdx pool_sas
importing disk 'drive0.vhdx' to VM 100 ... Logical volume "vm-100-disk-1" created. transferred: 0 bytes remaining: 108447924224 bytes total: 108447924224 bytes progression: 0.00 % qemu-img: output file is smaller than input file Logical volume "vm-100-disk-1" successfully removed copy failed: command '/usr/bin/qemu-img convert -p -n -f raw -O raw drive0.vhdx /dev/pool_sas/vm-100-disk-1' failed: exit code 1

What can I do, that 'qemu-img' is recognizing the correct input file size?
 
Last edited:

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!