My Offsite Backup Failed for 13 Nights and the Job Said OK

My offsite backup stopped on 19 October and the nightly job reported success for thirteen nights. The bucket sat in the wrong region, and the fix changed how much data each night sends.

My Offsite Backup Failed for 13 Nights and the Job Said OK

On 22 October 2026 at 04:35 my backup log wrote a line I'd seen before and didn't take seriously. RequestTimeout. UploadPart. Reached max retries: 4. I read it, shrugged, and decided S3 was having a bad night.

S3 was fine. My offsite copy had stopped working on 19 October, and it stayed broken for thirteen nights in a row. The scheduler recorded success every single time, and the log said FAILED.

S3 upload timeouts I blamed on the network (it was the wrong region)

A cron job runs at 04:00. It makes the local backup, then calls backup_offsite.sh to copy the archives to S3, so a dead VPS doesn't take the backups down with it. The bucket was s3://remotionlambda-useast1-w72ej6eata/backups. That's a leftover bucket from a different project, and it sits in us-east-1. The server is a VPS in Germany.

Nobody picked us-east-1 on purpose. It was just the bucket that was already there.

From 19 to 31 October, offsite.log got one line per night. All thirteen said FAILED rc=124. Exit code 124 is what timeout returns when it kills the command, so the 30-minute cap was firing every night. Three of them:

2026-10-19T04:34:02+02:00 FAILED rc=124:
2026-10-22T04:35:51+02:00 FAILED rc=124: upload failed: ../../backups/everafterdesignroom-state-2026-10-22.db.gz
  An error occurred (RequestTimeout) when calling the UploadPart operation (reached max retries: 4):
  Your socket connection to the server was not read from or written to within the timeout period.
2026-10-27T04:34:22+01:00 FAILED rc=124: upload failed: ... Connection was closed before we
  received a valid response from endpoint URL: "https://remotionlambda-useast1-w72ej6eata.s3.amazonaws.com/..."

Whenever I did look, I read this as flaky networking. RequestTimeout sounds like the other side's fault. My mental model was lazy: S3 is having trouble, the job runs again tomorrow, it'll catch up.

Retrying tomorrow only helps when the cause is random. This cause was the same every night.

Why the job said OK for thirteen nights

Half of this was the timeout. The other half was that nothing told me. These are the old lines that mattered:

# old upload
nice -n 15 timeout 1800 aws s3 sync "$D" "$BUCKET" --delete --exclude '...' --only-show-errors

# old verify
SIZE=$(aws s3 ls "$BUCKET/" --recursive --human-readable | awk '{s=$3" "$4} END{print s}')

# old end of backup.sh
[ "$OK" = "1" ] || echo 'the BACKUP FAILED - check /home/hermes/backups!'
exit 0

timeout 1800 kills the run after 30 minutes. --delete mirrors a local folder that held a 14-day rolling window, about 9.9 GB then. So every night the script tried to push two weeks of backups to us-east-1 inside half an hour.

If something failed, it echoed a warning. Then it exited 0 no matter what. The scheduler saw exit 0 and recorded SUCCESS. Thirteen times. The only witness was one line inside backups/offsite.log, and no monitor read that file. I'd built an alarm that rang in an empty room.

That number lied too. My awk filter kept only the last line of the listing. It printed "offsite now holds 210 objects (8.4 MiB)", and the 8.4 MiB was just whatever line came last. I measured that bucket today. It holds 208 objects and 5,802,770,808 bytes, which is 5.4 GiB. The log said eight megabytes. The bucket held five gigabytes.

The measurement that broke the assumption

What changed my mind was a boring test. I took the same 4 MB file and uploaded it from this box to three endpoints, timing each one. Cloudflare got 13.8 MB/s. eu-central-1 got 372 KB/s. us-east-1 got 53 KB/s. The VPS uplink was fine. The bottleneck was the distance to the bucket.

I re-ran it on 25 November with a 64 MiB file. A 4 MB probe flatters every endpoint, because the AWS CLI spends about a second on TLS setup before any byte moves.

EndpointOctober 2026 (4 MB probe)25 Nov 2026 (64 MiB file)
Cloudflare (speed test)13.8 MB/s29.0 MB/s
eu-central-1 (selfhostpilot-backups-fra)372 KB/s6.66 s = 10.1 MB/s
us-east-1 (old remotionlambda bucket)53 KB/s15.47 s = 4.3 MB/s

Today the same 64 MiB file is 2.3x faster to Frankfurt. The gap is smaller than it was in October, and I won't pretend I know why. In October that path was slow enough that the database dumps kept hitting RequestTimeout, and every night's run died on the 30-minute cap.

