Proxmox node name change

Thanks @DvdNwk for the very helpful information!

This is what it took for me on a single node PVE 8.4.14 non-subscription, minus bunny trails:

1. Back up the entire pve config: cp -r /etc/pve /root/pve_backup
2. Set the new hostname: hostnamectl hostname NEW
3. Update the hostname in /etc/hosts – replace OLD with NEW, might be a good idea to leave an entry with the old hostname though.
4. Update the Postfix config in /etc/postfix/main.cf – replace OLD with NEW
5. Disable starting guests on reboot: systemctl disable pve-guests
6. Reboot: reboot
7. Stop the cluster filesystem: systemctl stop pve-cluster (DON'T do it if you're connected via the web gui - you will probably lose access and be forced to gain shell access some other way.) Not 100% sure if it is necessary but I did it.
8. Run pmxcfs -l - should succeed without lock errors
9. Go into the nodes config dir: cd /etc/pve/nodes
10. Delete the NEW dir that was created after the hostname changed: rm -rf NEW
11. Copy the node folder over: cp -r OLD NEW This will print a bunch of cp: cannot create regular file 'NEW/qemu-server/XXXX.conf': File exists Don't worry, the rest of the files should have been copied with no problems. This is because /etc/pve is actually a virtual file system that doesn't like to have duplicate VM/container configuration files.
12. Copy over the VMs configuration using different IDs: for file in OLD/qemu-server/*.conf; do cp "$file" "NEW/qemu-server/9$(basename $file)"; done This command will prefix everything with an extra 9, so make sure none of your VMs have an ID starting with 9 to avoid issues later.
13, Do similar for any containers in OLD/lxc.
14. Remove the old files: rm -rf OLD
15. Rename the files back to the original IDs: for file in NEW/qemu-server/9*.conf; do mv $file NEW/qemu-server/${file##*/9}; done
16. Do similar for any containers in NEW/lxc.
17. Go into the rrdcached folder: cd /var/lib/rrdcached/db/pve2-node/
18. Copy the old folder into the new: cp -r OLD NEW
19. Remove the old folder: rm -rf OLD
20. Do the same in /var/lib/rrdcached/db/pve2-storage
21. Re-enable starting guests on reboot: systemctl enable pve-guests
22. Reboot: reboot
23. Once you are confident everything is working, you can remove the backup: rm -rf /root/pve_backup
 
Last edited:
Thanks @DvdNwk for the very helpful information!

This is what it took for me on a single node PVE 8.4.14 non-subscription, minus bunny trails:

17. Go into the rrdcached folder: cd /var/lib/rrdcached/db/pve2-node/
18. Copy the old folder into the new: cp -r OLD NEW
19. Remove the old folder: rm -rf OLD
In my configuration, I've additionally stopped metrics first and as a last step re-enabled them.

Q: Steps 17-19, there is no folder inside cd /var/lib/rrdcached/db/pve2-node/, it's just a file with name OLD.
So, in my case, no need to copy recursive, just the copy file OLD in step 18 and remove the file OLD in step 19

Can someone acknowledge this?

Edit: I found the reason: After upgrading to pve 9.1.2, there is now a new folder: /var/lib/rrdcached/db/pve-storage-9.0/
Inside I found the folder with the old name of the Proxmox node. So step 17 reads cd /var/lib/rrdcached/db/pve-node-9.0/in my case.
This applies to step 20, too!
 
Last edited:
In my configuration, I've additionally stopped metrics first and as a last step re-enabled them.

Q: Steps 17-19, there is no folder inside cd /var/lib/rrdcached/db/pve2-node/, it's just a file with name OLD.
So, in my case, no need to copy recursive, just the copy file OLD in step 18 and remove the file OLD in step 19

Can someone acknowledge this?

Edit: I found the reason: After upgrading to pve 9.1.2, there is now a new folder: /var/lib/rrdcached/db/pve-storage-9.0/
Inside I found the folder with the old name of the Proxmox node. So step 17 reads cd /var/lib/rrdcached/db/pve-node-9.0/in my case.
This applies to step 20, too!
I ran everything @DvdNwk and you mentioned. It worked like a charm on 9.1.4 on 3 nodes. But they were all standalone.

Could anyone verify if this renaming process would work, or not, on nodes that are part of a cluster?
 
== Cleanup section: rrdcached paths are outdated on PVE 9 ==

The Cleanup section says to copy /var/lib/rrdcached/db/pve2-{node,storage}/old-hostname to the new hostname. Those paths no longer exist on Proxmox VE 9. On pve-manager/9.2.4 the layout is:

/var/lib/rrdcached/db/
├── pve-node-9.0/
├── pve-storage-9.0/
└── pve-vm-9.0/

Two differences worth noting for anyone scripting this:
  • The directories are pve-node-9.0 / pve-storage-9.0, not pve2-node / pve2-storage.
  • Under pve-node-9.0/ the per-node entry is a plain file named after the host, whereas under pve-storage-9.0/ it is a directory (containing one file per storage). A cp -a loop that assumes both are directories silently skips the node data.
So on PVE 9 the equivalent cleanup is roughly:
# storage: directory
cp -a /var/lib/rrdcached/db/pve-storage-9.0/OLD/. /var/lib/rrdcached/db/pve-storage-9.0/NEW/
rm -rf /var/lib/rrdcached/db/pve-storage-9.0/OLD


# node: single file (a new one is created on boot under the new name; merging two RRD files is
# non-trivial, so on a young node it is usually simplest to discard the old history)
rm -f /var/lib/rrdcached/db/pve-node-9.0/OLD
Also a small addition to the Cleanup section: after the rename, /etc/pve/nodes/OLD/ is left behind containing pve-ssl.pem, pve-ssl.key, lrm_status and ssh_known_hosts. On a node with no guests it can simply be removed. The node certificate is regenerated automatically for the new name, so no manual cert step was needed.

Otherwise the procedure worked exactly as documented on a standalone node — thanks for the page.