Best way to migrate IncusOS from a server to another?

Hi

I have an on premise server running IncuOS, I want to replace it with a more beefy hardware but I have no idea how to handle the migration efficiently.

I never used the cluster feature, but I have a hunch that I could create a cluster with the two instances, migrate everything and delete the cluster?

any tips? :slight_smile:

1 Like

There is no need to create a cluster. You can do incus copy also between Incus remotes that do not belong to the same cluster. Just make sure that you create the networks, storage pools, and profiles with the same names that are used by instances. For profiles, you could also do incus profile copy.

2 Likes

I just tried, and it does not seem to copy all volumes that are associated with an instance. I need to copy all volumes in addition to the instances, but incus copy works well to copy instances :slight_smile:

I have snapshots with the volumes, I think I’ll need to script incus copy and incus storage volume copy :+1:

You’ll want to look into dependent volumes, those do get included as part of a copy.

1 Like

I succeeded, but it wasn’t an easy operation.

Here is a little summary in case this help someone later. My Incus OS server is using tailscale, a physical network interface used by containers, containers have 3 extra storage attached to each container¹ and it’s deployed almost entirely with terraform.

1: this is because they are destroyed and recreated on image change, and all persistancy is managed in a dedicated volume, there is a volume for secrets too and a volume for cache like containers or container’s package manager cache, this helps booting faster when recreating the container

I had to reinstall Incus OS twice, I got locked out a first time and I couldn’t figure why as the instance was answering ping requests but wasn’t exposing any server on port 8443 :woman_shrugging: second time, I got an issue where a container was reporting “Invalid PID -1” which was totally blocking any operation and I had to reinstall after trying to debug it for 2 hours, I have a feeling this was related to a proxy binding on host on the tailscale subnet while tailscale was not properly configured.

The process have been:

  • duplicate the terraform directory and change the tfstate destination
  • enroll incus os in tailscale
  • fix the physical interface and IP addresses in terraform code to match the new ip (both on LAN and tailscale)
  • terraform apply
  • delete all containers and all volumes that were created
  • stop all containers on the “old” incus os
  • from an incus client, loop over all volumes to transfer (all my extra volumes have a _ in their name, this made it easy to figure them)
for i in $(incus storage volume list old:local -c n -f csv,noheader | grep _ )
do
  echo $i
  incus storage volume delete new:local custom/$i
  incus storage volume copy --refresh old:local/$i new:local/$i
done
  • run terraform apply to recreate the containers
  • it worked :tada:
1 Like