digint / btrbk

Tool for creating snapshots and remote backups of btrfs subvolumes
https://digint.ch/btrbk/
GNU General Public License v3.0
1.69k stars 122 forks source link

More complex example with multiple subvolumes in multiple directories in howto. #228

Open vvolas opened 6 years ago

vvolas commented 6 years ago

For example LXD backups when there is many existing snapshots in many different directories.

Would "archive" mode work somehow? or when selecting which subvolumes to back up I should use "*" symbol?

I know that this may not be real issue, but there is no forum and this would help people who want just to make simple backup of something like LXD.

I shortened list of my LXD subvolumes.

`ID 285 gen 858878 top level 284 path storage-pools/default ID 286 gen 858878 top level 285 path storage-pools/default/containers ID 287 gen 858880 top level 285 path storage-pools/default/snapshots ID 288 gen 856228 top level 285 path storage-pools/default/images ID 289 gen 430742 top level 285 path storage-pools/default/custom ID 303 gen 861958 top level 286 path storage-pools/default/containers/wiki ID 321 gen 861965 top level 286 path storage-pools/default/containers/gitlab ID 324 gen 861965 top level 286 path storage-pools/default/containers/proxy ID 334 gen 286130 top level 287 path storage-pools/default/snapshots/XXX/first_btrfs ID 922 gen 624544 top level 288 path storage-pools/default/images/XXX

`

digint commented 6 years ago

I would suggest using wildcards "*", that's exactly why they exist, something like this should work:

volume /storage-pools
  subvolume default/containers/*
    snapshot_dir btrbk_snap/containers
  subvolume default/images/*
    snapshot_dir btrbk_snap/images

Now I'm not sure how LXD stores the subvolumes: if these are all read-write (check with btrfs subvolume show) it should work as expected. Probably the ones in "default/snapshots" are read-only and as such can not be backed up with btrbk.

Note that wildcard support is somehow limited, see #127.

If you get this working, I would gladly add some lines about this in the howto.

vvolas commented 6 years ago

Thanks for quick reply.

It works, but I don’t know if it is correct solution since from my understanding LXD makes multiple containers from single core image from images directory. And in my case images were created later. I don’t know how BTRFS works and if it makes backups less storage efficient because "core" image wasn’t present when all containers were transferred and how to transfer hierarchy correctly and so on. Since I just wanted to have backup(better than don’t have) it suits me for now.

I didn’t backup snapshots because they didint have any meaning to me and were used as "backups" to begin with.