enzingerm / snapborg

Synchronize snapper snapshots to a borg repository
GNU General Public License v3.0
31 stars 5 forks source link

Snapborg doesn't restore cleanup policy if interrupted #25

Open fat0troll opened 1 year ago

fat0troll commented 1 year ago

If (for whatever reason) snapborg backup process is terminated unsuccessfully (for example, system rebooted while snapborg-backup.service was in progress), snapborg doesn't restore cleanup policy for snapper snapshots, even after successfully backing them up in next run.

This results in «hanging» snapshots, that will be never deleted automatically, and they will eventuall eat up space if user doesn't perform any action.

Example of this behavior:

    # | Type   | Pre # | Date                            | User | Cleanup  | Description                                                              | Userdata            
------+--------+-------+---------------------------------+------+----------+--------------------------------------------------------------------------+---------------------
   0  | single |       |                                 | root |          | current                                                                  |                     
   4  | single |       | Fri 10 Mar 2023 12:00:01 AM +04 | root | timeline | timeline                                                                 | snapborg_backup=true
 557  | single |       | Sat 01 Apr 2023 12:00:18 AM +04 | root | timeline | timeline                                                                 |                     
1156  | pre    |       | Mon 24 Apr 2023 05:45:14 AM +04 | root | number   | pacman -S --config /etc/pacman.conf -- extra/system-config-printer extra |                     
1157  | post   |  1156 | Mon 24 Apr 2023 05:45:16 AM +04 | root |          | power-profiles-daemon python-pycups python-pycurl system-config-printer  |                     
1207  | pre    |       | Mon 24 Apr 2023 11:20:02 AM +04 | root | number   | pacman -U --config /etc/pacman.conf -- /home/hdkv/.cache/yay/hardcode-tr | snapborg_backup=true
1208  | post   |  1207 | Mon 24 Apr 2023 11:20:02 AM +04 | root |          | hardcode-tray                                                            |                     
1342  | single |       | Wed 26 Apr 2023 12:00:05 AM +04 | root | timeline | timeline                                                                 | snapborg_backup=true
1385  | single |       | Wed 26 Apr 2023 03:00:00 PM +04 | root |          | timeline                                                                 | snapborg_backup=true
1386  | single |       | Wed 26 Apr 2023 03:10:33 PM +04 | root |          | boot                                                                     | snapborg_backup=true
1400  | single |       | Thu 27 Apr 2023 12:00:01 AM +04 | root | timeline | timeline                                                                 | snapborg_backup=true
1432  | single |       | Fri 28 Apr 2023 12:00:01 AM +04 | root | timeline | timeline                                                                 | snapborg_backup=true
enzingerm commented 6 months ago

Sorry for the late reaction. I'll investigate the cause of this behaviour.