Creating new VM with another VM's qcow2 files

yatta

New Member
Feb 8, 2024
8
0
1
Hi,
I'm pretty new at Proxmox and still trying to learn.

One thing I want to ask ; I have a VM and this VM has 2 files on disk, "vm1-disk-1.qcow2" and "vm1-disk-2.qcow2"
I want to create a new another VM from Proxmox GUI and use these 2 files on this VM. So basically I'm moving or restoring the VM above.

Is this possible on Proxmox? If so, is there any document available to refer?

Kind regards.
 
Exactly, I want to move a VM (2 qcow2 files) to another server and restore in there with these qcow2 files(disks).
So I moved these 2 files to another server(which is Proxmox installed) and from GUI I created a new VM, but there is no option for me to choose these disks(files).

1707397698330.png

And by the way no idea but that "qm" command somehow doesn't exist on my server.
 
Last edited:
You can create the VM and then add the disks later on.
 
I also tried that but still same. "Hardware--> Add Hard Disk" and the same windows appearing above. There is nowhere to select qcow2 files.
 
Do you still have the old VM configured in Proxmox VE? If so, go to it and there you can do the Disk Action -> Reassign Owner to the new VM.
 
Yes but that's not my goal. I want to copy this qcow2 files to somewhere else and recover in there.
 
Well, then there was a misunderstanding. Can you clarify where "somewhere else" is?
 
Actually the purpose is trying backup all qcow2 files and restore it. So we are backing up all VM qcow2 files to a NAS server daily.
And my purpose is, copy a VM's qcow2 file to Proxmox server back and restore this file in there. Create a new VM and use this file. But without using "Disk Action -> Reassign Owner".
I know probably not the best practice to backup VM's but still a goal for us.

EDIT : For example when I created a new empty VM, it's creates an ID and directory. And I'm copying the other qcow2 files to this directory and trying to replace current ones, but doesn't work also.
 
Last edited:
Well, you could use the integrated backup functionality, as that would also back up the config of the VM. You can still store that to your NAS if you configure the share as a storage and enable the "vzdump" content type.

If you have the disk images available on the NAS and want to import them to a newly created VM, the easiest way would be to use the qm disk import {vmid} /mnt/pve/nas-storage/path/to/file {target storage name} command. See the qm man page.

Another more manual option is to move the disk images into the equivalent location and do a qm rescan {vmid}. They will then show up as unused disks in the VM config.
 
I can try that option also but right now I have to recover that qcow2 files on a new VM. I guess it's not an easy task?
 
I offered you two options on how you can import the qcow files to a new VM. Or do you want to attach them from where you have them currently stored?
 
Yes that can be also an option, attach qcow2 disks currently stored, or move them any directory on the current Proxmox' NAS server and recover/attach them to any newly created VM.

Just found a solution from another thread (https://forum.proxmox.com/threads/moving-a-whole-vm-to-another-host.29485/)


Code:
* create a new VM with ID 104 on your new server with a qcow disk
* overwrite the disk in /var/lib/vz/images/104/ with your original file
* on the Web UI, go to the VM settings, the disk size is probably wrong, unplug the disk (select the disk then click on the "remove" button")
* the disk will appear as "unused", select it and add it again to your VM, it will be correctly recognized this time.


If this is the only way to recover a qcow files on the same Proxmox server, then it's impossible for me. Coz that server with same ID is still exist on the Proxmox's NAS disk. I mean I copied "SERVERA"'s qcow files somewhere else and want to recover on the same Proxmox server as a "SERVERB".
 
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!