Since the update to Fedora 31 I've got a problem with btrfs snapshot backups.
The first transfer runs without any problem as it is a complete backup of the source file system (machine 1) to the destination filesystem (machine 2).
The second run uses btrfs send -p to send the diff only.
On the receiver side (machine 2) btrfs receive is called. This aborts with an error:
ERROR source :: Command ['bash', '-c', 'ionice -c3 btrfs receive "/mnt/storage/"'] failed with error code 1 (ERROR: cannot open /mnt/storage//.temp.0c627bb6c073408fa8fbacffcc5491c1/o873662-31387-0: No such file or directory ]
At snapshot .temp.0c627bb6c073408fa8fbacffcc5491c1)
Notice the double / in the path. For some reason btrfs receive gets that invalid path as destination for the new snapshot. In my understanding that path is provided by btrfs send.
Notice that the arguments of btrfs send do not contain any wrong path components:
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'ionice -c3 btrfs send -p "/mnt/storage-1/.sxbackup/sx-20191128-173739-utc" "/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1"']
In my oppinion the problem is not located in the code of btrfs-sxbackup as it provides correct arguments to btrfs send / receive. The problem might be located in btrfs-progs itself. So I updated these to the current version 5.4-1.fc31 with no effect.
I already reformatted the destination volume and did a complete initial backup run with success. However any further differential backup attempt failed.
Here is the complete debug log of the second run of btrfs-sxbackup (differential backup):
[root@machine2 storage]# btrfs-sxbackup -v run /mnt/storage
INFO btrfs-sxbackup v0.6.11
DEBUG ['bash', '-c', 'if [ -f "/mnt/storage/.btrfs-sxbackup" ]; then exit 10; fi']
DEBUG ['bash', '-c', 'cat "/mnt/storage/.btrfs-sxbackup"']
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'cat "/mnt/storage-1/.sxbackup/.btrfs-sxbackup"']
INFO source :: url [ssh://gilching1:/mnt/storage-1/] container [.sxbackup/] retention [3] compress [False]
INFO destination :: url [/mnt/storage/] retention [30] compress [False]
INFO preparing environment
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'if [ ! -d "/mnt/storage-1/.sxbackup/" ]; then btrfs sub create "/mnt/storage-1/.sxbackup/"; fi']
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'btrfs sub show "/mnt/storage-1/.sxbackup/"']
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'if [ -d "/mnt/storage-1/.sxbackup/.temp"* ]; then btrfs sub del "/mnt/storage-1/.sxbackup/.temp"*; fi']
DEBUG ['bash', '-c', 'if [ ! -d "/mnt/storage/" ]; then btrfs sub create "/mnt/storage/"; fi']
DEBUG ['bash', '-c', 'btrfs sub show "/mnt/storage/"']
DEBUG ['bash', '-c', 'if [ -d "/mnt/storage/.temp"* ]; then btrfs sub del "/mnt/storage/.temp"*; fi']
INFO source :: retrieving snapshots
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'btrfs sub list -o "/mnt/storage-1/.sxbackup/"']
INFO destination :: retrieving snapshots
DEBUG ['bash', '-c', 'btrfs sub list -o "/mnt/storage/"']
INFO source :: creating snapshot
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'btrfs sub snap "/mnt/storage-1/" "/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1" && sync']
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'touch "/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1"']
DEBUG source :: updating property [ro] of [/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1] to [true]
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'btrfs property set "/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1" ro true']
DEBUG ['bash', '-c', 'if [ -d "/mnt/storage/.temp.0c627bb6c073408fa8fbacffcc5491c1" ]; then exit 10; fi']
INFO source :: transferring snapshot
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'ionice -c3 btrfs send -p "/mnt/storage-1/.sxbackup/sx-20191128-173739-utc" "/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1"']
DEBUG ['bash', '-c', 'type pv']
DEBUG ['bash', '-c', 'ionice -c3 btrfs receive "/mnt/storage/"']
ERROR source :: Command ['bash', '-c', 'ionice -c3 btrfs receive "/mnt/storage/"'] failed with error code 1 (ERROR: cannot open /mnt/storage//.temp.0c627bb6c073408fa8fbacffcc5491c1/o873662-31387-0: No such file or directory ]
At snapshot .temp.0c627bb6c073408fa8fbacffcc5491c1)
ERROR source :: Command ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'ionice -c3 btrfs send -p "/mnt/storage-1/.sxbackup/sx-20191128-173739-utc" "/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1"'] failed with error code -9 (At subvol /mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1)
INFO destination :: removing subvolume [/mnt/storage/.temp.0c627bb6c073408fa8fbacffcc5491c1]
DEBUG ['bash', '-c', 'if [ -d "/mnt/storage/.temp.0c627bb6c073408fa8fbacffcc5491c1" ]; then btrfs sub del "/mnt/storage/.temp.0c627bb6c073408fa8fbacffcc5491c1"; fi']
INFO source :: removing subvolume [/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1]
DEBUG ['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'gilching1', 'if [ -d "/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1" ]; then btrfs sub del "/mnt/storage-1/.sxbackup/.temp.0c627bb6c073408fa8fbacffcc5491c1"; fi']
ERROR Transferring snapshot failed
ERROR Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/btrfs_sxbackup/__main__.py", line 216, in main
job.run()
File "/usr/lib/python3.7/site-packages/btrfs_sxbackup/core.py", line 1028, in run
raise e
File "/usr/lib/python3.7/site-packages/btrfs_sxbackup/core.py", line 1024, in run
compress=self.source.compress)
File "/usr/lib/python3.7/site-packages/btrfs_sxbackup/core.py", line 333, in transfer_btrfs_snapshot
raise e
File "/usr/lib/python3.7/site-packages/btrfs_sxbackup/core.py", line 325, in transfer_btrfs_snapshot
raise Error("Transferring snapshot failed")
btrfs_sxbackup.core.Error: Transferring snapshot failed