Renaming a Proxmox Host Containing VMs and LXCs

Renaming a Proxmox node that currently hosts virtual machines (VMs) and containers (CTs) requires care to ensure all configuration files, hostnames, and cluster paths are updated correctly.

Here is a clear, step-by-step tutorial using the placeholders oldnode and newnode.

Important Preparations

Before running any commands, make sure to take backups of your critical VMs and containers. Having a recent backup ensures peace of mind before modifying cluster files.

Step 1: Stop All VMs and Containers

Log into your Proxmox web interface and gracefully shut down all running virtual machines and LXC containers hosted on the node you want to rename.

Step 2: Access Your Node’s Terminal

Open your node’s terminal (either via SSH or directly through the Proxmox Web GUI shell).

Step 3: Update System Hostname Files

You need to update the system files that store the hostname. Open and edit each of the following files, replacing oldnode with newnode:

  1. Hosts file:

    nano /etc/hosts
    

    (Find the line containing oldnode and change it to newnode).

  2. Hostname file:

    nano /etc/hostname
    

    (Replace oldnode with newnode, save, and exit).

  3. Postfix configuration:

    nano /etc/postfix/main.cf
    

    (Update any references of oldnode to newnode).

Step 4: Apply the New Hostname and Restart Services

Apply the new hostname system-wide using hostnamectl, then restart the Proxmox daemon and proxy services:

hostnamectl set-hostname newnode
systemctl restart pveproxy
systemctl restart pvedaemon

Step 5: Migrate VM and CT Configuration Directories

Proxmox stores VM and container configurations inside /etc/pve/nodes/. You need to move these configuration files from the old node directory to the new one.

  1. Backup the old configuration folder just in case:

    cp -R /etc/pve/nodes/oldnode/ /root/oldconfig
    
  2. Move the container and VM configuration files to the new node folder:

    mv /etc/pve/nodes/oldnode/lxc/* /etc/pve/nodes/newnode/lxc
    mv /etc/pve/nodes/oldnode/qemu-server/* /etc/pve/nodes/newnode/qemu-server
    
  3. Remove the old node directory:

    rm -r /etc/pve/nodes/oldnode
    

Step 6: Reboot and Update Storage Configuration

Reboot your Proxmox host to ensure all network settings and services pick up the new hostname cleanly:

reboot

Once the node comes back online and you are logged back into your terminal, check your storage configuration file to ensure any paths referencing the old node name are updated:

nano /etc/pve/storage.cfg

(Review the file and replace any remaining instances of oldnode with newnode, then save your changes).

Final Check: Log back into the Proxmox web GUI. Your node should now display newnode, and your VMs and containers should be present and ready to start!