Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A reliable VPS backup for a self-hosted AI agent is not a single snapshot. Use four coordinated layers: a rebuildable deployment definition, exports of Docker volumes and bind-mounted files, database-aware dumps, and encrypted copies stored away from the VPS. Keep a provider snapshot for rapid rollback, but test restoring everything on a clean server. That is the difference between having a backup file and being able to bring the agent back.

What a complete AI-agent backup must contain

Self-hosted agents spread state across more places than the container image. Prompts may be in a repository, conversation memory in a named volume, uploaded documents in a bind mount, embeddings in a vector index, and user accounts in PostgreSQL. A VPS image can capture some of that, but its scope depends on the provider and storage layout.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Layer What to save Why it matters
Rebuild layer Docker Compose files, image tags or immutable digests, environment-variable names, reverse-proxy and TLS configuration, firewall rules, systemd units, cron jobs, scripts, prompts and tool definitions Lets you recreate the host instead of depending on an undocumented server
Application-data layer Named Docker volumes, bind-mounted directories, agent memory, uploads, vector indexes, SQLite files, and local model or embedding caches that cannot be downloaded again Preserves the agent’s working state and user data
Database layer PostgreSQL dumps, cluster-wide roles and tablespaces when required, or a supported dump/backup of another database engine Produces a consistent, portable copy rather than an arbitrary file-system image
Provider-recovery layer VPS backups or snapshots Provides fast rollback, cloning and emergency recovery, but may omit attached volumes and remains tied to that provider
Off-site layer Encrypted archives in independent object storage or on another host Protects against VPS deletion, host failure, ransomware and account compromise

Docker describes volumes as “persistent data stores for containers, created and managed by Docker.” Removing a container does not remove its named volume, but that persistence is not a backup. The volume still needs to be copied somewhere else.

Define recovery targets before choosing a schedule

Two decisions determine how often to run backups and how much history to keep:

#1 Best Overall
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
  • Recovery-point objective (RPO): the maximum acceptable amount of recent agent activity that could be lost. An agent receiving frequent uploads or conversations needs more frequent exports than an agent used occasionally.
  • Recovery-time objective (RTO): the maximum acceptable time to operate on a replacement VPS. Rebuild scripts, pinned images and a tested runbook reduce this time more effectively than an extra snapshot alone.

No universal RPO, RTO or failure-rate benchmark is prescribed for self-hosted agents. Measure your own restore drill and adjust the schedule to the agent’s change rate, storage cost and business impact.

Inventory the stack and its state

Do this inventory before writing a backup script. Run it from the deployment directory and save the output in your version-controlled operations folder.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Render the effective Compose configuration.
    docker compose config > inventory/compose-rendered.yml

    Review the rendered file for every service, image, environment variable, secret, volume and network. Record image tags; for reproducibility, prefer immutable digests such as image@sha256:... when your registry supports them.

  2. List named volumes.
    docker volume ls

    Inspect each candidate with docker volume inspect VOLUME_NAME and map it to the service that writes it.

  3. Find bind mounts. Inspect running containers with docker inspect CONTAINER_NAME and record every host path. Include paths outside the project directory, such as upload, cache, model, proxy and certificate directories.
  4. List databases and scheduled work. Record database names, users, hosts, ports, migration commands, cron entries, systemd timers, webhook endpoints and any queue or worker service.
  5. Classify re-downloadable data. Note which model weights, embedding models and package caches can be fetched again and which must be archived because they are private, modified or no longer available.

The inventory itself belongs in the rebuild layer. Update it whenever you add a service, volume, integration or scheduled job.

Preserve a rebuildable deployment definition

