PVE 6.3-3 - Change Hostname

Jan 23, 2021
51
17
13
Hi all,

I want to change the hostname of my PVE. It is already setup and running numerous VMs.

I know I need to edit /etc/hostname and also /etc/hosts but from what I have read elsewhere on the forums and also online is that some directories also need to be moved for the VMs to continue working. I may have misread but I think the locations of these directories were different over various versions of PVE.

Is anyone able to clarify the exact steps I need to take to make this change on PVE 6.3-3 please to get the hostname updated?

Thanks,

FS
 
Thought I would post how I achieved this.

I should note that my PVE is not currently part of a cluster. I do plan on adding further nodes in the future which is why I wanted to get this hostname changed now. My PVE did already have about 25 VMs running, however.

Update /etc/hostname, /etc/hosts, and /etc/postfix/main.cf with the new hostname.

Take a backup of the current node.
cp -r /etc/pve/nodes/OLD-HOSTNAME /root/

Restart the server.
reboot

Update /etc/pve/storage.cfg with the new hostname.

Move all VM configuration files from the old node to the new node.
mv /etc/pve/nodes/OLD-HOSTNAME/qemu-server/* /etc/pve/nodes/NEW-HOSTNAME/qemu-server

Restart the server.
reboot

At this point, everything was working as desired so I deleted the old node and did a final restart.
rm -rf /etc/pve/nodes/OLD-HOSTNAME
reboot


I'm not sure if this could have been cut down somewhat, or if I have missed any minor other bits where references to the old hostname appear but these are the steps I took and it's working.

Thanks,

FS
 
Hi All

Also had the same Problem. For me it didnt quite work. After following the steps above my ProxMox Node appeared to be Offline. With the help of ChatGPT i figured out a way just to replace the Hostname everywhere. Worked perfect!

sudo find /path/to/search -type f -readable -writable -exec grep -IlZ "OLDNAME" {} + | xargs -0 -I {} sed -i 's/OLDNAME/NEWNAME/g' "{}"
 

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!