0

I'm about to re-configure my home server from scratch and am wondering what would be the best strategy to backup my LXD containers. Meanwhile I am running Ubuntu 20.04 LTS and have some services configured to run as LXD/LXC containers. For example:

  • container "cloudserv" running seafile
  • container "webservice" running nginx and MariaDB

These two containers are located on my SSD with btrfs filesystem. For data storage I am using an array of disks (also with BTRFS), where I have created another LXC storage pool with a storage volume which is the attached to the seafile container to hold all the data. The layout is something like this:

SSD

  • BTRFS Filsystem
    • Storage Pool "Default"
      • container "cloudserv"
      • container "webservice"
      • images

HDDs

  • BTRFS Filesystem
    • Storage Pool "DataPool1"
      • custom storage volume "seafile-data" --> attached to container "cloudserv"

By using BTRFS I was hoping to be able to make use of BTRFS snapshots and send and receive tools to easily transfer containers and storage volumes as subvolumes e.g. to a RasPi with a BTRFS volume attached. But reading e.g. LXD Manual or How to backup and restore LXD containers I have the impression that I always have to create a tarball to backup an instance which can then be transferred. This would imply that I actually loose some of BTRFS attractive features like being able to send/receive the subvolumes/snapshots and doing incremental backups of my LXC instances and data.

Do I miss anything? Can anybody give some hints for appropriate backup workflow for LXD/LXC with BTRFS?

0

If you install LXD in your remote server and both servers use Btrfs, you can use the Optimized instance transfer like this:

lxc remote add mybtrfsremotebackupserver XXX
lxc snapshot mycontainer snap1
lxc copy mycontainer mybtrfsremotebackupserver: --verbose

And it will use btrf-send for the initial transfer of the container and all its snapshots.

Then you have a very convenient way of maintaining then container and it's snapshots only sending incremental changes using the option --refresh (LXD 3.7)

lxc copy --refresh mycontainer mybtrfsremotebackupserver: --verbose

But unfortunately it uses rsync, at least in LXD 4.0, so you will lose the btrfs-send optimization.

Check this issue for more info: Feature request: --snapshots-only flag for copy

Also, there is "Refresh support for custom volume copies" but I'm not sure if it uses the optimized path or if it could be useful for your objective. You can also check --optimized-storage in the lxc export

Regards

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.