A dump of data is useless if you cannot start the software that reads it. Store the following in a private Git repository or another versioned location:

  • Compose YAML, override files and pinned image tags or digests.
  • A template environment file containing variable names, expected formats and required/optional status, but not secret values.
  • Reverse-proxy configuration, domain mappings, TLS automation settings and certificate-renewal instructions.
  • Firewall rules, SSH hardening, kernel or system packages, Docker installation steps and disk-mount instructions.
  • Systemd unit files, timer definitions, cron entries and backup scripts.
  • Agent prompts, tool definitions, model routing rules, embedding settings and migration scripts.
  • A list of external integrations: SMTP, webhooks, OAuth applications, storage buckets, vector services and monitoring destinations.

Keep secret values in a separate encrypted password manager or secret store. Document how to recreate or rotate each key, including the order in which integrations must be re-authorized. Do not place a VPS SSH key, database password or API token in the same repository as the Compose file.

Dump databases with database-aware tools

File-copying a live database directory can capture an internally inconsistent state. Use the engine’s supported export mechanism, then archive the resulting dump with the rest of the backup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PostgreSQL database dumps

PostgreSQL’s pg_dump creates a consistent logical dump while users continue reading and writing. The PostgreSQL documentation identifies it as the utility for backing up a PostgreSQL database.

Rank #2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
mkdir -p /srv/backup-staging/postgres
pg_dump -Fc -d AGENT_DATABASE -f /srv/backup-staging/postgres/AGENT_DATABASE.dump

The custom format (-Fc) is designed for pg_restore, allows selective object restoration and supports parallel restore. A directory-format dump is another option when you need parallelism during the dump itself.

Roles, tablespaces and other cluster-wide objects are not contained in an individual database dump. Export them when the deployment depends on them:

pg_dumpall --globals-only > /srv/backup-staging/postgres/globals.sql

On a replacement server, create the target database, restore global objects in the appropriate order, and then restore the database:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
psql -f /srv/backup-staging/postgres/globals.sql postgres
createdb AGENT_DATABASE
pg_restore --dbname=AGENT_DATABASE --clean --if-exists /srv/backup-staging/postgres/AGENT_DATABASE.dump

Use connection options, ownership handling and extensions appropriate to your installation. Test the dump by restoring it; a command that completes on the source host is not proof that the file is usable.

SQLite and embedded databases

For SQLite, use the backup or dump mechanism supported by the deployed SQLite version or by the application itself. A safe pattern is to create a separate backup file while the application is quiesced, then include that file in the archive. Do not copy a busy SQLite file while writes are in progress and assume it is consistent.

Other stateful services

Redis, search indexes, vector databases and queues each have their own persistence and export rules. Follow the service’s supported snapshot or dump procedure. If the index can be deterministically rebuilt from documents and embeddings, record that rebuild process and still keep a copy when rebuilding would exceed your recovery target.

Back up Docker volumes and bind-mounted directories

Stop or pause writers when a crash-consistent archive is not sufficient. At minimum, stop the agent worker before copying memory, uploads or an embedded database; otherwise files may change while tar is reading them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Export a named volume

Docker’s documented pattern is a temporary helper container that mounts the source volume and a host backup directory. This example archives the complete contents of agent_data:

mkdir -p /srv/backup-staging/volumes
docker run --rm 
  -v agent_data:/data:ro 
  -v /srv/backup-staging/volumes:/backup 
  alpine tar czf /backup/agent_data.tgz -C /data .

Repeat the command for every named volume, using a distinct archive name. If the service cannot be safely read while running, stop it first with the relevant Compose command and start it again after the archive completes.

Export a bind mount

Bind mounts live on the VPS filesystem, so archive the host path directly. Preserve ownership, permissions, symbolic links and extended attributes where your filesystem requires them:

tar --xattrs --acls -czf /srv/backup-staging/binds/agent_uploads.tgz -C /srv/agent uploads

Include agent memory, uploaded files, vector indexes, custom skills, certificates that you are permitted to export, and local model files that cannot be retrieved from an authoritative source. Exclude disposable caches only after confirming that they can be recreated.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not back up a container’s writable layer

