Lxc storage volume move?


When moving a CT with “lxc move”, I also need to move the (zfs) storage volume attached.
How can I do that ?

The container’s zfs volume itself will be moved by LXD through zfs send/receive.

But I’m assuming you’re talking about a custom volume which got created through “lxc storage volume create”?

If so, there’s no good answer to that yet. It’s on our roadmap to allow:

  • Renaming custom volumes (was implemented last week)
  • Copy custom volumes both within the same pool and between local pools
  • Move custom volumes locally between pools
  • Implement the same copy/move feature but between LXD hosts

For now, you’ll have to do it by hand, which would involve:

  • Stop the container
  • Move the container
  • Create a storage volume with the same name on the target
  • zfs destroy that new storage volume
  • zfs send/receive the existing one by hand
  • Start the container and check that everything looks good
  • Destroy the source storage volume with “lxc storage volume delete”

Yes I was talking abut a custom volume created with “lxc storage volume create”.

Ok, thank you for this fast answer.

@brauner can you make sure we have one or more Github issues tracking all of this?

After moving the CT and the custom storage volume, I’ve a problem with the UID mapping.
When I start the CT, the unix ID are increased by 1 000 000 .

Are both your hosts using the same uid/gid map in /etc/subuid and /etc/subgid?

If not, that’ll definitely be a problem.

Tracking this on github now.

Hello, I can’t find informations about this, is it still not possible to automatically move a CT with its attached storage volume ?
I saw a --storage flag on lxc move but not sure what it does, I can not find documentation on this.

Both containers and storage volumes can be moved, there’s no option to have them move together as a storage volume may be used by multiple containers.

So it’s preferred that you do:

  • Stop container
  • Move custom storage volumes
  • Move container

Depending on the storage setup of the target, you may also need to update the container config on target to adapt to whatever the new storage pool names may be.

Oh, ok cool.
I don’t understand how to move custom storage volume to an other host.

lxc storage volume move [/] [/] [flags]

There is no remote IP option like we have for lxc move:

lxc move [:] [:][] [–container-only]

lxc storage volume move default/NAME some-remote:default/NAME

Assuming it’s the default pool on both side.