Feature lxc copy --snapshots-only?

For lxc copy there’s a option --container-only.

It would be nice to have a --snapshots-only too. That would probably also prevent the freezing of a container for a long time when the storage used is massive.

I’m not sure if it’s possible at al.

1 Like

I don’t understand why this should make sense. Also, snapshots are tied to containers so --snapshots-only doesn’t make much sense.

If you want to copy snapshots, you can use lxc copy c1/snap0 c2. Does this help?

I’ve tried to use lxc copy --refresh to create a backup of the container on a remote server. Apart from having troubles with hanging rsync, I also noticed that the container freezes for some time during this copy. If the underlying filesystem is large, this may take quite some time.

So,

  • I’m interested in a remote backup of the container, which may be only the last snapshot.
  • I’d like to have no downtime (i.e. no freezing of container).

Okay, so a --snapshots-only flag which would only be meaningful with --refresh when the target already exists.
As @monstermunchkin mentioned, we can’t copy stuff if no container exists on the target so that’d only work when a target already exists.

I’m not opposed to this, though it may be a bit tricky to do properly in the migration protocol.

Anyway, feel free to file an issue at https://github.com/lxc/lxd/issues and we’ll triage it.

So, is this possible already to copy a snapshot to another container in the same host with this command or similar?

You can create a new instance from a snapshot of another instance, e.g.

lxc copy c1/snap0 c2

But you cannot copy a snapshot from one instance as a snapshot of another instance.

1 Like