Changes made inside a container without a volume or bind mount are tied to that container instance. Recreating the container normally discards them. Move persistent paths into named volumes or explicit host directories, then include those paths in the inventory and backup script.

Encrypt and copy artifacts away from the VPS

Stage configuration exports, database dumps and volume archives in a directory with restricted permissions. Then send that directory to an independent repository using an encrypted backup tool. Restic is one practical choice: its repositories are encrypted, can target S3-compatible Object Storage, and support integrity checks and retention policies.

Initialize and test a Restic repository

Set the repository location, repository password and object-storage credentials through a secret mechanism outside the VPS whenever possible. The exact endpoint and credential variables depend on the storage service.

Rank #4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
restic -r $RESTIC_REPOSITORY init
restic -r $RESTIC_REPOSITORY backup /srv/backup-staging
restic -r $RESTIC_REPOSITORY check

The repository password is essential: losing it can make encrypted snapshots unrecoverable. Keep a recovery copy of that password and the object-storage credentials in a password manager or another secret store that the VPS cannot erase.

Automate the backup job

Wrap the database dumps, service quiescing, volume exports, Restic upload and restart steps in a root-owned script. Make it fail on the first error, write a timestamped log, and alert when the exit status is non-zero. A cron entry or systemd timer can invoke the script; the schedule should match your RPO rather than an arbitrary default.

17 2 * * * /usr/local/sbin/backup-agent >> /var/log/backup-agent.log 2>&1

Run restic check regularly, not only after an upload. Also perform an actual restore of a recent snapshot because repository integrity does not verify that your application can read every required file.

Use retention deliberately

An illustrative starting policy is several recent daily snapshots, a few weekly snapshots and monthly snapshots for longer-lived configuration and data. Restic can express such a policy with forget and prune, but the numbers are workload-specific; increase retention for slowly changing historical records and reduce it only when storage cost and legal requirements permit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand what provider backups and snapshots cover

Provider images are valuable for fast rollback and cloning, but their storage scope and retention are provider-specific. Treat them as a recovery layer, not your only copy.

Recovery option Attached-volume coverage Database consistency Portability Granularity and retention Typical use
Provider VPS backup or snapshot Depends on provider; attached volumes may be excluded Usually a disk image; coordinate application quiescing if you need a clean state Low outside the provider Fast whole-server rollback; retention and slots are provider-controlled Rapid rollback, cloning and emergency rebuild
Encrypted Restic archive Includes any paths you explicitly stage, including exported volumes As consistent as the database dumps and quiescing used before staging High; restore to another VPS or compatible object storage File or snapshot-level selection with policy-controlled retention Independent disaster recovery and routine automation
Manual database and file exports Only the volumes, mounts and dumps you select Database-aware when using supported dump tools High for standard formats Fine-grained, but easy to omit a path or forget a run Auditable exports and targeted restores

Hetzner Cloud scope

Hetzner documents automatic daily server Backups with seven slots. Snapshots are manual and remain until you delete them. Its documentation explicitly states that Backups and Snapshots do not include attached Volumes. If your agent stores uploads or databases on a Volume, export that Volume separately and keep an independent copy.

DigitalOcean Droplet scope

DigitalOcean documents selectable system-level backup intervals of four hours, six hours, twelve hours, daily or weekly. These are disk images that can be used to create or restore Droplets. Confirm the current plan, region, retention and any additional-volume scope before relying on them.

