Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk9 min

How to Migrate a Stateful Docker App Off a Server With a Failing Disk

Recreating containers is the easy part of moving a Docker app. This guide covers inventorying state, making consistent database and volume copies, restoring, verifying, and cutting over without losing data.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Moving a Docker app to a new server is two jobs. Recreating the containers from your Compose files is the easy one. Getting the app’s state, meaning its database, uploads, configuration and secrets, onto the new host in a consistent form is the one that decides whether you keep your data. Do the state first, verify it, and only then recreate and cut over.

If the disk is still readable, copy the data while the application is quiet or stopped. For a database, use the database’s own dump and restore tools, or a stopped-server file copy. Copying a live database’s files while it writes is the usual way to end up with a backup that restores but is internally inconsistent.

As an Amazon Associate I earn from qualifying purchases.

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

Reduce writes and record what you are running

If the disk is deteriorating, the first goal is to stop generating unnecessary writes. Avoid large rebuilds, image pulls, log-heavy debugging, and maintenance jobs that rewrite data. Do not run filesystem repair tools on a disk that is already returning I/O errors without first having a copy of what matters; a repair run can make a marginal situation worse. This article covers planned migration, not recovery from a disk that is actively losing data.

Then record the deployment so you can rebuild it elsewhere. Run these on the current host and save the output off the failing disk:

#1 Best Overall
Sale
Samsung T7 Portable SSD 1TB Titan Gray, USB 3.2 Gen 2, Up to 1,050MB/s | Reliable External Solid State Drive Storage for Gaming, Students, Professionals (MU-PC1T0T/AM)
  • MADE FOR THE MAKERS: Create; Explore; Store; The T7 Portable SSD delivers fast speeds and durable features to back up any endeavor; Build your video editing empire, file your photographs or back up your blogs all in an instant
  • SHARE IDEAS IN A FLASH: Don’t waste a second waiting and spend more time doing; The T7 is embedded with PCIe NVMe technology that brings fast read and write speeds up to 1,050/1,000 MB/s¹, making it almost twice as fast as the T5
  • ALWAYS MAKE THE SAVE: Compact design with massive capacity; With capacities up to 4TB, save exactly what you need to your drive – from large working files to game data and everything in between
  • ADAPTS TO EVERY NEED: Whether using a PC or mobile phone, count on the T7 for extensive compatibility²; It’s a true team player when it comes to heavy-duty application usage or file-saving
  • HI RESOLUTION VIDEO RECORDING: Record Ultra High Resolution (4K 60fs) videos directly onto the T7 Portable SSD with your favorite camera or mobile devices; Supports iPhone 15 Pro Res 4K at 60fps video and more³
  • docker compose ls and docker compose -f /path/to/compose.yaml config to capture the fully resolved configuration, including interpolated environment values.
  • docker compose ps --format json to record image tags, published ports and restart policies.
  • docker volume ls to list named volumes, and docker inspect -f '{{ json .Mounts }}' CONTAINER_NAME for each container to see the source and destination of every volume and bind mount.
  • The contents of every .env file, secrets files, and any TLS or key material the app reads from the host.
  • The application’s own backup documentation, copied to a location that is not the failing disk.

Keep in mind that a volume name tells you almost nothing about what is stored in it. Before you copy anything, confirm which application or database writes to each volume, and whether that software can be backed up while running.

Find every place the application keeps state

Named volumes are only part of the picture. Compose bind mounts, anonymous volumes, and application-specific paths outside Docker can each hold data you cannot afford to lose. A useful inventory covers these categories:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Database files: the data directory of PostgreSQL, MySQL/MariaDB, MongoDB or another engine, in a named volume or a bind mount.
  • User uploads and attachments: media folders, document stores, and object-storage caches on local disk.
  • Configuration and secrets: environment files, config files mounted read-only into containers, API keys, and signing or encryption keys.
  • Repositories and generated content: git repositories, search indexes, and build outputs the app treats as authoritative.
  • Queues and scheduled work: job queues or cron state that determines whether background work resumes correctly.

