Renaming a Node

From Da Nerd Mage Wiki
Jump to navigation Jump to search

Original Source

Working? Sample

Stopped all VMs [ Also Moved all important VM to another Node for my peace of mind]

Actually... Just back them up. They're gonna bork anyhow...

From the node terminal which I want to rename, I ran these and made changes for new_hostname

  • cp -r /etc/pve /root/pve_backup
    • Backing up the entire pve directory?
  • vi /etc/hosts /etc/hostname /etc/mailname /etc/postfix/main.cf
    • Change all occurrences of existing old_hostname to new_hostname
  • hostnamectl set-hostname new_hostname
  • vi /etc/pve/corosync.conf
    • Changeold_hostname to new_hostname
    • increase the config_version from (add 1 to whatever is there currently)
  • pvecm updatecerts
    • This is only really valid if you're using the built-in certs...
  • systemctl restart pveproxy
  • systemctl restart pvedaemon
  • cd /etc/pve/nodes
  • cp -r /etc/pve/nodes/old_hostname/ /root/oldconfig
    • why back it up like this?
  • cp /etc/pve/nodes/old_hostname/lxc/* /etc/pve/nodes/new_hostname/lxc
  • cp /etc/pve/nodes/old_hostname/qemu-server/* /etc/pve/nodes/new_hostname/qemu-server
    • These last two seem to be trying to repeat something already done (probably by one of the above restarts...)
  • rm -rf /etc/pve/nodes/old_hostname
  • cd /var/lib/rrdcached/db/pve2-node/
  • cp -r old_hostname new_hostname
  • cd /var/lib/rrdcached/db/pve2-storage/
  • cp -r old_hostname new_hostname
  • reboot
  • After restart I also changed my storage settings as well
    • vi /etc/pve/storage.cfg
      • Not sure what changes you did...

Unfortunately, while this does indeed rename the node, it kinda borks any existing VMs & containers as well as extra local storage (volume groups, thinpools, directories, possibly ZFS) created in the UI. The data isn't gone, just the mounts for these things...

For now:

  • go to local-lvm & delete the content of VM Disks & CT Volumes
  • reconstruct your extra local storage.
  • Restore your VMs & CTs from backup...

More research is needed...

Note: A minor thing, but it'll mess with you... Any Web UI sessions open to another node will still show the old name as a (broken) node until cleared from your browsers cache. Just closing the tab & then opening it fresh works...