Hi,
I am trying to figure out how to properly backup my LXD containers with a ZFS backend.
Should I use snapshots or do I have to use images ? How can I create new containers from a file containing a snapshot ?
Here is what I gathered for the two approaches:
Using snapshots
I feels natural to want to use the ZFS snapshots, but how would I to restore them in LXD ?
lxc snapshot my-container my-backup
lxc config show my-container > my-container_my-backup.lxd.config
zfs send zfspool/containers/my-container@snapshot-my-backup > my-container_my-backup.lxd.zfs
Restore:
- Create the container from the config somehow ?
zfs receive zfspool/containers/my-container2@my-backup < my-container_my-backup.lxd.zfs
lxc restore my-container2 my-backup
Using images
Or should I generate images and export them ? It feels a bit weird to generate images when all I want is to create a backup - I want to restore it in the future, not create new āinstancesā of it.
lxc publish my-container --alias my-backup-image
lxc image export my-backup-image .
Restore:
lxc launch my-image my-container2
Thanks enlightening me on this !