OpenProject’s migration guide is a useful model because it treats the migration as several datasets: a database dump, attachments, configuration and secrets, and repository data where the installation uses it. Your app will differ, but the checklist shape is the same.

Rank #2
Sandisk 2TB Extreme Portable SSD, Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware, External Solid State Drive, SDSSDE61-2T00-G25
  • Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
  • Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
  • Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
  • Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
  • Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C

Choose a copy method for each dataset

There are four workable approaches. They differ mainly in consistency guarantees, downtime, and how much you can verify afterward.

Method Best for Consistency Downtime Verification
Application or database native dump and restore Databases and apps with an export feature Consistent as of the dump, when the tool takes it in a transactional way Usually a write freeze while the dump runs; length depends on data size Restore into the new host and run the app’s own checks
Stopped database file copy Large database clusters where a dump is slow Usable only if the server shut down cleanly; PostgreSQL 17 documentation states the server must be shut down to get a usable file-level backup Full stop of the database for the copy Start the restored cluster and check it
Consistent filesystem snapshot or staged rsync Large data on filesystems that support atomic snapshots Only when the database’s snapshot requirements are met; all files must be captured together, including WAL where the engine requires it Short if snapshots are taken correctly; a stop is still needed for a final sync in some engines Restore to a test host before relying on it
Docker volume archive Uploads, attachments, and other non-database volume contents A transfer mechanism. It does not by itself make a running database’s files consistent Stop the writing container for the archive Check the archive is readable and restore into a test volume

For most self-hosted stacks, the database should go through its native dump or a stopped-server copy, and the uploads should go through a volume archive or file copy with the application stopped. Mixing those, with a dump taken at one time and uploads taken at another, can leave the database and files out of step. Take them within the same quiet window and note the time.

Why live copies of database files are risky

A running database keeps data in memory, in write-ahead logs, and in data files that are updated at different moments. Copying those files while the server runs captures a moment that may never have existed on disk as a single state. PostgreSQL’s documentation on file-system-level backups states that a raw copy is only usable if the server is shut down, unless you use a supported consistent snapshot method. If the data spans more than one filesystem, the snapshots must be taken at the same instant, and the write-ahead log needed to replay them must be included. Other engines have their own rules. Check the documentation for yours before assuming a live copy will restore.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
SSK Portable SSD 250GB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 250GB external ssd often appears as around 232GB on Windows. MacOS can show full 250 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity

Prepare the destination host

  1. Provision a server with enough free disk for your measured data size plus room for the archives and the restored copy. Measure with du -sh on each bind mount directory and docker system df -v for volumes, rather than guessing.
  2. Install Docker Engine and the Compose plugin following Docker’s official instructions for the destination operating system.
  3. Use the same major version of the database and the same application version as the source. A different major version means an upgrade step, covered below, and should not be combined with the host move on the first attempt.
  4. Recreate the Compose project from your saved configuration, but do not start it yet against live data. Keep the same project name if you want volume names to match.
  5. Create destination volumes and bind-mount directories deliberately with docker volume create DEST_VOLUME and mkdir -p. A new, empty volume lets the application start cleanly with no data, which looks like success until users report missing records.
  6. Make sure the old and new hosts cannot both accept writes. Stop the new stack’s public endpoint or firewall it until cutover.

Make the final consistent copy

