digint / btrbk

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

Hourly Snapshots + Weekly Backup #449

Closed Wunderharke closed 2 years ago

Wunderharke commented 2 years ago

First: Great tool, it simplifies the backup workflow immensely!

My setup: I have a server on which I would like to keep snapshots of the past few hours as a kind of time machine, as well as some snapshots in larger time intervals. In addition, I have a backup server on which weekly backups should be stored externally. The external backup server is located at my home and should therefore rarely have to be activated from sleep mode.

Unfortunately, with my current configuration there is no cleanup of the snapshots done if the backup server is not available. Is there a possibility to activate the backup server only for the weekly backup? Maybe by activating the backup from the backup server? How do I select the most recent snapshot in this case?

My config:

timestamp_format long
ssh_identity /etc/btrbk/ssh/id_ed25519
preserve_hour_of_day 1
lockfile /run/btrbk.lock

volume /data

  snapshot_preserve_min latest
  snapshot_preserve 2h 2d 2w

  target_preserve_min no
  target_preserve 4w *m

  subvolume XXX/*
    snapshot_dir snapshot_data/XXX
    target ssh://fileserver/mnt/backups/XXX
  subvolume XXX/YYY/*
    snapshot_dir snapshot_data/XXX/YYY
    target ssh://fileserver/mnt/backups/XXX/YYY/
  subvolume ZZZ
    snapshot_dir snapshot_data
    target ssh://fileserver/mnt/backups
  subvolume VVV
    snapshot_dir snapshot_data
    target ssh://fileserver/mnt/backups
digint commented 2 years ago

Is there a possibility to activate the backup server only for the weekly backup?

You can either run btrbk snapshot instead of btrbk run, or you can set noauto option to the targets you want to skip, and then run btrbk run ssh://fileserver/mnt/backups to explicitely run the targets.

Maybe by activating the backup from the backup server?

This would probably be the best solution. Configure btrbk from the backup server, where you can set distinct preserve rules for your snapshots

Sorry for the late reply, was very busy lately...

Wunderharke commented 2 years ago

Sorry for my late reply as well. I now initiate the backups from the file server and have no problems.