Proxmox node name change

I just found this thread (First hit on google for 'proxmox change hostname').

I am running Proxmox 4.4-2 and I have an assortment of both containers and VMs on my host (qemu). It is a single-host environment, no clustering in use. I am however using a 3-disk RAIDZ-1 for storage (as configured by the Proxmox installer).

It turns out the steps to follow in order to change the hostnames are as follow:
  1. Powerdown all VMs and containers
  2. Edit /etc/hostname and /etc/hosts with the new hostname
  3. Reboot the host
  4. At this point you will see your old host as "disconnected" in the web interface, and a new host with your new hostname appears.
  5. SSH into the machine and navigate to /etc/pve/nodes - here you will see two folders (one with your new hostname, one with your old hostname)
  6. The config for the containers is located at /etc/pve/nodes/<currenthostname>/lxc
  7. The config for virtual machines is stored at /etc/pve/nodes/<currenthostname>/qemu-server
    etc. depending on what other technologies you are using
  8. So I just moved the contents of each folder into the folder for the new host - i.e. /etc/pve/nodes/<newhostname>/lxc etc.
    The second I did this, I saw the web interface update with the VMs and containers now showing in the correct datacenter and under the correct host.
  9. Finally, move the folder with the old server's hostname (/etc/pve/nodes/<oldhostname>) somewhere for backup.
  10. Reboot
When the system came back up the old "disconnected" host was gone, and only the new host was shown with the correct name. All the containers & VMs start up just fine, all the host config has been retained and is working properly.

This worked like a charm on 2020.
Thanx @breakaway9000
 
  • Like
Reactions: Frechetta93
Also you cant copy nodes folder that easy

I tried the method described below, but I can't copy the config files. It always says the file already exists, even though ls doesn't show them.

Also it turned out to replicate the qemu-server folder inside itself. Still haven't been able to change the name... :(
 
I can concur that the wiki post is hot garbage and you will ruin your Proxmox host if you try this. Good thing I tried this in a lab first. Encountering the same issue where the nodes folder contents refused to copy. Gave it another reboot, and not sure what has happened, but now the entire nodes folder is empty, and my proxmox install is toast, won't even load the WebUI. Wonderful.
 
Last edited:
  • Like
Reactions: DvdNwk
Hello,

Here we have a two-nodes cluster in which the hostnames of the nodes are OK, but their domain names are to be changed.
In all the setup changes your are all talking about, I see nowhere any mention of the domain name.

Would that imply that I can simply modify /etc/hosts and change the FQDN from node1.olddomain.com to node1.newdomain.com and just easily reboot?

Thank you
 
The Wikipage https://pve.proxmox.com/wiki/Renaming_a_PVE_node is outdatet/not complete. I renamed a PVE 7 (standalone) instance and after the reboot no VM/CT came up.

Failure: Configuration file 'nodes/$NEWHOSTNAME/lxc/100.conf' does not exist and so on.

So it looks like the folder /etc/pve/nodes/$OLDHOSTNAME needs to renamed/moved to /etc/pve/nodes/$NEWHOSTNAME too. But seems be not possible at runtime.


Edit: found this link: https://erik.ellsinger.me/how-to-change-the-hostname-of-a-proxmox-node/ but does not work too.
 
Last edited:
Yep this is one of the things that I was hoping Proxmox 7 would resolve. Alas, it appears to be an ongoing issue :(

The only way that I've had success is to backup all my VMs, reinstall Proxmox, and restore all my VMs again. It's kind of a pain to do though.
 
Hey guys, just wondering if there was any plans or ways to rename Proxmox 7 hosts? It has been out for a little while now.
 
So it looks like the folder /etc/pve/nodes/$OLDHOSTNAME needs to renamed/moved to /etc/pve/nodes/$NEWHOSTNAME too. But seems be not possible at runtime.
Try to systemctl stop pveproxy.service the daemon and perform the rename with that stopped so it doesn't read the configurations while you're doing so (or try to stop you). Then it's systemctl start pveproxy.service to get it running again...
 
Has anyone had any success changing the hostname on v7?
I would also like to know how to change the hostname in 2022 using v7.

Yes, I have done it on v7.2.3. First, I struggled like many of you, too. I finally succeeded by combining 2 major steps:

A)
As mentioned in https://pve.proxmox.com/wiki/Renaming_a_PVE_node I corrected the hostname to the new name in the following files:
  1. /etc/hosts
  2. /etc/hostname
  3. /etc/postfix/main.cf
I then rebooted the host.

B)
I followed the combined steps indicated by ikke and bryanpedini further up in this thread:
  1. systemctl stop pveproxy.service
  2. I emptied the folder /etc/pve/nodes/$NEWHOSTNAME
  3. I moved the contents of the folder /etc/pve/nodes/$OLDHOSTNAME to /etc/pve/nodes/$NEWHOSTNAME
  4. I removed the folder /etc/pve/nodes/$OLDHOSTNAME
  5. systemctl start pveproxy.service
Furthermore, I opened the "Storage" menu in the Proxmox GUI at the level "datacenter" and opened the storage containers one by one. Wherever the old hostname was in the field "Nodes" I exchanged it with the new hostname. - If you don't check your storage containers you may run into errors of the following kind when starting virtual machines:
TASK ERROR: storage 'YOUR-STORAGE-NAME' is not available on node 'OLDHOSTNAME'
 
Last edited:
When you follow the guide to rename your PVE node, but your node is not empty, you'll run into trouble like this (as noted before):
Code:
# cd /etc/pve/nodes
# cp -R old new
cp: cannot create regular file 'new/qemu-server/100.conf': File exists

Or in case of trying to move the directory:
Code:
# mv old new
mv: cannot move 'old' to 'new': Directory not empty

It seems this is due to the fact that the system detects that you're trying to create VMs with the same IDs.
I had success doing the following:
Code:
# systemctl stop pve-cluster
# pmxcfs -l
# cp -R old new
cp: cannot create regular file 'new/qemu-server/100.conf': File exists
# cp old/qemu-server/100.conf new/qemu-server/200.conf # do this for every VM
# mv old /root/ # for backup
# reboot
# systemctl stop pve-cluster
# pmxcfs -l
# cd /etc/pve/nodes/new/qemu-server
# mv 200.conf 100.conf # do this for every VM
# reboot

Slightly involved, but does the trick. Also, I'm not sure if it's necessary to stop the pve-cluster service, manually mount the fuse fs and then reboot.
I did it anyway for reasons of caution.
 
Last edited:
  • Like
Reactions: DvdNwk
the wiki does say "This must be done on a empty node." at least it does at the time of writing.

best way i know of (fresh install, before first boot):
- uncheck automatically reboot after successful install,
- ALT+<Fkey> when its done for a command line
- nano the files:
Code:
nano /etc/hosts /etc/hostname

- reboot
- (restore your containers from backups?)

1668246205269.png
 
Am I correct that changing the hostname in a cluster setup with existing VMs would break the entire installation? Or is it somehow possible to change it by editing the SQLite DB directly?

Reason being that when I initially setup the cluster, our naming convention wasn't finalized yet. Can change it on all other hosts, so just the PVE hosts would remain with the old naming scheme...
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!