digint / btrbk

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

Clarification on snapshot_create ondemand for unplugged disks #335

Open fredtj opened 4 years ago

fredtj commented 4 years ago

hello, I'm having some trouble setting this up to take snapshots locally with a copy to USB disk that may or may not be connected, as per your example on the readme page, config:

snapshot_preserve_min   2d
snapshot_preserve      14d

target_preserve_min    no
target_preserve        20d 10w *m

snapshot_dir           @snapshots
snapshot_create        ondemand

volume /mnt/btr_pool
  target /mnt/backup/@backups
  subvolume @
  subvolume @home

when USB disk is detached, /mnt/backup exists, but @backups (a subvolume) does not. btrbk complains however:

WARNING: Skipping target "/mnt/backup/@backups": Failed to fetch subvolume detail
WARNING: ... Command execution failed (exitcode=1)
WARNING: ... sh: readlink -v -e /mnt/backup/@backups
WARNING: ... readlink: /mnt/backup/@backups: No such file or directory
WARNING: Skipping target "/mnt/backup/@backups": Failed to fetch subvolume detail
WARNING: Skipping cleanup of snapshots for subvolume "/mnt/btr_pool/@", as at least one target aborted earlier
WARNING: Skipping cleanup of snapshots for subvolume "/mnt/btr_pool/@home", as at least one target aborted earlier
--------------------------------------------------------------------------------
Backup Summary (btrbk command line client, version 0.29.2-dev)

    Date:   Fri Jul 10 15:35:26 2020
    Config: /etc/btrbk.conf

Legend:
    ===  up-to-date subvolume (source snapshot)
    +++  created subvolume (source snapshot)
    ---  deleted subvolume
    ***  received subvolume (non-incremental)
    >>>  received subvolume (incremental)
--------------------------------------------------------------------------------
/mnt/btr_pool/@
!!! Target "/mnt/backup/@backups" aborted: Failed to fetch subvolume detail

/mnt/btr_pool/@home
!!! Target "/mnt/backup/@backups" aborted: Failed to fetch subvolume detail

NOTE: Some errors occurred, which may result in missing backups!
Please check warning and error messages above.

is this to be expected and I can ignore the error?

digint commented 4 years ago

This is expected. As btrbk can not know about mount points, it tries to find the path at "target" and aborts the backup if it is not present.

In your case, no snapshots are created as snapshot_create ondemand is set and the target aborted.

digint commented 4 years ago

As this is a common use-case, I'm thinking of implementing something like "graceful abort" option, which would then not treat it as an error in this case.

luxagen commented 2 years ago

As this is a common use-case, I'm thinking of implementing something like "graceful abort" option, which would then not treat it as an error in this case.

I'd love this. I have backup disks that I'd like to specify as resume targets rather than using archive, but I've never been able to find a way to make it work without erroring when the disks are detached.