[SOLVED] How to migrate container including root disk to new node (non cluster)

Nov 14, 2022
8
3
8
Hi,

I have a ProxMox node running 7.4-20 on bare metal which has a container whose Root Disk image is on a local Directory type volume. I recently bought a new server and installed ProxMox 8.4.1 on that (also on bare metal) and would like to migrate my container to that including putting the Root Disk on that server's local ZFS volume. I tried doing it by backing up the existing container onto my NAS and restoring it on the new server, but the backup only appears to back up the container itself and not the root disk file. When I restore the backup to my new server, it creates what appears to be a new Root Disk file.

The container is running Grafana which uses the Root Disk image to store SNMP data from my network devices. Since the migration of the container backup doesn't appear to also incorporate the Root Disk, when I spin it up on the new server, there is no SNMP data to be graphed.

One thing I tried was to use "Move Storage" to move the Root Disk of the existing container to the NAS, then modify the migrated container's .conf file to point to that image for the Root Disk (the NAS directory is mounted on both servers), but starting the container just caused the status to keep spinning indefinitely. I waited for a while for a timeout but got impatient and rebooted the server.

How can I copy a container including its Root Disk from one server to another? They're not in a cluster. I intend to replace the old server with the new one.
 
Well... after fooling around a little more, it's working. Here's what I did, though I'm not sure that's what actually fixed it:

When I first did my backup of the container, its Root Disk was still on the local Directory volume. I tried it again by first moving the existing container's Root Disk to the NAS volume and then doing the backup. Then I restored that backup to the new server. When I did that, the new server again created what seems like a new Root Disk on its local ZFS volume. It wasn't pointing to the Root Disk on the NAS like the other server now was. I went back into the .conf file for the container and re-pointed the Root Disk to the NAS file, then used the GUI to Move Volume to the ZFS. It created a 2nd Root Disk volume named the same as the first one which didn't match the name of the one on the NAS or on the old server. I launched it anyway and got discouraged because I again just saw spinning wheels where there was supposed to be graphed data. This time I decided to keep waiting just to see what would happen, and after a while, my data showed up.

I don't know if doing all of that is what fixed it or if I just don't understand how containers and their Root Disks are backed up and restored. Now I'm wondering if that ~2GB backup file did, in fact, include my Root Disk even though the latter shows up as a 256GB file on my old server. Guessing it just didn't include any of the zero data. This makes me think I didn't even need to move the images around - that the backup and restore were all I needed to do, followed by more patience to let the data load. Weird, since it loads almost immediately on the old server.

Anyway, it's working. Hopefully this will be useful to someone else who runs into this.
 
Annnnd some final notes. Some good lessons learned here.

After I got the container with Grafana working on the new machine, I stopped the container running it on the old server. Some time later, I went back to look at the dashboard on the new machine, and it was no longer working. A lightbulb then went on over my head.

My new server and its VMs/CTs are on a different subnet than my old one. When I move the container to the new machine, little did I know, the Grafana config was still pointing to the IP of the InfluxDB (the database Grafana uses for the SNMP data) running on the old container. It didn't dawn on me that Grafana wasn't using localhost for the DB connection. When I realized killing the old container was killing the graphing data, I found the pointer in the Grafana config and changed the IP to the same one as the new container.

I also totally deleted the container on the new box and simply restored it from the backup without doing all the Root Disk hocus pocus I was messing with as mentioned above. It all worked fine after just changing that IP in Grafana's InfluxDB setting (and thus proved that the Root Disk did, in fact, get included with the backup in spite of it resulting in such a small file). So I made a mountain out of a molehill.

Figured I'd leave this thread up with all my mistakes in it in case anyone ever finds my "learn the hard way" experience useful.

Problem solved.
 
  • Like
Reactions: UdoB