Before you begin
- Authority over the selected data and an approved independent backup destination with sufficient space.
- Database-specific backup instructions, protected credentials, and a documented retention policy.
- An isolated restore location and a tested way to obtain backup access during a server failure.
Define recovery needs and include the dependencies
Set the acceptable data-loss interval and restoration time. Inventory application files, uploads, configuration, databases, scheduled jobs, and the instructions needed to recreate the service. Include required secrets only in a separately protected recovery process, not an unrestricted archive. Identify who can authorize a restore.
Do not assume snapshots or automatic backups exist. If an available snapshot is used, verify its consistency and restoration procedure; a copy tied to the same account or failure domain is not an independent recovery strategy. Record dependencies that must be restored together so that files and database records remain compatible.
Obtain a consistent database backup
Use the database's supported dump or online-backup mechanism and check its exit status. Copying live database files with a file-transfer tool can produce an unusable backup, even when the copy completes. Follow engine-specific guidance for transactions, logs, extensions, and compatible restore versions.
For SQLite, its CLI backup command uses the supported online-backup mechanism. Replace DATABASE_FILE with the source database path and BACKUP_FILE with a new destination file in an approved private directory:
umask 077
sqlite3 "DATABASE_FILE" ".backup 'BACKUP_FILE'"Run as the authorized data owner. Keep passwords out of command arguments, and validate the resulting artifact before transferring it.
Protect the offsite copy and retention history
Use encrypted transport, verified destination identity, restrictive destination permissions, and encryption at rest appropriate to the data. Keep decryption keys recoverable independently of the original VPS, without storing them openly beside the backup. Separate backup access from ordinary application access where practical.
Retain multiple dated versions according to an approved policy; a single synchronized copy can reproduce corruption or unwanted changes. Monitor backup completion, age, and available destination space. Confirm retention does not silently discard the only usable recovery point. Document who can read, restore, and retire backups, including any legal or contractual retention requirements.
Preview an explicitly scoped file transfer
Replace every uppercase placeholder. SOURCE_DIR and BACKUP_DIR are approved absolute paths without spaces or trailing slashes; pre-create the protected destination. BACKUP_USER and BACKUP_HOST identify the authorized destination. Here SSH_PORT is that destination's verified external SSH port, not a guest firewall value.
rsync -a --dry-run --itemize-changes -e 'ssh -p SSH_PORT' "SOURCE_DIR/" BACKUP_USER@BACKUP_HOST:BACKUP_DIR/Review every reported destination before repeating the same command without --dry-run. The source trailing slash copies its contents; omitting it nests the source directory itself. No deletion flag is used. Archive mode is not database consistency, encryption at rest, or a guarantee that every ownership, ACL, and extended-attribute requirement is preserved.
Restore only into a new, empty test directory
Replace RESTORE_TEST_DIR with a unique absolute path under an existing private parent, never a production path. Create it without permitting reuse:
mkdir -m 700 "RESTORE_TEST_DIR"If creation fails or the directory already exists, stop and choose a different new path. Preview the restore:
rsync -a --dry-run --itemize-changes -e 'ssh -p SSH_PORT' BACKUP_USER@BACKUP_HOST:BACKUP_DIR/ "RESTORE_TEST_DIR/"After confirming the destination is still empty and isolated, repeat without --dry-run. Never redirect this command at live files. Restore database dumps into a disposable isolated database, not the production instance. Prevent test applications from contacting live queues, email systems, or production databases.
Verify recoverability and prepare a safe failure report
Compare file inventories, selected checksums, permissions, and application-readable content. Validate the restored database using its supported integrity checks. Start any test application only in the isolated environment. Measure restoration time and compare the recovery point with the documented objectives; a successful transfer alone does not prove recovery.
For escalation, record UTC backup and restore times, tool versions, artifact age, exit status, and the exact failing stage. Redact paths, destination identities, account names, database names, and customer data. Never attach backup archives, dump contents, encryption keys, or credentials to an ordinary troubleshooting request. Record the next restore-test date and preserve the known-good recovery point.
Final checklist
- Recovery objectives, dependencies, and supported database backup methods are documented.
- An independent protected copy and a reviewed multi-version retention policy exist.
- Rsync changes were previewed, and source trailing-slash behavior was understood.
- The restore used a uniquely created empty directory and an isolated test database.
- Integrity and application checks passed; recovery timing and redacted failure evidence are recorded.
Sources & further reading
Discuss your requirements.
For a VPS proposal, share your workload, preferred region and resource needs. Availability, specifications and terms are confirmed separately; an inquiry does not place an order or provision a server.
Start an inquiry