Logo

Armand.nz

Home / About / Linkedin / Github

Import a QCOW2 Into Proxmox

#proxmox |

Suppose you already have a QCOW2 file to use it in Proxmox, either coming from another KVM system or converted from another format. In that case, you need to import it because you cannot copy the files directly into the storage location.

To do so, you must either copy the qcow2 file to your local file system or mount it remotely via NFS, SSH, or a comparable mechanism so that you may convert the file directly.

  1. SCP Image onto Proxmox host

    This process assumes you’ll be using SCP to get the remote QCOW2 file on the Proxmox host. You need to ensure the correct size of disk space is available locally on the Proxmox server.

  2. SSH to the Proxmox server
  3. Check disk space on pve-root using df -h
  4. pwd to make sure you’re in root
  5. A temporary directory, e.g. /tmp/vmimport will be used. We can remove this file later

    root@pve:~# mkdir -p /tmp/vmimport
    
  6. scp file into /root/vm.import i.e.

      # From Desktop
     scp Snapt_v2.0-qcow2 [email protected]:/tmp/vmimport
    

    At this point the remote QCOW2 backup file is on the Proxmox server on pve-root in the /root/vmimport folder.

  7. Now we can importation the image into the Promox host:

    qm importdisk <vmid> yourimage.qcow2 namestoragepool
    

    In my example it lookes like:

    cd /root/vmimport
    qm importdisk 117 Snapt_v2.0-qcow2 storage
    

    This will take a bit of time as it has to copy the entire filesystem block by block. The <vmid> is just the numerical ID of the VM (you should have created a VM before getting started.) This is a number like 100, 101, etc.

    This works for many formats other than qcow2 as well. A straight block image in ISO / img format will work just fine, too. You will often see that when using dd to take a block image of an LVM snapshot.

  8. After being imported, you might not see the storage in your hardware. Just rescan for it.

    qm rescan
    
  9. Remember to set the boot order to allow the VM to boot the newly imported image first

    eb9ef3c782b4d02c4cdb9ad620a4cefa.png

comments powered byDisqus

Copyright © Armand