digint / btrbk

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

2 stage backup #509

Open cdpb opened 1 year ago

cdpb commented 1 year ago

Hello,

thanks for your great work!

I have a laptop doing backups locally from /btrfs-root/{@,@home,@boot-sync} to /btrfs-root/backup.

backend               btrfs-progs-sudo
snapshot_create       onchange
snapshot_preserve     7d 2w 3m
snapshot_preserve_min 24h
target_preserve       48h 14d 4w 6m 1y
target_preserve_min   latest

volume /btrfs-root
  subvolume @home
    group local home
    snapshot_dir backup/@home
    snapshot_name home

  subolume x
     [same as @home]

Now I want to setup a external HDD to just copy /btrfs-root/backup/* to the HDD, without further snapshotting etc.

the hdd part looks like this:

volume /btrfs-root
    snapshot_create no
    snapshot_preserve_min   all
    target_preserve_min     7d
    target_preserve         7d 4w 6m
    noauto yes

  subvolume backup/*
    group ext
    target /run/media/m8/TOSHIBA/btrfs-backup

all I get is <no_action> for all subvolumes. Running with -v I get

Expanding wildcards: /btrfs-root/backup/*
Found source subvolume: /btrfs-root/backup/@
Found source subvolume: /btrfs-root/backup/@home
Found source subvolume: /btrfs-root/backup/boot
Found source subvolume: /btrfs-root/backup/boot-sync
Checking for missing backups of subvolume "/btrfs-root/backup/@" in "/run/media/m8/TOSHIBA/btrfs-backup/"
No missing backups found
...

then I tried to use the target directly with the subvolume, like so:

  subvolume @
    group local root
    snapshot_dir backup/@
    snapshot_name root
    target send-receive /run/media/m8/TOSHIBA/btrfs-backup

that works nicely! It creates a snapshot, as per config and would start with the oldest snapshot as a non-incremental and than add all the incrementals.

BUT if the HDD is not connected, it doesn't snapshot internally too, with I don't like.

I prefer to have a seperate volume config with noauto yes, to only run it, whenever the HDD is connected. I would implement a systemd mount hook or something similar, to just run the explicit group for the external HDD.

Am I missing something? Does btrbk support that?

A workaround would be to duplicate the config, one for internal backups only and another one with the same config but additionally the target - but that seems a bit hacky.

Propably related to #477