PuppyIP Resource Center
Cloud Operations 8 min read Published 2026-11-17

Cold-migrate Ubuntu services: check UIDs, Docker volumes and recovery

Establish a consistent backup and identity mapping before switching traffic. A working website is one check; database contents, proxy egress, scheduled jobs and boot recovery need separate verification.

Ubuntu 24.04 server migration PostgreSQL cold backup Docker volumes UID GID

Service eligibility and regional restrictions

PuppyIP serves only compliant overseas businesses and their authorized personnel. Proxy services are not available in mainland China. The service may only be used for lawful business activities outside mainland China. Use of this service within mainland China is prohibited.

Hosting a proxy IP or server overseas does not change these restrictions. The service must not be provided to end users in mainland China through relaying, forwarding, sharing or resale. Before use, read the Terms of Service.

Key Takeaways

  • Inventory actual database directories, WAL, tablespaces, volumes, runtimes and certificate-renewal configuration.
  • Stopping an application does not stop its database; shut down the database cleanly before an ordinary cold file copy.
  • Map native-service accounts by purpose; preserve container numeric ownership as required by the pinned image.
  • Once the new host accepts writes, preserve that new data before any rollback.

Inventory services and actual data locations

A host running websites, proxy cores, databases and containers needs more than application files moved. Map every service to its unit, working directory, ingress, database version, data directory, volumes and scheduler. Do not replace this inventory with one undifferentiated copy of the host filesystem.

An image’s default data path may differ from the path used by the running database. Compare runtime database locations with bind mounts, named volumes and anonymous volumes. Preserve an apparently unused volume until its role is confirmed; its name or an image default is not sufficient reason to delete it.

Read the container image and mounts

bash
CONTAINER='REPLACE_WITH_CONFIRMED_CONTAINER'
docker inspect --format '{{.Image}}' "$CONTAINER"
docker inspect --format '{{range .Mounts}}{{println .Type .Source .Destination}}{{end}}' "$CONTAINER"
Query a confirmed container on the old host. This does not export environment values, but mount paths still belong in a protected migration inventory.

Stop writers before taking a consistent cold copy

During a planned maintenance window, stop application writers, workers and scheduled tasks that can change data, then shut down databases and relevant containers cleanly. A closed website, blocked new connections or an inactive application unit does not establish that database files are ready for a cold copy.

A PostgreSQL physical backup must cover the complete cluster, including required WAL and external tablespaces, rather than selected table files. Restore with the original major version and required extensions and compatible runtime. Use supported upgrade or logical-backup procedures to cross major versions. Preserve Redis persistence files according to its actual configuration, not just whichever file looks newest.

Read locations in each PostgreSQL instance

text
SHOW server_version;
SHOW data_directory;
SHOW config_file;
Run in an authorized psql session connected to the correct instance. Inventory each cluster separately and keep real paths and connection credentials private.

Treat native accounts and container ownership separately

The same numeric UID or GID can belong to a different account on the new host. Map native-service accounts by purpose and adjust ownership only for that service’s confirmed data. Do not overwrite the new host’s account databases or recursively chown a shared business directory as one operation.

Container data must match the numeric identities expected inside the pinned image. Preserve actual image IDs, their tag mapping and each volume’s source and destination, then create durable Compose references. Avoid pulling a moving tag during restoration; otherwise the image, data format and startup behavior may all change together.

Restore into staging and start in dependency order

Keep the frozen copy in protected staging and check transfer status, size and the file inventory before restoring one service at a time. Bring up databases and caches first, confirm readiness, then start applications, workers and ingress. Never overwrite a directory that has already started accepting new data with a later bulk copy.

The following rsync command previews differences without writing files. Its destination must be an explicitly chosen new staging directory. Matching metadata is not a full content-hash comparison or business-data reconciliation; validate important data with the checks required by its backup procedure.

Preview cold-copy and staging differences only

bash
SNAPSHOT='/REPLACE_WITH_FROZEN_SNAPSHOT'
STAGING='/REPLACE_WITH_EMPTY_RESTORE_STAGING'
rsync -aHAXn --numeric-ids --itemize-changes -- "$SNAPSHOT/" "$STAGING/"
-n is dry-run. Keep it and do not add --delete. This does not restore data or replace database integrity checks.

Verify real behavior before and after switching DNS

Before switching, check A and AAAA records, Host/SNI, the certificate chain and callback URLs. Afterward, confirm external traffic reaches the new host, then test existing accounts, important data and required functions. Verify proxy egress with an actual authorized client request. A listening port or an HTTP 200 homepage does not prove those behaviors.

Restore running state and persistent enablement separately. A waiting timer, active cron daemon or existing script proves configuration is present, not that a job or certificate renewal succeeded. Inspect actual execution results. Recovery after a host reboot is a separate check; enabled state or a container restart policy alone does not prove it.

Read service, container and timer state

bash
UNIT='REPLACE_WITH_APPLICATION_UNIT.service'
systemctl show "$UNIT" -p ActiveState -p SubState -p Result -p UnitFileState --no-pager
docker ps -a --format 'table {{.Names}}\t{{.Status}}'
systemctl list-timers --all --no-pager
Reads configuration and current status. Data checks, actual proxy requests, completed scheduled jobs and reboot recovery remain separate checks.

Protect new writes before rolling back

Before the new host accepts writes, stop affected services and use the verified restoration plan to roll back. Once it accepts orders, configuration changes or other data, stop new writes, preserve the changes and plan reverse synchronization or recovery. Simply restarting the old database can fork the data or discard new records.

Retain the old host, frozen copy and pre-restore backup until data and application checks are complete. If migration used temporary SSH access, revoke only the exact public key added for that migration; do not replace the entire authorized_keys file. Protect inventories, backups and keys, and use placeholders in public documentation.

Sources

Frequently Asked Questions

Does a healthy Docker container prove migration is complete?

No. Check the actual database, existing accounts and data, proxy egress, scheduled job results and ingress switch separately.

Can I preserve native numeric ownership when usernames match?

Compare UID/GID and account purpose first. A number can map to another account; handle native-service and container data separately.

Does rsync exit code 0 prove every file is identical?

Not by itself. State the comparison options and scope, then validate backup integrity and application data.