Migrating Proxmox to a new install
After my Proxmox disk failed I managed to clone the disk before it died entirely and boot from it. But that’s temporary hardware, now I want to set up Proxmox again on a new permanent disk, a 256GB 970 EVO I had lying around.
I’ve decided to go for a full rebuild, installing PVE and configuring it as if new. Then restoring all my guests from a backup. There’s a simpler path where you just restore /var/lib/pve-cluster/config.db /etc/hosts /etc/hostname but I kind of want to redo the setup. I did this before in January for a different server. This post is my boring careful notes here on exactly what I did.
Backing up old host
First thing is to back up everything on the old host disk while the old host is still working. I stopped all the guests and did a full backup of every single one. This is the precious data, what I’ll be restoring.
Second is to back up /etc and /var/lib/pve-cluster/. Note that /etc/pve is special and backed by a live-mounted database in pve-cluster. I’m backing up the stuff in /etc/pve as if they were normal files (for future diffing) and taking a backup of the database with sqlite3 config.db ".backup 'config.db.backup'.
After shutdown I’m going to unplug the old host disk for safekeeping, if things go badly I can use it to restore. Note it’s awkward to read the files on it because after you install a new Proxmox you end up with two ZFS pools named rpool that both want to mount to /. zpool import -d -R should help with that but I found it tricky. Instead I’ve backed up the files I want to read to the backup disk.
Installing new Proxmox PVE server
Do the regular Proxmox install from USB. There’s very few options there, I love how simple the Proxmox installer is. But this is what I did:
- ZFS RAID0 as the filesystem, with the one internal SSD
- United States, UTC timezone, US English keyboard
- Password and email as nelson@monkey.org even if I never have set up outgoing mail
- Hostname gvpve. Verify IP address is correct (thank you DHCP).
Improving Proxmox install
These are my generic customizations to any new Proxmox install
- Add my ssh key to
~root/.ssh/authorized_keys. Don’t disturb the key for root PVE made! - Run the tteck helper script “Proxmox VE Post Install” and accept all defaults. This does a few things to make a new install nicer.
- enable no-subscription repositories
- disable the nag message
- disable the high availability services (pve-ha-lrm, pve-ha-crm, corosync)
- software update to Proxmox (takes a few minutes)
- Reboot
- Install some useful software.
apt install joe sudo avahi-daemon - Install tailscale. Start with
tailscale up --accept-dns=false. Disable key expiry in Tailscale console.
Restoring my guests
Proxmox can do all this automatically if you have a cluster, this task just becomes a migration. (Automatic, if you have HA configured.) But it’s nice to do it manually as a recovery exercise.
- Plug in the USB disks for backups and USB media and verify with
lsblk - Restore
/etc/fstabmounts for these disks (look at backup file from old server). - Mount
/mnt/backupand/mnt/usb-media - Under Datacenter > Storage, add my Proxmox backup volume
id: backup, type: Directory, Content: VZDump backup file, Path: /mnt/backup - Remove “backup” as a content for the storage named “local”
- Under Datacenter > PVE > Backup, locate the files for the backups I took just before shutting down old host
- Restore each one manually (a lot of clicking!). Re-type the guest IDs instead of taking newly assigned ones. Probably unnecessary.
- Reboot to start all the relevant guests.
The restores all went pretty well, Proxmox backs up the configuration of the guest as well as the guest’s disk images. For some reason the config for a TrueNAS VM changed, it added back the ISO for the install media. This could actually break the guest although it’s easy to fix. The vmgenid also changed on every VM.
Finishing up
- Add my Influx DB as a system metrics server
- Create a new backup job on Proxmox
All guests, 9am, keep 6 monthly / 4 weekly / 7 daily - Test a manual backup. MISTAKE. The daily retention policy means this manual backup erased the reference backup from earlier today. I’d already used those to restore all my systems, so it’s probably no big deal, but definitely not the right thing to do.
I tried diffing the old server’s /etc/pve (on backup disk) to the new one. Didn’t learn anything really. Lots of differences but most of them are what you’d expect, new security keys. Also missing config files because I looked before I restored the guest hosts. I did spot the config change for the TrueNAS VM though, still puzzled by that.