What is the best way to back up (and restore) an Incus Instance?

After playing on Fangtooth for a bit, I accidentally overwrote the root of my main data pool by mis-clicking a replication target. All of my data from the pool is backed up on an external drive, so I didn’t lose anything other than time, and some hair.

The one thing I couldn’t see on my external drive was where the Incus VMs store their data - either it’s not under my main pool, or it’s hidden in some fashion where I can’t see it on the external drive.

While I was extra cautious and had all the data in my VM backed up into a share on the TrueNAS, which was then backed up externally, it’s going to be a pain to rebuild the VM (again, after the FT migration) and then restore the data (again).

Is there a way to ensure my VMs are backed up under Incus / Fangtooth, and how can I restore them?

I don’t believe there is a way at the moment - one of the reason things are marked as experimental

1 Like

At your own risk (i.e. experimental …), you can create backups using native incus backup.

incus export <instance_name> [<file_path>]

Example: Backup & restore to create a clone

incus export mycontainer /mypool/dir1/backup.tgz --instance-only 
incus import /mypool/dir1/backup.tgz mynewcontainer

Under current 25.04.0, these two commands will create a self-contained backup of the instance and restore to a new (cloned) instance “mynewcontainer”. The latter shows up in the GUI and can be launched.

There be dragons ahead.

This isn’t wholly correct.
From their documentation

Custom storage volumes might be attached to an instance, but they are not part of the instance. Therefore, the content of a custom storage volume is not stored when you back up your instance. You must back up the data of your storage volume separately. See How to back up custom storage volumes for instructions.

For VMs which were migrated from Electric Eel especially (the ZVOL is imported as a second drive, not the “root” incus drive), you would need to also backup the Volume.

1 Like

This is being worked on as part of NAS-135034

1 Like

For my purposes a simple “incus export …” seems to work well. This in a script that cycles the last 5 exported files around and a cron job that runs every few days would allow me to have a suitable backup.

Actually snapshots would suffice for the older backups

I am just looking at running a single instance with portainer (I do not want to use the IX Portainer docker container as it contains what I consider to be contaminated data). [To clarify, it contains docker data from the installed ix-apps not controlled by portainer and thus confuses things]

Yes I am running some IX Apps and rather more containers under portainer in a Jail. With incus I may end up running eveything under portainer in a instance, but thats way in the future