Renaming a Proxmox VE Node
i12bretro
#Proxmox #Hypervisor #Rename
Full steps can be found at https://i12bretro.github.io/tutorials/0633.html
I recently upgraded my homelab Proxmox host server and wanted to repurpose my existing server to use as a testing environment. Below are the steps I used to rename the old Proxmox instance. These steps worked for me. Please let me know in the comments if you try these steps and any issues arise that I didn't have in my environment. NOTE: Renaming a node that is part of a cluster is not recommended. These steps are intended for standalone nodes. Always make backups of important VMs before attempting to modify the Proxmox host. 01. Log into ProxMox VE, either at the console, via SSH or the web UI and launch the web shell 02. Run the following commands, alternatively you can manually edit each file mentioned with nano or vi and replace the old hostname with the new one # set the old hostname and write to ini echo "OLD_HOSTNAME=$(hostname)" ≫ ~/pmrename.ini # set the new hostname in ini, update as needed echo "NEW_HOSTNAME=vm-dev" ≫≫ ~/pmrename.ini # read variables from ini source ≪(grep = ~/pmrename.ini) # edit hostname file sed -i.bak "s/$OLD_HOSTNAME/$NEW_HOSTNAME/gi" /etc/hostname # edit hosts file sed -i.bak "s/$OLD_HOSTNAME/$NEW_HOSTNAME/gi" /etc/hosts # edit mailname if it exists [ -e "/etc/mailname" ] && sed -i.bak "s/$OLD_HOSTNAME/$NEW_HOSTNAME/gi" /etc/mailname # edit main.cf if it exists [ -e "/etc/postfix/main.cf" ] && sed -i.bak "s/$OLD_HOSTNAME/$NEW_HOSTNAME/gi" /etc/postfix/main.cf # copy config files to new node name cp "/var/lib/rrdcached/db/pve2-node/$OLD_HOSTNAME" "/var/lib/rrdcached/db/pve2-node/$NEW_HOSTNAME" -r cp "/var/lib/rrdcached/db/pve2-storage/$OLD_HOSTNAME" "/var/lib/rrdcached/db/pve2-storage/$NEW_HOSTNAME" -r cp "/var/lib/rrdcached/db/pve2-$OLD_HOSTNAME" "/var/lib/rrdcached/db/pve2-$NEW_HOSTNAME" -r # reboot reboot now 03. Wait for the Proxmox host to come back up 04. Log back in and continue with the following commands # read variables from ini source ≪(grep = ~/pmrename.ini) # update storage config sed -i.bak "s/nodes $OLD_HOSTNAME/nodes $NEW_HOSTNAME/gi" /etc/pve/storage.cfg # mv vm configs mv /etc/pve/nodes/$OLD_HOSTNAME/qemu-server/*.conf /etc/pve/nodes/$NEW_HOSTNAME/qemu-server/ # mv ct configs
23287904 Bytes