digint / btrbk

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

Archive aborts when some target snapshots already exist #211

Open HaleTom opened 6 years ago

HaleTom commented 6 years ago

Archive bails out when some of the backups already exist in the target location.

I want to use archive to copy newly created backups from my backup disk to another location. Assume I've previously run btrbk archive already, and then want to update the existing archive target with new backups that have been created.

I see:


$ sudo btrbk archive -vn /media/backup/ /media/backup-alt/
btrbk command line client, version 0.26.0  (Sun Feb 18 16:37:08 2018)
Using configuration: /etc/btrbk/btrbk.conf
Archiving subvolumes: /media/backup/btrbk/home/home.*
ERROR: Target subvolume "/media/backup-alt/btrbk/home/home.20180213T0800" already exists, aborting send/receive of: /media/backup/btrbk/home/home.20180213T0800
ERROR: Please delete stray subvolume ("btrbk clean"): /media/backup-alt/btrbk/home/home.20180213T0800
ERROR: Error while cloning, aborting
Archived 0/1 subvolumes
WARNING: Skipping archiving of "/media/backup/btrbk/home/": At least one target aborted earlier
Completed within: 0s  (Sun Feb 18 16:37:08 2018)
--------------------------------------------------------------------------------
Archive Summary (btrbk command line client, version 0.26.0)

    Date:   Sun Feb 18 16:37:08 2018
    Dryrun: YES

Legend:
    ++.  created directory
    ---  deleted subvolume
    ***  received subvolume (non-incremental)
    >>>  received subvolume (incremental)
--------------------------------------------------------------------------------
/media/backup/btrbk/home/home.*
!!! Target "/media/backup-alt/btrbk/home" aborted: Target subvolume "/media/backup-alt/btrbk/home/home.20180213T0800" already exists

/media/backup/btrbk/home-var/home-var.*
!!! Target "/media/backup-alt/btrbk/home-var" aborted: At least one target aborted earlier

/media/backup/btrbk/rootfs/rootfs.*
!!! Target "/media/backup-alt/btrbk/rootfs" aborted: At least one target aborted earlier

NOTE: Some errors occurred, which may result in missing backups!
Please check warning and error messages above.
Please delete stray subvolume ("btrbk clean"): /media/backup-alt/btrbk/home/home.20180213T0800

NOTE: Dryrun was active, none of the operations above were actually executed!
$
digint commented 6 years ago

It looks like /media/backup-alt/btrbk/home/home.20180213T0800 is an incomplete backup (not readonly). If it is not, this is probably a bug.

Note that "btrbk archive" is very restrictive and aborts all subsequent transfers after a send/receive error. The reason for this is when the target disk is full, we don't want to hammer on it just to find out "it's still full". There should probably be a config option to change this behavior. As a workaround, you could comment out the lines 4647 and 4648, and btrbk should go on with the rest of the backups

        macro_archive_target($sroot, $droot, $snapshot_name, { results => $schedule_results });
        if(ABORTED($droot)) {
          # also abort $sroot
#          $aborted = "At least one target aborted earlier";
#          ABORTED($sroot, $aborted);
          WARN "Skipping archiving of \"$sroot->{PRINT}/\": $abrt";
          last;
        }

PS: I'm on vacation next week, don't expect fast answers :)

ghost commented 6 years ago

Incremental archiving works fine on my part, so I can not confirm a problem in general. However, it seems that if an uncomplete snapshot is to be archived (e.g. because of another concurrently running btrbk instance), btrbk archive will fail and abort subsequent transfers.