Method Signature
Parameters
The backup handle to restore
Returns
Result of the restore operation
Example
Example: Disaster Recovery
Example: Cross-Sandbox Restore
Example: Restore to Different Path
Error Handling
Throws an error if:- Backup ID is invalid or expired
- Target directory already exists
- R2 download fails
- Insufficient disk space
- R2 is not configured
- Backup file is corrupted
Technical Details
- Downloads backup from R2 using presigned URLs
- Decompresses SquashFS archive in the container
- Extracts files to the target directory
- Restore process is serialized to prevent concurrent operations
- Large backups may take time to download and extract
Notes
- Target directory must not exist (or must be empty)
- File permissions and ownership are preserved
- Symlinks are restored with their original targets
- Restore operations are atomic - either all files are restored or none
- Can restore to a different sandbox than where the backup was created
- Backup handles are serializable - store them anywhere (KV, DO, database)
- Modifying the
dirfield in the handle changes the restore target
See Also
- createBackup - Create a backup
- Backups Guide - Learn about backup strategies