Proxmox Node Management – Renaming Nodes

Maybe the hosting provider you just bought a server from automatically sets the hostname or maybe you didn’t think about it when you setup your homelab and now want to give your servers better names than “PVE0X”. Whatever your reason is, the problem is still the same: you need to rename your proxmox node(s). The process is fairly simple, but there are some considerations to be made before proceeding.

Storage Considerations (Datacenter)

If your shared storage refers to its host via hostname rather than IP address or DNS entry, then these will need to be re-provisioned as they cannot be edited. Any containers or virtual machines that are using that storage needs to be migrated to a different storage location.

Storage Considerations (Containers & Nodes)

The same goes for storage such as NFS referenced by containers, nodes and virtual machines. You should change these references to IP address or DNS entry name. You may also update then to use the hostname you plan on using, but this is less advisable for potential future changes.

Now that we have migrated our storages to IP address or our local-lvm, we can start making changes. You will need to repeat the following steps on each node in the cluster you want to rename. You will also need to repeat the corosync config step for every node in the cluster, even if they are not being renamed.

Step 1 – Connect via SSH

First things first, we will want to be connecting to the node(s) via SSH and not the Proxmox Web Interface. This will prevent any communication issues that may crop up during the process. Make sure to transfer your SSH key to the nodes prior to continuing, if you haven’t already.

eval $(ssh-agent)
ssh-add /path/to/ssh/key
ssh <user>@<server_ip>

Step 2 – Obtain Local Lock

Now that we are connected, we will need to obtain a local lock with pmxcfs so that we can edit our server’s configuration. To do this, we will need to kill the process with the current lock, pve-cluster, then pass the -l flag to the invocation of pmxcfs.

systemctl stop pve-cluster
pmxcfs -l

If there is any issue with the lock, there will be an error message similar to: [main] notice: unable to acquire pmxcfs lock - trying again.

If everything is okay, the output should just look like

[main] notice: resolved node name 'tucana' to '192.168.12.3' for default node IP address
[main] notice: forcing local mode (although corosync.conf exists)

Step 3 – Modify Host Files

Now, we will need to edit /etc/hostname and /etc/hosts to reflect our desired changes. Here, I will be changing pve to tucana

/etc/hosts

127.0.0.1 localhost.localdomain localhost
192.168.12.3 tucana.net.hlab tucana

# The following lines are desirable for IPv6 capable hosts

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

/etc/hostname

tucana

Step 4 – Modify Corosync Config

Since we have changed the hostname, we will also have to update references in /etc/pve/corosync.conf to reflect the changes. Alternatively, you can delete this configuration to reset the cluster state, then recreate the cluster after the name changes have been made.

/etc/pve/corosync.conf

logging {
  debug: off
  to_syslog: yes
}

nodelist {
  node {
    name: ara
    nodeid: 1
    quorum_votes: 1
    ring0_addr: 192.168.12.125
  }
  node {
    name: tucana
    nodeid: 3
    quorum_votes: 1
    ring0_addr: 192.168.12.3
  }
  node {
    name: volans
    nodeid: 2
    quorum_votes: 1
    ring0_addr: 192.168.12.251
  }
}

quorum {
  provider: corosync_votequorum
}

totem {
  cluster_name: hlab01
  config_version: 3
  interface {
    linknumber: 0
  }
  ip_version: ipv4-6
  link_mode: passive
  secauth: on
  token_coefficient: 321
  version: 2
}

Step 5 – Restart The Node

Once we have made those changes, we will need to restart the node so it can create the directory structure required for the next step.

killall pmxcfs
reboot

Step 6 – Transfer LXC Configs

Before we can transfer the LXC configs to the new node name, we will again need to kill the current lock and create our own.

systemctl stop pve-cluster
pmxcfs -l

Now, we can move the configs from the old node name to the new name.

mv /etc/pve/nodes/<old_name>/lxc/* /etc/pve/nodes/<new_name>/lxc/

Step 7 – Cleanup & Reboot

Finally, we will need to clean up the last reference to the node’s previous name.

rm -rf /etc/pve/nodes/<old_name>

After this, restart the node

reboot

That’s it! Your node has been renamed and you can move on to the other nodes in the cluster.

Posted in: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *