Change hostname

decibel83

Renowned Member
Oct 15, 2008
210
1
83
Hi.

I need to change the hostname of a running Proxmox 2.1 environment with some virtual machine installed.
I simply tried changing the hostname with the typical Linux way but I lost all virtual machine references in the web interface.
I tried repairing the problem but after some minutes I reverted to the old hostname.

Is there an official way to do this?

Thank you very much!
Bye.
 
You also need to fix /etc/hosts (and reboot), and then rename the directory where the VM configs are stored (/etc/pve/nodes/[NODENAME])
 
You also need to fix /etc/hosts (and reboot), and then rename the directory where the VM configs are stored (/etc/pve/nodes/[NODENAME])

I try this on Proxmox 4. But it can't be moved / renamed. I try to

cp -r /etc/pve/nodes/[OLDNODES] /etc/pve/nodes/[NEWNODEHOSTNAME]

but it said like this

cp: cannot create regular file '/etc/pve/nodes/[NEWNODEHOSTNAME]/qemu-server/100.conf': File exists

This is strange because [NEWNODEHOSTNAME] folder is still not exist. What's wrong?
 
I try this on Proxmox 4. But it can't be moved / renamed. I try to

cp -r /etc/pve/nodes/[OLDNODES] /etc/pve/nodes/[NEWNODEHOSTNAME]

but it said like this

cp: cannot create regular file '/etc/pve/nodes/[NEWNODEHOSTNAME]/qemu-server/100.conf': File exists

This is strange because [NEWNODEHOSTNAME] folder is still not exist. What's wrong?

you cannot copy, you have to move (use 'mv' instead of 'cp')
 
you cannot copy, you have to move (use 'mv' instead of 'cp')

I have tried that. But the result is this

mv: cannot move '/etc/pve/nodes/ns1' to '/etc/pve/nodes/host2': Directory not empty

It said directory not empty even there is no host2 directory before. This is the result of ls -l

root@ns1:~# ls -l /etc/pve/nodes/
total 0
drwxr-xr-x 2 root www-data 0 Aug 13 20:46 ns1

because of that, I try to cp -r without success...
 
I try this on Proxmox 4. But it can't be moved / renamed. I try to
cp -r /etc/pve/nodes/[OLDNODES] /etc/pve/nodes/[NEWNODEHOSTNAME]
but it said like this
cp: cannot create regular file '/etc/pve/nodes/[NEWNODEHOSTNAME]/qemu-server/100.conf': File exists
This is strange because [NEWNODEHOSTNAME] folder is still not exist. What's wrong?
Please, read carefully:
Proxmox Cluster file system
Proxmox node name change
 
  • Like
Reactions: akhfa
if anyone else should be reading this topic after all these years the issue here is that another node in the cluster already has a container or a vm with the name of that conf file.

the fix here is simply to rename the *.conf file to a number that isnt already given on any of the nodes and after that you can freely copy your files between the old and the new folder :)
 
  • Like
Reactions: datschlatscher

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!