Plan a maintenance window. Its length depends on your data size and how long the application takes to stop cleanly, so measure it on a test copy before the real move if you can.

  1. Announce and stop writes. Put the application in maintenance mode if it has one, then stop its writing containers. On Compose use docker compose stop SERVICE rather than docker compose down -v, which removes containers and the volumes must not be removed.
  2. Dump the database with its own tool. For PostgreSQL in a Compose service named db, a custom-format dump looks like this:
    docker compose exec -T db pg_dump -U DB_USER -Fc DB_NAME > /mnt/backup/db-$(date +%F).dump
    Confirm the dump file is not empty and can be listed with pg_restore --list. Other engines have their own dump tools; use the one your application documents.
  3. Archive non-database volumes. A helper container can read a source volume read-only and write a tar archive to a backup directory:
    docker run --rm -v SOURCE_VOLUME:/source:ro -v /mnt/backup:/backup alpine tar czf /backup/SOURCE_VOLUME.tar.gz -C /source .
    Use an image tag you have pinned and tested. Running the helper as root keeps file ownership inside the archive.
  4. Copy bind-mounted directories and configuration. Use rsync -a or a comparable method that preserves ownership, permissions, and timestamps. Copy the configuration and secrets files as well.
  5. Move the backups off the failing disk. Copy them to a different physical device or to a remote destination. An archive stored only on the failing disk is not an independent backup.
  6. Verify before you rely on it. Record checksums with sha256sum on the source, recheck them on the destination after transfer, and list each archive with tar tzf to confirm it is readable.

Optional: where to stage the backup

Staging space can be a second internal disk, a network share, a remote object store, or a portable external drive. Choose capacity from the measured size of your data plus the dump and archive copies, and keep at least one copy off the failing host.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Restore and check the application before cutover

Restore each dataset to its intended destination. The database goes through its restore tool into the database volume; uploads and attachments go to their expected volume or bind mount; configuration and secrets go to the same environment files the Compose project reads. For example, a custom-format PostgreSQL dump restores with pg_restore --clean --if-exists -U DB_USER -d DB_NAME /mnt/backup/db.dump into a running database service on the new host.

Rank #4
Sale
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.

Keep the application’s secret values unchanged where the app documents them as part of session or token continuity. OpenProject’s guide warns that changing its SECRET_KEY_BASE invalidates existing sessions and can disrupt some tokens. Other applications behave differently, so read your own documentation before you regenerate any key.

Start the restored stack and check it in this order:

  • Container status and health checks with docker compose ps, followed by logs with docker compose logs --tail 200 for each service.
  • Sign-in with an existing account, and a sign-in that uses a session created before the move if you have one.
  • Representative records: open a recent item, a historic one, and one that links to other records.
  • Uploaded files and attachments: open a file and confirm its checksum matches the source where the app exposes it.
  • Background jobs: confirm queued work runs and scheduled tasks fire, since OpenProject’s migration checks include background-job behavior.

Only treat the migration as complete when these checks pass on the new host. A container that says it is running does not show that the data is correct.

Best Value
Sale
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model | External Solid State Drive, IP65 Water & Dust Resistant, Up to 3M Drop Protection, 256-bit AES Encryption, USB-C 3.2 Gen 2
  • NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
  • IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
  • POCKET-SIZED – fits easily in pockets and small bags.
  • SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
  • 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.

Cut over and keep the old host recoverable

Once the new instance passes the application checks, switch DNS, the reverse proxy, or the load balancer to the new host. The exact steps depend on your deployment. The sources behind this guide do not establish how long DNS changes take to propagate, or how long a rollback window should last in your environment. Work those values out for your own setup and test the rollback path before you need it.

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

Keep the old host stopped or read-only but intact until the new instance has run long enough to be trusted. If both hosts accept writes, a rollback can overwrite good data or leave two divergent histories. If you must roll back, prefer restoring the old host from the dump you took before cutover, and reconcile any writes made on the new host by hand.

If the move also changes database major versions

A raw data-directory copy only works between compatible server versions. Moving to a new major version is a separate operation. PostgreSQL’s pg_upgrade has version-specific constraints, and its link mode has consequences: after linking, the old cluster can no longer be safely started, so it is not a rollback path. If you need both a host move and a major upgrade, do the host move on the same version first, verify it, then upgrade on the new host with a tested procedure. Keep a fresh dump from before the upgrade.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.