digint / digint/btrbk

btrbk prune doesn't work if two targets are configure

Open
#561 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
2.1k
Forks
139
PR merge metrics
No merged PRs in 30d

Description

btrbk prune doesn't work as intended if two targets are configured and the preserve settings are changed after adding the second target.

````
$ btrbk --version
btrbk command line client, version 0.32.6
````

I configured an additional volume (data) and I forgot to add preserve settings:
````
volume /mnt/btrfs
subvolume @
group system
snapshot_name root
target /run/media/username/backup/btrbk-system/myhost
target_preserve_min 7d
target_preserve 168h 14d
...
subvolume @home
group data
snapshot_name home
target /run/media/username/backup/btrbk-system/myhost
target_preserve_min 14d
target_preserve 504h 30d 12w 6m 3y

volume /mnt/btrfs-data
subvolume @
group data
snapshot_name data
target /run/media/username/backup/btrbk-data/myhost
````

I backup all my snapshots on a local USB disk.

I had this config for over a year and many many snapshots were stored on the target without getting deleted. I guess because the default config is `target_preserve_min all`.

Some days ago I added a remote target because I want to switch to remote backup, but I want to see first if the backup via WAN is reliable:

````
volume /mnt/btrfs-data
subvolume @
group data
snapshot_name data
target /run/media/username/backup/btrbk-data/myhost
target ssh://myremotehost.com:1234/mnt/backup-data/myhost
````

Today I got an issue with the btrfs filesystem on my USB disk. I couldn't receive subvolumes anymore because the filesystem is full. I found out that I had hundreds of subvolumes.

Then I added the preserve options to my config:

````
volume /mnt/btrfs-data
subvolume @
group data
snapshot_name data
target /run/media/username/backup/btrbk-data/myhost
target ssh://myremotehost.com:1234/mnt/backup-data/myhost
target_preserve_min 14d
target_preserve 504h 30d 12w 6m 3y
````

However, the subvolumes don't get deleted:

````
$ sudo -u btrbk btrbk prune data
--------------------------------------------------------------------------------
Backup Summary (btrbk command line client, version 0.32.6)

Date: Wed Sep 27 22:30:19 2023
Config: /etc/btrbk/btrbk.conf
Filter: data

Options:
prune: No snapshots created
prune: No backups created

Legend:
=== up-to-date subvolume (source snapshot)
+++ created subvolume (source snapshot)
--- deleted subvolume
*** received subvolume (non-incremental)
>>> received subvolume (incremental)
--------------------------------------------------------------------------------
/mnt/btrfs/@home

/mnt/btrfs-data/@

````

I could fix the issue by removing the remote target temporarily, but It should automatically prune the subvolumes of the first target without removing the second target.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.