digint / btrbk

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

Fix issues with 0 sized info files for raw backup #491

Closed ekacnet closed 1 year ago

ekacnet commented 1 year ago

When backuping from devices that have configured to use raw backup and that might disconnect from the network (ie. laptops) you end up once in a while with 0 size info file (and backup file). btrbk don't know how to handle 0 file and stop backing up until the zero size file is removed. With this change 0 size info file will be ignored, and hence the backup for the given backup will be redone.

Signed-off-by: Matthieu Patou mat@matws.net

digint commented 1 year ago

Thanks, merged (with minor amendments) in: 4e5ae975d87aaf193ffac76a1a6801b74101b22a

While I don't like to just silently ignore errors in general, I think we can make an exception here.

Although I'm a bit puzzled how this can happen at all, as btrbk is simply calling something like ssh somehost echo "my-info" > file.info. This means that in some (your) cases, ssh does not "finish" the echo part after creating the file.info.

Having a look in the system_write_raw_info function, maybe this behavior can be improved: https://github.com/digint/btrbk/blob/master/btrbk#L2099

digint commented 1 year ago

As a follow-up, I fixed the raw info file creation, so that a zero-sized file can only exist if the raw target was not yet written (appending to info file instead of re-creating it in dcee6222be8ba4e1ba4c22f6b56339bc50f624e1)