Changing a container ID in Proxmox requires stopping the container, renaming its storage directory, and updating the configuration — but the exact steps depend on whether you're using LXC or QEMU containers
A Proxmox container ID is the numerical identifier that Proxmox uses to track and manage each container on your node. If you need to change it — usually because you want a more logical numbering scheme or you're consolidating containers after a migration — you cannot simply edit the ID in the web interface. You have to stop the container, move its storage directory to match the new ID, and update the configuration file that points to it.
The process is straightforward but requires command-line access to your Proxmox host. If you make a mistake, you risk the container not starting again, so it's worth understanding each step before you run it. This guide covers LXC containers, which are the most common type in Proxmox; QEMU virtual machines use a similar approach but store their disk images differently.
Key Takeaways
- You must stop the container completely before changing its ID; a running or paused container cannot be safely renamed.
- The container's storage directory and configuration file must both be renamed to match the new ID, or Proxmox will not recognize the container.
- The storage path depends on your setup — containers are usually in /var/lib/vz/private/ for local storage or in a mounted pool directory for shared storage.
- After renaming, verify the container starts and that its data is intact before you delete the old directory.
Stop the container and verify it is offline
Open the Proxmox web interface, select your container from the left panel, and click Stop in the top right. Wait for the status to show stopped — do not proceed while the container is still shutting down or in any state other than stopped.
If the container is locked or will not stop, you can force it from the command line. SSH into your Proxmox host as root and run lxc-stop -n OLDID, replacing OLDID with the current container ID. If that fails, use lxc-stop -n OLDID --kill to force it. Verify it is stopped by running pct status OLDID — the output should show stopped.
Locate the container's storage directory
The location of your container's files depends on your storage configuration. For most single-node setups, LXC containers are stored in /var/lib/vz/private/OLDID. To confirm, SSH to your Proxmox host and run ls -la /var/lib/vz/private/ | grep OLDID, replacing OLDID with your current container ID. You should see a directory named after the container ID.
If that directory does not exist, check your storage pool configuration. In the Proxmox web interface, go to Datacenter > Storage and note the path listed for your storage pool. If you are using a custom pool, the container directory might be in /mnt/pve/poolname/private/OLDID or another location. Run find /mnt -name OLDID -type d to search for it if you are unsure.
Rename the container directory and configuration file
From the command line on your Proxmox host, rename the container's storage directory. Run mv /var/lib/vz/private/OLDID /var/lib/vz/private/NEWID, replacing OLDID and NEWID with the old and new container IDs. If your container is in a different storage path, adjust the command accordingly.
Next, rename the configuration file. The container configuration is stored in /etc/pve/lxc/OLDID.conf. Run mv /etc/pve/lxc/OLDID.conf /etc/pve/lxc/NEWID.conf. These two steps are essential — Proxmox looks for a configuration file matching the container ID, and it expects the storage directory to have the same name.
Update the configuration file to reference the new ID
Open the renamed configuration file in a text editor. Run nano /etc/pve/lxc/NEWID.conf and look for any lines that reference the old container ID. The most important line is usually hostname: OLDID — change this to hostname: NEWID if you want the container's hostname to match its new ID.
Check for any other references to the old ID in the file, particularly in mount points or custom settings. If you see a line like mp0: /var/lib/vz/private/OLDID/something,mp=/mnt, update it to use NEWID. Save the file and exit the editor (in nano, press Ctrl+X, then Y, then Enter).
Start the container and verify it works
From the Proxmox web interface, select the container by its new ID and click Start. Watch the status panel — it should show running within a few seconds. If it stays in stopped or shows an error, check the task log (click the task in the top right corner) for details.
Once the container is running, log into it to verify that your data is intact. You can do this through the Proxmox web interface by clicking Console, or by SSH if the container has network access. Check that your files and services are where you expect them to be. If everything looks correct, you can safely delete the old storage directory by running rm -rf /var/lib/vz/private/OLDID — but only after you are certain the new container is working.
Troubleshooting if the container will not start
If the container fails to start after the rename, the most common cause is a mismatch between the configuration file name, the directory name, and the hostname setting. Verify that all three match: the file is named NEWID.conf, the directory is named NEWID, and the hostname line in the config file is set to NEWID.
Check the task log for specific error messages. If you see a message about a missing rootfs or storage path, open the configuration file again and verify that any mount points or storage references use the correct path. If you are still stuck, you can revert by renaming everything back to the old ID and restarting — this is why it is important not to delete the old directory immediately.
Frequently Asked Questions
Can I change a container ID while it is running?
No. The container must be completely stopped before you rename its directory or configuration file. If you attempt this on a running container, Proxmox will lose track of it or the container may fail to shut down cleanly.
What if I have snapshots of the container?
Snapshots are stored within the container's directory and will move with it when you rename the directory. However, verify after the rename that snapshots still appear in the Proxmox interface. If they do not, check the configuration file for any hardcoded snapshot paths and update them to use the new ID.
Do I need to update the hostname inside the container?
Not necessarily for Proxmox to recognize the container, but it is good practice. If you want the container's internal hostname to match its new ID, you can change it after the container starts by editing /etc/hostname inside the container and rebooting, or by updating the hostname line in the configuration file before starting.
Can I change a container ID on a cluster?
The process is the same, but you must perform it on the node where the container is stored. If the container is replicated or shared across nodes, check your cluster documentation for any additional steps needed to keep replicas in sync.
What if the new ID is already in use by another container?
Proxmox will prevent you from starting a container if its ID conflicts with an existing one. Choose a unique ID that is not already assigned to any other container on the node. You can see all container IDs in the left panel of the web interface.