monotux.tech

Move Incus containers between storage pools

incus zfs

I accidentally used the wrong ZFS storage pool when setting up Incus at home, so all of my containers and volumes were created on my small boot pool, instead of my large nvme pool. I didn’t discover this until I ran out of disk space, and in the recovery process I got reminded that Incus is a really nice piece of software :-)

To recover from this situation I started to research how to migrate to a new ZFS pool, and expected it to be a lot of work – but it was actually very straight forward!

# First, create a new ZFS dataset for Incus
zfs create foobar/incus

# Create a new incus storage pool named nvme, and point it to the new dataset
incus storage create nvme zfs source=foobar/incus

# Migrate container foo
incus stop foo
incus move foo -s nvme

# If you have any additional volumes, move them as well
incus storage volume move default/volume_foo_data nvme/volume_foo_data

# Start container again
incus start foo

The only thing that confused me was the syntax for the storage volume move command. My bash completion wanted source and destination to contain the volume type (custom), while the command didn’t expect that and couldn’t find the any volumes to move.

One nice detail with this is that zfs send / zfs receive was used for the migration, no slow rsync or similar.

If you don’t use ZFS and want to move volumes within the same machine, disable rsync (as documented in this thread) to speed things up a bit:

incus storage set my-dir-pool rsync.compression false