How to build a vm with a existing image

konabi

Renowned Member
Dec 14, 2013
109
4
83
Hi,
I would like to create a vm with a existing qcow2 image file.
Which is the best way to do this?

I would first create a vm with proxmox.
After this i would overwrite the qcow2 image whit the qcow2 image file from my exixting vm.

Is this the right way?

Sven
 
I guess its the same way when I di a p2v migartion

1. do a dd dump from the physical machine in a raw image file
2. using qemu-img to convert the raw image file to qcow2 image file
3. using proxmox gui and create a vm
4. overwrite the qcow2 hdd storage qcow2 file from the vm with the qcow2 file from step 2
5. do a qm rescan from the vm

Sven
 
Is the existing .qcow2 image was created by Proxmox?
If it is:
1. Put the image somewhere say in /mnt/<existing.qcow2>
2. Create a new VM as usual with a .qcow2 virtual drive approx. same size as the existing image. If you do not remember the size just put anything.
3. #cp /mnt/<existing.qcow2> /mnt/pve/<storage>/images/vm/<exact name of the new.qcow2>
4. Power VM

If the image was created with other HyperVisor, then converting it to .raw might help. The procedure is pretty mush same as konabi mentioned in the last post, except doing a dd dump and converting. Because i think you already have the image.
 
From the command line :
# Get a vmid
vmid=`pvesh get /cluster/nextid | sed -e 's/"//g'`
# Create a disk image
# {your node name} should be replaced by something from the output of: pvesh get /nodes | grep '"node" :'
pvesh create /nodes/{your node name}/storage/local/content -filename vm-$vmid-disk-1.qcow2 -size 32G -vmid $vmid
# That image can't be assigned from the web interface (I think that's a bug or I missed something)
# Create a machine from command line and assign the image to it.

pvesh create /nodes/{your node name}/qemu -memory 2048 -sockets 1 -cores 4 -net0 e1000,bridge=vmbr0 -vmid $vmid -ostype l26 -sata0 media=disk,volume=local:$vmid/vm-$vmid-disk-1.qcow2
 

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!