Mount backup archives from R2 during restore#577
Merged
whoiskatrin merged 4 commits intomainfrom Apr 13, 2026
Merged
Conversation
Avoid downloading the full backup archive into local storage before restore. Mount the R2 backup prefix with s3fs instead so squashfuse can read archive blocks on demand.
Avoid downloading the full backup archive into local storage before restore. Mount the R2 backup prefix with s3fs instead so squashfuse can read archive blocks on demand.
🦋 Changeset detectedLatest commit: 28a807c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
Contributor
📦 Preview BuildVersion: Install the SDK preview:
|
Restore can reuse the same backup after copy-on-write writes, which leaves FUSE teardown timing-sensitive. Fall back to lazy unmount for the restore R2 mount before remounting it.
Document the restore path change in the next SDK release so users see that backup restores now mount archives from R2 instead of downloading a local copy first.
scuffi
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
s3fsmount instead of downloadingdata.sqshinto local container storage firstWhy
squashfusealready reads the archive through normal file reads, so restore does not need a full local copy of the archive first. Mounting the backup prefix directly keeps the restore path simpler and avoids the extra download step.Reviewer Notes
packages/sandbox-container/src/services/backup-service.tsis unchanged. The container restore path still only takes anarchivePathand mounts it withsquashfuseplusfuse-overlayfs.archivePathnow points to/var/backups/r2mount/<id>/data.sqshinstead of/var/backups/<id>.sqsh.s3fsmount before a second restore of the same backup.s3fspackage.Testing
npm run checknpm test