What happens when you change a container ID in Proxmox
Changing a container ID in Proxmox reassigns the numerical identifier that the system uses to track that container. When you change the ID, Proxmox renames the container's configuration files, storage directories, and internal references — but the container itself stays the same. The process takes a few minutes and requires the container to be stopped.
You might need to do this if you want to consolidate container numbers after deleting old containers, if you inherited a system with confusing ID gaps, or if you're moving containers between Proxmox nodes and want them to have matching IDs. The change is straightforward, but it does require command-line access and a moment when the container is offline.
Key Takeaways
- You must stop the container before changing its ID — a running container cannot be renamed.
- The actual command is pvecm or direct filesystem operations, depending on your Proxmox version and whether the container uses LXC or OpenVZ.
- Proxmox stores container data in /var/lib/vz or /var/lib/lxc, and changing the ID means moving or renaming those directories.
- After you change the ID, verify the container starts correctly and that its network and storage still work before putting it back into production.
Stop the container first
Open the Proxmox web interface or SSH into your Proxmox host. In the web interface, select the container, then click the Stop button. If you prefer the command line, run pct stop [old-id], replacing [old-id] with the current container number.
Wait for the shutdown to complete — you'll see the container status change to "stopped" in the interface. Do not proceed until the container is fully stopped, or the rename operation will fail or leave the container in an inconsistent state.
Locate the container's configuration and storage directories
Container data lives in different places depending on your setup. For LXC containers (the modern standard), look in /var/lib/lxc. For older OpenVZ containers, check /var/lib/vz. You can also check the Proxmox configuration directory at /etc/pve/lxc or /etc/pve/openvz.
SSH into your Proxmox host and list the directories to confirm where your container lives. For example, run ls /var/lib/lxc to see all LXC container directories. You should see a folder named after your current container ID — for instance, if your container ID is 100, you'll see a folder called 100.
Rename the container using the command line
The safest way to change a container ID is to use Proxmox's built-in tools rather than moving files manually. For LXC containers, use the command pct move-to-node [old-id] [hostname] if you're moving between nodes, or use pct clone [old-id] [new-id] to create a copy with a new ID, then delete the old one.
If your version of Proxmox does not have a direct rename command, you can rename the directories manually. Stop the container, then run mv /var/lib/lxc/[old-id] /var/lib/lxc/[new-id] to move the container directory. Next, rename the configuration file: mv /etc/pve/lxc/[old-id].conf /etc/pve/lxc/[new-id].conf. Then edit the new configuration file and update any internal references to the old ID.
After moving the directories, run pct list to verify that Proxmox recognizes the container under its new ID.
Update the container configuration if needed
Open the new configuration file at /etc/pve/lxc/[new-id].conf in a text editor like nano or vi. Check for any lines that reference the old container ID — these are rare, but some custom configurations or scripts might hardcode the ID.
Look especially for hostname entries, network device names, or storage mount points that might reference the old ID. If you find any, update them to use the new ID. Save the file and close the editor.
Start the container and verify it works
In the Proxmox web interface, select the container under its new ID and click Start. Watch the console output to make sure the container boots without errors. If you're using the command line, run pct start [new-id] and then pct console [new-id] to watch the boot process.
Once the container is running, log in and verify that the network is working, that storage mounts are accessible, and that any services you run inside the container have started correctly. If something is broken, stop the container when ready and check the configuration file for typos or missing references.
Delete the old container data if the clone method was used
If you used pct clone to create a copy with the new ID, the old container still exists. Once you've confirmed the new container works, you can safely delete the old one. In the Proxmox web interface, right-click the old container and select Remove. Confirm the deletion.
From the command line, run pct destroy [old-id]. This removes the container's configuration file and storage directories. Do not skip this step if you used the clone method, or you'll have two containers taking up disk space.
Frequently Asked Questions
Can I change a container ID while it's running?
No. The container must be stopped before you rename its directories or configuration files. If you try to rename a running container, Proxmox will either refuse the operation or leave the container in a broken state where it cannot start again.
Will changing the container ID affect the data inside it?
No. The container's files, applications, and settings remain unchanged. Only the identifier that Proxmox uses to track the container changes. From inside the container, nothing looks different.
What if I make a mistake and the container won't start after the rename?
Stop the container, rename the directories back to the original ID, and rename the configuration file back as well. Then start the container again under its original ID. You can then try the rename process again more carefully, or use the clone method instead.
Do I need to update my backup scripts if I change a container ID?
Yes, if your backup scripts reference the container by ID. Update any cron jobs, backup configuration files, or automation scripts to use the new ID. Check your backup software's documentation for how to update container references.
Can I change multiple container IDs at once?
You can, but do them one at a time. Stop each container, rename it, verify it starts, and then move to the next one. Renaming multiple containers in parallel increases the risk that you'll mix up the old and new IDs or accidentally delete the wrong directory.