Change the VMID of a container

taich

Member
Aug 15, 2020
110
15
23
64
How can I change the vmid of a container?

I already changed vmid.conf in lxc dir and name of disk-file but the container wont start anymore.
 
You could create a backup and restore to your prefered VM ID. When you start the restore you have to set the new VM ID. I guess it's the fastest way.

Btw.:
VM ID = VM - virtual machine
CT ID = Container
 
Last edited:
  • Like
Reactions: Stoiko Ivanov
You could create a backup and restore to your prefered VM ID. When you start the restore you have to set the new VM ID. I guess it's the fastest way.

Btw.:
VM ID = VM - virtual machine
CT ID = Container
When I click the restore button there is no option to change CM ID
 
  1. What is the error?
  2. Can you show your vmid.conf here?
The error is
Requesting HA start for CT 200
update resources config failed: no such resource 'ct:200'
TASK ERROR: command 'ha-manager set ct:200 --state started' failed: exit code 255

arch: amd64
cores: 1
hostname: test.example.at
memory: 512
nameserver: 1.1.1.1
net0: name=eth0,bridge=vmbr0,firewall=1,gw=2.2.2.x,gw6=2001:3cc0::x,hwaddr=CE:84:74:C4:21:1B,ip=2.2.2.x/24,ip6=2001:3cc0::x/64
ostype: ubuntu
rootfs: DRBD2:900/vm-900-disk-0.raw,size=5G
searchdomain: example.at
swap: 512
unprivileged: 1

I changed the 900 to 200 here and on the storage DRBD2 to.
 
the easy way that you can change the VMID is to make a backup for that VM you want to change VMID and restore it with a different VMID

UPDATE: you can do the restore with the different VMID only using API or CLI for example:

Bash:
pct restore 9999 Backup:backup/vzdump-lxc-100-2021_06_29-11_03_53.tar.zst --storage local-lvm
 
Last edited:
the easy way that you can change the VMID is to make a backup for that VM you want to change VMID and restore it with a different VMID
When I try to restore the VM/CT there is no option to change the ID.
 

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!