In this tutorial, we will look at how to rename a Node in Proxmox.
There are a few different reasons why you might want to rename a node, but the important point that I want to make is that the tutorial below will only work if you do not have a cluster set up and if you are not already using virtual machines/containers. If you do, I’d really suggest just leaving everything as-is and we’ll get into the reason in a little bit.
How to Rename a Node in Proxmox
We will look at how to rename a node in Proxmox below. To be entirely clear, I do not recommend changing the hostname of a Proxmox server that already has VMs or Containers installed in newer versions of Proxmox (> 7.0). The next section will explain why.
1. There are two files that must be updated in order to change the name of a Proxmox host. Run the commands below and change the name in both. The first section should have the name you’d like to use (pve-ryzen is the server name below).
nano /etc/hosts
2. Run the second command below to change the hostname in the hostname file.
nano /etc/hostname
3. When you reboot Proxmox, the new name will be used!
4. If you’d like to be thorough, you can change the hostname in the files below as well.
nano /etc/mailname (might be blank)
nano /etc/postfix/main.cf
5. You can also remove the files/folders in these locations that have the old hostname (take backups if there is anything important).
cd /var/lib/rrdcached/db/pve2-node
rm [hostname]
cd /var/lib/rrdcached/db/pve2-storage
rm -R [hostname]
Renaming a Proxmox Host with Virtual Machines/Containers Already Created
This tutorial started off as me attempting to rename my Proxmox host as I’ve received a bunch of questions about it in the past. As of right now, however, I’m restoring all of my virtual machines on a fresh install of Proxmox with the new name because I killed the server (my test servers were in a cluster so I couldn’t use them and decided to take the risk).
To make a long story short, the /etc/pve/ folder was completely blank after trying a few different solutions. I tried to repair the Proxmox installation, but unfortunately, it didn’t work. For that reason, I figured I’d use this article to explain why you probably shouldn’t do this.
File/Folder Locations Using the Proxmox Hostname
There are various folder/file locations where the Proxmox hostname is used. These are some of them:
/etc/hostname
/etc/hosts
/etc/postfix/main.cf
/etc/mailname (if you're using this)
/etc/pve/storage.cfg
/var/lib/rrdcached/db/pve2-storage
/var/lib/rrdcached/db/pve2-node
/etc/pve/nodes/[HOSTNAME]
When I attempted to rename my node, all of the files above were extremely easy to change (except for the last one). However, when you reboot Proxmox, you’ll have two nodes listed – one with the old name and one with the new name. The VMs/Containers that existed will be listed under the old name (and you won’t be able to run them) and the new name will function as a new node (for the most part, just without any of the existing VMs/Containers).
The issue comes when you attempt to move the /etc/pve/nodes/[hostname]/lxc or /etc/pve/nodes/[hostname]/qemu-server folders. These folders hold the configuration files for your VMs/Containers and they cannot be moved without shutting down specific services (and I can’t even confirm if that does or does not work). My thought process was that if I stopped one service at a time and it didn’t fix the issue, I could simply start it back up…but I was wrong.
As soon as I restarted Proxmox, the webpage was inaccessible and while I could ssh into the device, the /etc/pve folder was completely blank and attempting to repair/reinstall it didn’t work. I am fairly certain that if I was able to move the folders above, the process would have worked – however, Proxmox really doesn’t want you to move that data so simple things like renaming or copying them won’t work.
For the reason above, I am currently restoring my Proxmox VMs and Containers from backups. Before concluding this, I want to make a few points from my experience:
- Take backups of your virtual machines/containers. I’m only content with restoring this server because the actual OS is easy to install and restoring backups is only a few clicks.
- I am not saying it’s impossible to rename a node – I am simply saying that it’s probably not worth it if you’re not willing to risk reinstalling Proxmox and restoring your VMs/Containers (in a worst-case scenario).
- This thread on the Proxmox forums has a lot of good information if you want to attempt it. Make sure you understand the potential consequences and that Proxmox states this must be done on an empty node.
Conclusion: How to Rename a Node in Proxmox
This tutorial looked at how to rename a node in Proxmox. While the example above does work if there are no virtual machines/containers created, the majority of people will most likely want to rename nodes that already have VMs/containers. If you’re willing to take the risk, you might be able to get it to work – just make sure that you have backups of everything and are willing to restore your VMs/Containers if necessary.
Thanks for checking out the tutorial on how to rename a node in Proxmox. If you have any questions on how to rename a node in Proxmox, please leave them in the comments!