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

How to make a btrbk instance wait for multiple btrbk instances' exit statuses? #455

Closed ceremcem closed 2 years ago

ceremcem commented 2 years ago

My use case:

I'm using an internal_backup_disk and an external_backup_disk for my rootfs_backups.

Internal backup process can be run in parallel to the external backup process, so I can't use the same lock file for both of them.

However, my rootfs_backups may interfere with both of the internal and external process because rootfs_backups does rotate the old snapshots. Any of the (in|ex)ternal disks might just rename the "THE_OLD_TIMESTAMP.A_SUFFIX_TO_PREVENT_DELETION" snapshots to THE_OLD_TIMESTAMP and start synchronization. In the meanwhile, rootfs_backups process might delete the snapshots which has THE_OLD_TIMESTAMP because they have the old timestamp. But we need the old snapshots till the end of the (in|ex)ternal backup processes.

So, rootfs_backups must wait for any of the (in|ex)ternal backup process but internal backup process shouldn't wait for the external backup process, so, I can't use the same lock file for all of them.

How can I make such a configuration?

digint commented 2 years ago

Not sure if I fully understand your problem, but have you tried separating snapshot creation (btrbk snapshot, which can be done without lockfile, as those operations are atomic), and snapshot deletion (btrbk prune, where you might want to wait for the lock).

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

ceremcem commented 2 years ago

Yes, I also think that I told the story in a very complicated way.

My workaround: I just used the same lock file for the internal backup process and external backup process. There is no problem in practice.

Regarding to being late: It's okay, this is a non-profit project. It happens.