Backup : copy with the same name

I want to make a backup script running every night, my idea is :

  • make a snapshot (very fast with ZFS): lxc snapshot php70 bck-daily --reuse
  • copy this snapshot on a remote server though LXD API with copy command, overriding container name on remote: lxc copy local:php70/bck-daily xxx:bck-php70

Is there a better way ?

I have one problem with this solution I can’t copy container with the same name on remote:

Error: Failed instance creation: Failed creating instance record: Add instance info to the database: This "instances" entry already exists

Is there a solution ?
There is no --force or --reuse flag on copy command :confused:

Subsidiary question, is it possible to make incremental copy to accelerate backup ?

Thanks

There is a --refresh flag you can use for this.

Where possible LXD will use either rsync or optimized storage driver transfer methods.

I tried but I’ve got:

Error: --refresh can only be used with instances

You mean like send/receive in ZFS for example?

What storage pool type are you using? If you copy the main instance with --refresh it will automatically create a temporary snapshot if needed, and will copy any other manually created snapshots (if not using --instance-only).

Yes

Works perfectly fine, great, thanks a lot

1 Like