Undo convert to template

Geert-Jan Gieling

Active Member
Jun 17, 2016
15
1
41
53
I'm a noob and i think i screwed up my VM.
I clicked "convert to template" and now i'm not able to start up the VM.
Is there a way to undo my mistake?

noticed that the disk image now is base-102-disk-1 and base-102-disk-2
and al my other vm's have vm-100-disk-1

Is there a way to make it work again?
 
Simply create a full (or linked) Clone.

It does not / will not work, the 2 disks are 32Gb and 10Gb in size.
And i have 31Gb left on my system.
If i do a Full or Linked Clone, the create button is greyed out.

Or I do something wrong....very possible!

But i would love to revive my old MV!
 
Well, at least for now (Proxmox VE 5.3) it is a quite simple workaround:

  1. Open host shell
  2. BE SURE YOU KNOW WHAT YOU ARE DOING AND ALWAYS CHECK EVERY LINE AND NAME THAT IT IS CORRECT ANC CORRESPONDS TO YOUR VM / DISK NAME, AND NOT JUST NAMES IN MY EXAMPLE ! (I put some underlined text fragments in my examples to give you a hint what to change, but you should check it yourself anyway)
  3. if you want to rename the disks, you use the zfs rename
    1. MANUALLY:
      1. zfs rename rpool/data/base-102-disk-1 rpool/data/vm-102-disk-1
      2. and so on for each disk
    2. SHELL LOOP:
      1. Warning: not extensively tested, but should work ok
      2. First list what will be changed:
        VMID=102; zfs list -rH -o name rpool/data | grep -e "base-${VMID}-disk-"
      3. Now run the renaming (rememeber about correct names matching your VM!):
        VMID=102; zfs list -rH -o name rpool/data | grep -e "base-${VMID}-disk-" | while read LINE; do NEW=$(echo $LINE | sed 's/\/base-/\/vm-/g'); echo $NEW; echo "Renaming: $LINE -> $NEW"; zfs rename "$LINE" "$NEW"; done
  4. you just edit the VM file on the host (/etc/pve/qemu-server/102.conf)
    1. change the template: value from 1 to 0
    2. if you renamed the disks, then correct all the names (":base-" to ":vm-") in the file (to minimise chance of a typo, use search and replace function of your text editor - for example nano and mcedit editors have it)
  5. Go to web UI, the change should be seen soon.

Can Proxmox staff confirm that it is enough to make this work? And if within a cluster it is safe?
 
Last edited:
Thanks motox, I did try your solution and it worked fine!
I just needed to remove immutable flag of the file ( chattr -i /var/lib/vz/images/100/base-100-disk-0.qcow2 ) to be able to rename it.
 
That produces a container that doesn't work - as in run wordpress. The original did, before converting to a template.
 
Which is a problem completely unrelated to the original issue of the OP and frankly a bad reason to necrobump a 2017 thread ;) Let's follow on your other post instead.
My point is relevant in that the information here, that is, backup and restore doesn't achieve what the advice indicated a container that ISN'T a template, but a working container.
 

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!