I am using Restic on 3 machines to backup large datasets of a few terabytes each to the Mega S4 backend, using the S3 API compatibility in Restic. Recently I ran restic check --read-data on them (which took a few days) and found that they all had a few damaged packs. I consider this worrying, as it seems that this has occurred on each machine/repo independently of each other. I wonder if I am using Restic wrong, or if there is a compatibility issue with the backend.
Here are some specifics: I have a common script that runs on each machine daily to trigger restic and notify me of backup failures. Here is the version that runs on one of my Linux hosts:
#!/bin/bash
repo="s3:s3.ca-west-1.s4.mega.io/redacted"
export AWS_ACCESS_KEY_ID=redacted
export AWS_SECRET_ACCESS_KEY=redacted
export RESTIC_PASSWORD=redacted
err() {
curl -d "$1" ntfy.sh/redacted
exit 1
}
if ! restic -r $repo --pack-size=100 backup /mnt --exclude /mnt/m15*; then err "Vakt backup failed. Check server config"; fi
if ! restic -r $repo forget --keep-daily 3 --keep-weekly 3; then err "Prune of vakt backups failed. Maybe there's a stale repo lock?"; fi
if ! restic -r $repo prune; then err "Unable to prune vakt backups. Investigate plz"; fi
if ! restic -r $repo check; then err "Vakt backup repo corrupt. Investigate"; fi
restic cache --cleanup
exit 0
The order of operations is the same on all machines: backup, forget, prune, check, cache --cleanup. Two of them have --pack-size 100 set; the other does not.
Here is the full output of restic check --read-data on one of the machines (this one running Windows 11). Note the frequent transfer retries; this appears to be consistent whenever the Mega S4 backend is used, but I would expect restic to handle these cases gracefully (and in fact it does appear to).
Terminal output
PS C:\Users\ben> restic -r $repo check --read-data
using temporary cache in C:\Users\ben\AppData\Local\Temp\restic-check-cache-369260775
create exclusive lock for repository
repository d2c6334a opened (version 2, compression level auto)
created new cache in C:\Users\ben\AppData\Local\Temp\restic-check-cache-369260775
load indexes
[0:06] 100.00% 74 / 74 index files loaded
check all packs
check snapshots, trees and blobs
[0:03] 100.00% 13 / 13 snapshots
read all data
Load(<data/05a81629d5>, 104878864, 0) returned error, retrying after 1.310847009s: readFull: unexpected EOF
Load(<data/05a81629d5>, 104878864, 0) operation successful after 1 retries
Load(<data/95edfbba3e>, 19055449, 0) returned error, retrying after 1.216894284s: readFull: request timeout
Load(<data/95edfbba3e>, 19055449, 0) returned error, retrying after 1.082109306s: readFull: request timeout
Load(<data/95edfbba3e>, 19055449, 0) operation successful after 2 retries
Load(<data/75155c850e>, 105540424, 0) returned error, retrying after 1.364258527s: readFull: request timeout
Load(<data/75155c850e>, 105540424, 0) returned error, retrying after 2.163745958s: readFull: request timeout
Load(<data/75155c850e>, 105540424, 0) operation successful after 2 retries
Load(<data/b513659745>, 107369457, 0) returned error, retrying after 1.415071937s: readFull: read tcp 10.141.120.178:2276->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/155bae2437>, 105261852, 0) returned error, retrying after 804.387595ms: readFull: read tcp 10.141.120.178:4350->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/b513659745>, 107369457, 0) operation successful after 1 retries
Load(<data/155bae2437>, 105261852, 0) operation successful after 1 retries
Load(<data/d564f1a7a1>, 105349879, 0) returned error, retrying after 1.366726721s: readFull: unexpected EOF
Load(<data/d564f1a7a1>, 105349879, 0) operation successful after 1 retries
Load(<data/b5919ab459>, 17753561, 0) returned error, retrying after 1.447152731s: readFull: read tcp 10.141.120.178:6582->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/b5919ab459>, 17753561, 0) operation successful after 1 retries
Load(<data/e5bc9b2149>, 106226954, 0) returned error, retrying after 1.331888432s: readFull: read tcp 10.141.120.178:4319->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/e5bc9b2149>, 106226954, 0) operation successful after 1 retries
pack 770e388b80e4e482c948b4e180f1bddf7f75946afebeebb3cc6233e15f44dcfc contains 1 errors: [unexpected pack id 500bad309e2c0fcbe6c1c2e1d6fee46107dbf9b26125682e3cb5a0557c803ef6]
Load(<data/c9744eff7d>, 105345661, 0) returned error, retrying after 538.673722ms: readFull: request timeout
Load(<data/c9744eff7d>, 105345661, 0) returned error, retrying after 1.741474976s: readFull: request timeout
Load(<data/c9744eff7d>, 105345661, 0) operation successful after 2 retries
Load(<data/3985ca63c5>, 106099759, 0) returned error, retrying after 628.801669ms: readFull: read tcp 10.141.120.178:10541->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/b9c2ed3d7f>, 105154162, 0) returned error, retrying after 1.384095274s: readFull: read tcp 10.141.120.178:1073->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/396d94a483>, 17345909, 0) returned error, retrying after 820.51788ms: readFull: read tcp 10.141.120.178:4318->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/791d373a58>, 105616248, 0) returned error, retrying after 521.012119ms: readFull: read tcp 10.141.120.178:4327->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/396d94a483>, 17345909, 0) operation successful after 1 retries
Load(<data/69b029c5ca>, 17403185, 0) returned error, retrying after 1.25887504s: readFull: read tcp 10.141.120.178:4586->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/69b029c5ca>, 17403185, 0) operation successful after 1 retries
Load(<data/791d373a58>, 105616248, 0) operation successful after 1 retries
Load(<data/b9c2ed3d7f>, 105154162, 0) operation successful after 1 retries
Load(<data/3985ca63c5>, 106099759, 0) operation successful after 1 retries
pack dc6f3d09baf055491897ae0d67f508c542235210f51b7a35d947883cffdc3df6 contains 1 errors: [unexpected pack id 83443810a367ab9771dfde5571d2ebac05040d291883762cd0ce99b44b6d52ac]
Load(<data/ccee6d5ff0>, 105391371, 0) returned error, retrying after 755.939923ms: readFull: read tcp 10.141.120.178:9524->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/1c77b4eb70>, 105379020, 0) returned error, retrying after 822.974026ms: readFull: read tcp 10.141.120.178:5485->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/ccb9646e87>, 17316312, 0) returned error, retrying after 567.238054ms: readFull: read tcp 10.141.120.178:1656->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/ccee6d5ff0>, 105391371, 0) operation successful after 1 retries
Load(<data/bc8e20b7d7>, 106064147, 0) returned error, retrying after 1.273085811s: readFull: read tcp 10.141.120.178:1659->185.206.25.75:443: wsarecv: An existing connection was forcibly closed by the remote host.
Load(<data/ccb9646e87>, 17316312, 0) operation successful after 1 retries
Load(<data/1c77b4eb70>, 105379020, 0) operation successful after 1 retries
Load(<data/bc8e20b7d7>, 106064147, 0) operation successful after 1 retries
Load(<data/fe231727ac>, 104988629, 0) returned error, retrying after 1.159497416s: readFull: request timeout
Load(<data/5efe976d0d>, 105253236, 0) returned error, retrying after 1.087554018s: readFull: request timeout
Load(<data/2e007d73af>, 105061720, 0) returned error, retrying after 1.441305604s: readFull: request timeout
Load(<data/8ec80e02e2>, 104882943, 0) returned error, retrying after 1.19227147s: readFull: request timeout
Load(<data/5efe976d0d>, 105253236, 0) returned error, retrying after 1.263889929s: readFull: request timeout
Load(<data/fe231727ac>, 104988629, 0) returned error, retrying after 2.704718244s: readFull: request timeout
Load(<data/8ec80e02e2>, 104882943, 0) returned error, retrying after 2.336122559s: readFull: request timeout
Load(<data/2e007d73af>, 105061720, 0) returned error, retrying after 1.194401982s: readFull: request timeout
Load(<data/2e007d73af>, 105061720, 0) operation successful after 2 retries
Load(<data/8ec80e02e2>, 104882943, 0) operation successful after 2 retries
Load(<data/fe231727ac>, 104988629, 0) operation successful after 2 retries
Load(<data/5efe976d0d>, 105253236, 0) operation successful after 2 retries
[131:47:07] 100.00% 70168 / 70168 packs
The repository contains damaged pack files. These damaged files must be removed to repair the repository. This can be done using the following commands. Please read the troubleshooting guide at https://restic.readthedocs.io/en/stable/077_troubleshooting.html first.
restic repair packs dc6f3d09baf055491897ae0d67f508c542235210f51b7a35d947883cffdc3df6 770e388b80e4e482c948b4e180f1bddf7f75946afebeebb3cc6233e15f44dcfc
restic repair snapshots --forget
Damaged pack files can be caused by backend problems, hardware problems or bugs in restic. Please open an issue at https://github.com/restic/restic/issues/new/choose for further troubleshooting!
Fatal: repository contains errors
I would also like to note that two of the machines are running Debian Linux, and the other is running Windows 11. They are each running either restic version 0.17.3 or 0.18.1.
In the short term, I have repaired the repos and have suffered no data loss. However I suspect that these repos may become damaged again. So in the long term, I would like to find out whether restic or my Mega S4 backend are causing the issues and how future damage can be avoided.