Rename Proxmox node

Renaming a Proxmox node isn't as simple as one would imagine, especially if you have existing VMs. Simply follow this guide step by step and you'll be good to go :)

Start by stopping necessary services:

systemctl stop pve*
nano /etc/hostname

Replace all instances of your old hostname with the new one

nano /etc/hosts

Replace all instances of your old hostname with the new one

hostnamectl set-hostname new_hostname

Reboot the server with:

reboot
cp /var/lib/rrdcached/db/pve2-node/old_hostname /var/lib/rrdcached/db/pve2-node/new_hostname
cp /var/lib/rrdcached/db/pve2-storage/old_hostname /var/lib/rrdcached/db/pve2-storage/new_hostname
rm cp /var/lib/rrdcached/db/pve2-node/old_hostname
rm cp /var/lib/rrdcached/db/pve2-storage/old_hostname

Create the necessary folders by restarting the pve-cluster service:

service pve-cluster restart
mv /etc/pve/nodes/old_hostname/lxc/* /etc/pve/nodes/new_hostname/lxc
mv /etc/pve/nodes/old_hostname/qemu-server/* /etc/pve/nodes/new_hostname/qemu-server
rm -r /etc/pve/nodes/old_hostname

Refresh the web interface and all should be working as expected