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?