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:
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.
- Powerdown all VMs and containers
- Edit /etc/hostname and /etc/hosts with the new hostname
- Reboot the host
- At this point you will see your old host as "disconnected" in the web interface, and a new host with your new hostname appears.
- 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)
- The config for the containers is located at /etc/pve/nodes/<currenthostname>/lxc
- The config for virtual machines is stored at /etc/pve/nodes/<currenthostname>/qemu-server
etc. depending on what other technologies you are using- 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.- Finally, move the folder with the old server's hostname (/etc/pve/nodes/<oldhostname>) somewhere for backup.
- Reboot
Also you cant copy nodes folder that easy
ls
doesn't show them.this works except the storage disks in the left panel under storage is all gone....how can we also move the storage or make it display in the left panel?This worked like a charm on 2020.
Thanx @breakaway9000
Configuration file 'nodes/$NEWHOSTNAME/lxc/100.conf' does not exist
and so on./etc/pve/nodes/$OLDHOSTNAME
needs to renamed/moved to /etc/pve/nodes/$NEWHOSTNAME
too. But seems be not possible at runtime.Try toSo 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.
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?
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.
systemctl stop pveproxy.service
/etc/pve/nodes/$NEWHOSTNAME
/etc/pve/nodes/$OLDHOSTNAME
to /etc/pve/nodes/$NEWHOSTNAME
/etc/pve/nodes/$OLDHOSTNAME
systemctl start pveproxy.service
TASK ERROR: storage 'YOUR-STORAGE-NAME' is not available on node 'OLDHOSTNAME'
# cd /etc/pve/nodes
# cp -R old new
cp: cannot create regular file 'new/qemu-server/100.conf': File exists
# mv old new
mv: cannot move 'old' to 'new': Directory not empty
# 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
nano /etc/hosts /etc/hostname