Best Value
Sale
UnionSine 500GB Ultra Slim Portable External Hard Drive HDD-USB 3.0 | for PC, Mac, Laptop, PS4, Xbox one, Xbox 360-(Black)
  • [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
  • 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
  • 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
  • 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
  • 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.

For either provider, check the current documentation for your exact product and region. A provider’s image cannot protect you from deletion of the provider account, a compromised control panel or a mistake that propagates to every server-side copy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Restore on a clean VPS: a repeatable procedure

Perform a drill before an incident and record the elapsed time, missing credentials and failed assumptions. Use an isolated hostname or network so the test cannot send real webhooks or email.

  1. Provision a clean server. Match the CPU architecture, operating-system family, disk layout and firewall prerequisites of production. Apply updates and install the pinned Docker, Compose and database-client versions.
  2. Retrieve the rebuild layer. Clone the configuration repository, check out the documented revision and create directories with the required owners and permissions.
  3. Recreate secrets. Generate or rotate credentials according to the secret runbook. Re-authorize OAuth applications, storage access, SMTP and webhook destinations; keep test endpoints isolated.
  4. Install the backup client and credentials. Configure Restic using the repository address and password stored outside the original VPS. List snapshots and select the restore point.
  5. Restore staged files. Restore configuration exports, bind-mounted directories and named-volume archives. For a named volume:
docker volume create agent_data
docker run --rm 
  -v agent_data:/data 
  -v /srv/restore:/restore 
  alpine tar xzf /restore/agent_data.tgz -C /data
  1. Restore the database. Start only the database service, apply global roles and tablespaces where needed, create the database and run pg_restore or the equivalent engine-specific restore.
  2. Start the application. Run the Compose deployment with the pinned images. Inspect logs for migration errors, permission failures, missing extensions and incompatible model formats.
  3. Verify behavior, not just process status. Log in, send a test prompt, retrieve an old memory, open an uploaded file, query the vector index, run a scheduled job, exercise a webhook, renew or validate TLS, and confirm monitoring alerts.
  4. Document the result. Record restore time, snapshot age, data lost since that snapshot, manual actions and every missing prerequisite. Update the runbook and repeat the drill after major architecture changes.

Common backup failures and fixes

The snapshot restored, but uploads or memory are missing

The data was probably on an attached volume or bind mount outside the captured disk. Add those paths to the inventory, export them explicitly and test a volume restore.

The containers start but the agent has no history

Check that the correct named volume was restored and mounted at the same container path. Verify ownership and permissions, then inspect application configuration for a changed database or memory path.

The database dump cannot be restored

Confirm that the destination PostgreSQL major version and required extensions are installed. Restore global roles before objects that depend on them, and use the matching dump format tool.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The archive is present but secrets no longer work

Secrets are intentionally separate from ordinary configuration. Follow the recreation and rotation runbook, update integration callbacks, and never copy production credentials into a public test environment.

Restic reports a healthy repository but the application fails

restic check verifies repository integrity, not application completeness. Compare the inventory with the staged paths, restore a snapshot into a clean directory, and run the full service-level verification.

A backup job silently stopped

Use a systemd timer or cron entry that logs output, alert on non-zero exit status, and monitor the timestamp of the last successful snapshot. Test the alert by intentionally running the job with an invalid destination.

Operational checklist

  • Compose files, image digests, scripts and firewall/proxy configuration are versioned.
  • Environment-variable names are documented; secret values and recovery credentials are stored separately.
  • Every named volume and bind mount has an owner, purpose and export command.
  • PostgreSQL databases have tested pg_dump files; cluster-wide roles and tablespaces are exported when required.
  • SQLite and other embedded databases are copied with a supported, consistent method.
  • Agent memory, uploads, vector indexes and irreplaceable model files are included.
  • Archives are encrypted and stored outside the VPS account or host.
  • Restic repository checks and backup-job alerts are scheduled.
  • Provider backups or snapshots are enabled with their scope and retention recorded.
  • A clean-VPS restore drill has verified login, responses, memory retrieval, files, jobs, webhooks, TLS and monitoring.

Bottom line

Use provider snapshots for speed, but build your real disaster-recovery plan around documented rebuild files, consistent database dumps, explicit Docker-volume and bind-mount exports, and encrypted off-site copies. Keep the credentials needed to decrypt and restore those copies away from the agent host. A clean-server restore drill is the final test that all four layers work together.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
Bestseller No. 2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$208.99
Bestseller No. 3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.80
Bestseller No. 4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$208.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.