Categories
SysOps

How to export every LXD instance at once

Export every LXD instance at once.

List LXD instances using script-friendly format.

$ lxc list --columns n --format csv
bitwarden-hydra
kube-master
gitlab
mariadb-kraken
swarm-master
wordpress-kraken

Read these items from the standard input to execute export operation using xargs utility.

$ lxc list -columns n --format csv | xargs -I {} lxc export {} /tank/backup/kraken/{}.tgz
Backup exported successfully!
...

Done.