-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Idea: LXC / VM ID Changer for Proxmox #7961
-
Idea: LXC / VM ID Changer for Proxmox
An interesting idea for Proxmox helper-scripts would be a tool to change the ID of an LXC container or a VM. Currently, there’s no straightforward way to rename IDs without manually editing configuration files and storage paths, which can be risky and error-prone.
Features this script could include:
- Automate ID changes for both LXCs and VMs
- Check for conflicts with existing IDs before making changes
- Automatically update storage paths and configuration references
Benefits:
- Reorganize a lab or production environment
- Standardize container and VM numbering
- Avoid ID conflicts during migrations or cloning
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 3 replies
-
I have an private Script for this, but its not easy. I think it causes more problems than it helps.
Beta Was this translation helpful? Give feedback.
All reactions
-
I dont want to be liable if such a script messes things up tbh.
Beta Was this translation helpful? Give feedback.
All reactions
-
I have an private Script for this, but its not easy. I think it causes more problems than it helps.
Oh, ok. Basically I was trying something like this:
-
Clone the LXC with the new ID and stop it
-
Copy the original last_id.conf to /tmp/new_id.conf and replace the disk reference with the new LXC one
-
Replace /etc/lxc/new_id.conf with /tmp/new_id.conf
-
Restsart the lxc
But I ran into issues when cloning, because it couldn’t handle my mounted point...
Maybe there are other issues too, but one possible approach would be to remove all custom definitions in the lxc.conf before applying this procedure, and then restore them afterward.
What do you think about this procedure?
Finally, to be safe, we could also keep the last LXC with the old ID so the user can verify that the new container is fully working before removing it manually.
Beta Was this translation helpful? Give feedback.
All reactions
-
Could you possibly share your script so I can use at my own risk? I have been wanting to write a script like this for awhile now.
Beta Was this translation helpful? Give feedback.