What changed in the script

Moving the bucket wasn't enough on its own.

BUCKET="s3://selfhostpilot-backups-fra/backups"; REGION="eu-central-1"

# newest file of each family is hardlinked into _offsite_stage
( cd "$STAGE" && sha256sum ./* ) > "$STAGE/manifest.sha256"

# prune by age: no --delete anywhere
CUTOFF=$(date -u -d '21 days ago' +%Y-%m-%dT%H:%M:%S)
# aws s3 ls, awk keys older than $CUTOFF, aws s3 rm each one

Staging is the bigger change. Instead of mirroring the whole 14-day folder, the script hardlinks only the newest file of each backup family into _offsite_stage. Today that's 16 files and 1.3 GB, against 13 GB and 228 .gz files locally. Each night now uploads one day of backups. The manifest records a sha256 of every staged file, which makes a real restore check possible later.

Pruning is by age now, and --delete is gone. With --delete, a night where today's big database failed could wipe yesterday's good copy from the bucket. Now nothing gets pruned for being missing. Things only get pruned for being old.

Backup tooling has a second weak spot I haven't covered here: the credentials it carries. I wrote about the security side of backup tooling separately.

Gates that make a bad night loud

# guard: newest local backup older than 30h, or fewer than 2 .gz files -> log SKIPPED, stop
# stragglers: each staged file still absent after sync is copied alone, up to 3 tries
UP=$(aws s3 ls "$BUCKET/" --recursive | wc -l)
# if UP < STAGED -> log FAILED, exit 1

The guard runs first. If the newest local backup is older than 30 hours, or there are fewer than two .gz files, the script refuses to run and logs SKIPPED. A bad local day should never travel offsite.

Stragglers get retried. I added this because of 3 and 4 November. The sync died on the two largest files, greedme-state at 550 MB and state at 354 MB, while every small file went up fine. The run said FAILED, and it was right. But the bucket was missing exactly the two databases that matter most.

Verification counts objects now. If the bucket holds fewer objects than were staged, the script logs FAILED and exits 1.

And the wrapper fails loudly. The 12 Nov change removed the unconditional exit 0. Any failed step now exits 1, and the job runs inside shp-guard, which gives it a kill switch, a flock and a heartbeat that only fires on success. A silent night no longer looks like a good night.

What tonight looks like

Tonight's run started at 04:04:00 and finished at 04:07:50. Under four minutes, for a job that used to be killed at thirty. The log line reads OK: synced 16 files (newest per family, 228 local files kept) | offsite holds 337 objects (19648.6 MiB).

I didn't trust that line on its own. I checked the bucket directly: 337 objects, 20,603,099,396 bytes. That's 19.2 GiB off the VPS.

Today I also pulled three objects back out of Frankfurt and hashed them against the manifest written at upload time. config-2026-11-25.tar.gz came back in 9.8 s, 98 MB at about 10 MB/s, with a matching sha256. etsy-facts-2026-11-25.db.gz and woo-state-2026-11-25.db.gz matched too.

What I didn't fix

The restore check is still manual. restore_drill.sh and today's spot check are steps I ran by hand. The nightly job doesn't run them. So "these backups restore" is a claim that goes stale between drills. In a month I'll only be assuming it.

The old us-east-1 bucket is still there. 208 objects, 5.4 GiB, frozen at 18 October. I kept it as a stale extra copy instead of deleting it. I can't defend that with a measurement. It's just the safer of two defaults.

Offsite retention is 21 days. I didn't build fourteen daily copies of the full 13 GB set. That would cost storage for a gain I haven't measured, so I left it out.

Frequently asked questions

Why do AWS S3 uploads time out?

In my case RequestTimeout meant a socket sat idle too long during a multipart upload. From Germany to us-east-1 I measured 53 KB/s, and the database dumps kept dying after retries. Time the path before you blame S3.

Does the S3 region really change upload speed?

It did on my server. On 25 November a 64 MiB file took 6.66 s to Frankfurt and 15.47 s to us-east-1. Time a real file, bigger than a few megabytes, to each region from your own box.

How do you prove an offsite backup is restorable?

Download it and compare hashes. My script writes a sha256 manifest at upload time, and today three files pulled back from the bucket all matched it. That proves those three files on that day. It says nothing about tomorrow's.

How this post was made: the incident, logs and timings come from my own server. The text was written with AI assistance, and every number traces to offsite.log, the script or a measurement on this box.

If you would rather hand this off, I set up and repair backups like this for self-hosted servers. You can see what I offer on my services page.