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

Discussion in 'Proxmox VE: Installation and configuration' started by niuk, Mar 17, 2017.

  1. niuk

    niuk New Member

    Joined:
    Feb 20, 2017
    Messages:
    27
    Likes Received:
    0
    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
     
  2. udo

    udo Well-Known Member
    Proxmox Subscriber

    Joined:
    Apr 22, 2009
    Messages:
    5,831
    Likes Received:
    158
    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
     
    niuk likes this.
  3. niuk

    niuk New Member

    Joined:
    Feb 20, 2017
    Messages:
    27
    Likes Received:
    0
    Appreciate , this is great instruction
     
  4. lucaferr

    lucaferr Member

    Joined:
    Jun 21, 2011
    Messages:
    42
    Likes Received:
    1
    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!
     
  1. 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.
    Dismiss Notice