Should container be shut down before backing up?

I’m trying to devise a suitable backup strategy for my array of LXC containers which I manage with LXD.

LXD provides a backup function but I can’t find any information on whether this is safe to use whilst the container is up. I’d like to use this function to take regular backups of my containers but having to schedule shutdowns of busy containers in order to back them up presents significant problems.

Guidance would be appreciated.

It mostly depends on the storage backend used. If on zfs or btrfs, CoW can be used with temporary snapshots making this pretty painless (make sure to use --optimized-storage though). For others, the container will be temporarily frozen during such operations so may cause visible downtime.

Thanks Stephane, interesting stuff.

How about the lxc export function? Would this be safe to use whilst the container is running? (It’s what my LXD frontend is using for its ‘backup’ feature).

That’s what I was referring to, depends on the backend used and depends if the backup is created as optimized storage or not.