sodcalculator

10 Tech How-To

GPU Cloud Disaster Recovery: Backup Checkpoints & Datasets

Guide 10-60747 · Updated · Step by step

This guide walks you through backing up model checkpoints and datasets for GPU cloud disaster recovery. You’ll learn a practical, step-by-step process to protect your work from instance failures, accidental deletions, or region outages. By the end, you’ll have a repeatable backup routine that minimizes downtime and data loss.

What You’ll Need

  • Access to your GPU cloud provider’s CLI (e.g., aws cli, gcloud, az) or a web console.
  • An object storage bucket (e.g., AWS S3, Google Cloud Storage, Azure Blob) in a different region or account for off-site backups.
  • Your project’s dataset and checkpoint file paths (typically under /workspace, /data, or /output).
  • Optional: A backup script or orchestration tool (e.g., Python, shell script, or a tool like restic).

Step-by-Step

  1. Identify critical files. List the exact paths of your datasets (raw, processed, and splits) and model checkpoints (including optimizer states, config files, and tokenizer files). Use find or du to confirm sizes.
  2. Choose a backup destination. Create an object storage bucket in a different region or cloud provider than your GPU instances. For example, if your GPUs run in us-east-1, create the bucket in us-west-2 or on a different provider entirely.
  3. Set up authentication. Generate API keys or service account credentials with write access to the bucket. Store these securely (e.g., in environment variables or a secrets manager), not in your code repository.
  4. Install and configure the CLI. Install the cloud provider’s CLI on your GPU instance or a separate backup server. Run aws configure, gcloud auth login, or az login to authenticate.
  5. Create a backup script. Write a shell script that uses the CLI to sync your dataset and checkpoint directories to the bucket. For AWS S3, use aws s3 sync /local/path s3://bucket/backup/. For GCS, use gsutil rsync -r /local/path gs://bucket/backup/. Include flags like --exclude for temporary files (e.g., *.tmp) and --delete to remove files that no longer exist locally (only if you want an exact mirror).
  6. Test the backup. Run the script manually and verify that files appear in the bucket. Check a few files’ integrity by downloading and comparing checksums (e.g., md5sum).
  7. Schedule automatic backups. Use cron on the instance or a CI/CD pipeline to run the script at regular intervals (e.g., every 6 hours for checkpoints, daily for datasets). Ensure the schedule aligns with your training frequency.
  8. Version your backups. Enable object versioning on the bucket to keep previous versions of files. This protects against accidental overwrites or ransomware. Alternatively, include a timestamp in the backup path (e.g., s3://bucket/backup/2025-03-28/).
  9. Document the recovery process. Write down the exact steps to restore from the bucket: which paths to sync back, how to validate the data, and who to contact for access. Store this document in a shared location.
  10. Test disaster recovery. At least once, simulate a failure: delete a checkpoint from the GPU instance, then restore it from the bucket using the reverse sync command. Time the process and note any issues.

Common Mistakes

  • Only backing up the final model. Intermediate checkpoints are crucial for resuming training after a crash. Always include optimizer states and training configuration.
  • Storing backups in the same region. A regional outage will take down both your instances and your backup if they’re in the same data center.
  • Forgetting to exclude large temporary files. Logs, cache files, and .git directories can bloat backups and slow sync times.
  • Not testing the restore. A backup that can’t be restored is worthless. Test at least once.
  • Hardcoding credentials in scripts. This is a security risk. Use environment variables or a secrets manager.

Tips

  • Use incremental backups (like aws s3 sync or rsync) to only upload changed files, saving time and bandwidth.
  • Compress large datasets before uploading to reduce transfer time and storage costs. Use tar -czf or zip for datasets that aren’t already compressed.
  • For very large datasets (hundreds of GB), consider using a dedicated backup tool like restic or borg that supports deduplication and encryption.
  • Set up lifecycle policies on the bucket to automatically delete old backups (e.g., keep daily for 7 days, weekly for a month).
  • Monitor backup success with alerts. Set up cloud watch alarms or simple email notifications when a backup job fails.

Troubleshooting

  • Backup fails with permission errors. Check that your credentials have write access to the bucket. Test by uploading a small file manually.
  • Sync is extremely slow. Check network bandwidth. Use compression, and consider using a transfer acceleration feature if available (e.g., S3 Transfer Acceleration). For huge datasets, use a parallel upload tool like s5cmd.
  • Files are corrupted after restore. Enable checksum verification in your sync command (e.g., --checksum in AWS CLI). Always verify with md5sum after restore.
  • Bucket versioning not working. Ensure versioning is enabled on the bucket, not just on individual objects. Check the bucket properties in the console.
  • Restore takes too long. For urgent needs, restore only the latest checkpoint first, then sync the rest in the background. Prioritize critical files.

Frequently Asked Questions

How often should I back up checkpoints?

It depends on how much training progress you can afford to lose. For long training runs, back up every few hours or after each epoch. For datasets, back up once when they’re finalized, then again if they change.

Can I back up to a local drive instead of cloud storage?

Local drives are useful for quick recovery, but they don’t protect against hardware failure or site-wide disasters. Always have an off-site copy in object storage.

What if my dataset is too large to upload?

For datasets over 1 TB, consider using a physical transfer device (like AWS Snowball) or a dedicated high-speed connection. For recurring backups, use incremental sync to only transfer changes.

Should I encrypt my backups?

Yes, especially if the data is sensitive. Most cloud providers offer server-side encryption (SSE) for object storage. Enable it on the bucket, and optionally use client-side encryption for extra security.

How do I restore a single checkpoint without downloading everything?

Use the CLI to download only the specific file. For example, aws s3 cp s3://bucket/backup/checkpoint-100.pt /local/path/. This is faster and uses less bandwidth.

What if my GPU instance is terminated and I can’t access its filesystem?

If you’ve been backing up to object storage, you can spin up a new instance, install the CLI, and sync the backup to the new instance’s local storage. The process is the same as a normal restore.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →