Restic backup rrror: "Device or Resource Busy" when backing up a btrfs snapshot from NAS

Hi,
I’m using restic as my main backup tool and I think it is amazing and I want to thanks the people who built it.

I have a synology NAS and I use the snapshot replication tool to do daily snapshots of my docker folder.
I run a script (see details below) on my main workstation to make a restic backup of the latest snapshot on a spare hard disk.

It worked and never had issues, but since last week I’m having issues. At first I thought it was an issue with my external hard disk or cable, but even with another internal disk or different cables I still have the issue.

I’m following the forum instructions to ask for an help request, and available to share other info/log if needed.

Thanks.

Fabio

The output of restic version.

➜  ~ restic version                                    
restic 0.17.1 compiled with go1.23.1 on linux/amd64

The complete commands that you ran (leading up to the problem or to reproduce the problem).

#!/bin/bash

# Path of  snapshots
snapshot_folder="/mnt/magnum/docker/#snapshot/"
restic_folder="/volumes/restic/magnum-docker"

# Find the latest snapshot
latest_subfolder=$(ls -d "$snapshot_folder"*/ | tail -1)
latest_subfolder_name=$(basename "$latest_subfolder")
latest_snapshot="$latest_subfolder_name"

echo "Backing up the most recent snapshot $latest_snapshot on $restic_folder"

restic -r $restic_folder --verbose backup --exclude .Trash $snapshot_folder$latest_snapshot

Any environment variables relevant to those commands (including their values, of course).

➜  ~ echo $RESTIC_PASSWORD_FILE 
.password/restic-credentials

The complete output of those commands (except any repeated output when obvious it’s not needed for debugging).

-d012dca0578a/4b/e4/4be49e21-58d1-462e-a938-c8f49b806ea4.mp4: read /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/4b/e4/4be49e21-58d1-462e-a938-c8f49b806ea4.mp4: device or resource busy
error: failed to save /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/4d/8a/4d8a4ccc-860d-44fb-bd96-7de37cae6414.mp4: read /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/4d/8a/4d8a4ccc-860d-44fb-bd96-7de37cae6414.mp4: device or resource busy
error: failed to save /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/54/56/54565b30-7876-4f7d-b3b5-307282576fce.mp4: read /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/54/56/54565b30-7876-4f7d-b3b5-307282576fce.mp4: device or resource busy
error: failed to save /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/5b/28/5b2869ba-b899-4c28-a050-8aba87e791f0.mp4: read /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/5b/28/5b2869ba-b899-4c28-a050-8aba87e791f0.mp4: device or resource busy
error: failed to save /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/60/1c/601c4155-7cc8-467a-82b1-7aa800f067e3.mp4: read /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/60/1c/601c4155-7cc8-467a-82b1-7aa800f067e3.mp4: device or resource busy
error: failed to save /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/60/70/6070541d-5de1-4e3f-849a-04dfdfb7027d.mp4: read /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/60/70/6070541d-5de1-4e3f-849a-04dfdfb7027d.mp4: device or resource busy
error: failed to save /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/63/12/63124a41-1aa8-47b9-92de-55e3f10e1279.mp4: read /mnt/magnum/docker/#snapshot/GMT+02-2024.09.24-01.00.02/immich/library/encoded-video/82afabae-3905-4cb0-8b74-d012dca0578a/63/12/63124a41-1aa8-47b9-92de-55e3f10e1279.mp4: device or resource busy
signal interrupt received, cleaning up
scan finished in 195.262s: 109538 files, 249.705 GiB
Fatal: unable to save snapshot: context canceled

Does the folder "/mnt/magnum/docker/#snapshot/" exist locally or on the NAS? How is it mounted?

The device or resource busy indicates that the OS is for some reason unable to read the data requested by restic. I’d expect the same error to show when running cp /some/path/that/caused/the/error /somewhere/else.

hi @MichaelEischer thanks for check in.

I solved this issue using sshfs.

I was trying to backup the folder mounted via samba and that was the main problem I guess.
Now, I’m using sshfs and I do not have errors.

I also wrote this question that is still related to the backup of snapshots but it’s more about speed not errors.