Skip to content

Reading a cpmove archive without extracting it

How to inspect the contents of a cpmove-user.tar.gz before restore, identify what's included, and catch a corrupted archive before you wait an hour to find out.

A cpmove archive arrives from a migration source. Before queueing it for restore, it’s worth ten minutes to confirm what’s in it and that the tar isn’t corrupted. The cost of a failed restore midway through is high; the cost of tar -tzf is two minutes.

What’s happening

A cpmove archive is a structured tar.gz with predictable top-level entries: cpmove-<user>/homedir.tar, cpmove-<user>/mysql/, cpmove-<user>/mail/, cpmove-<user>/dnszones/, cpmove-<user>/userdata/. Each section corresponds to a part of the cPanel account. Missing or zero-byte sections indicate that pkgacct on the source didn’t capture cleanly.

How to verify

Inspect without extracting:

tar -tzf cpmove-<user>.tar.gz | head -50
tar -tzf cpmove-<user>.tar.gz | grep -E 'homedir|mysql|mail|dnszones'
tar -tzf cpmove-<user>.tar.gz | wc -l
gzip -t cpmove-<user>.tar.gz
ls -lh cpmove-<user>.tar.gz

gzip -t validates the gzip envelope. A failure here means the archive is corrupted at transport — re-download or re-create.

The fix

  1. Validate the gzip first. gzip -t is fast and definitive. If it fails, the archive is unusable and there’s no point inspecting further.
  2. Check the top-level structure with tar -tzf | head -50. You should see cpmove-<user>/ as the root and the section directories beneath.
  3. Confirm the major sections are present: homedir.tar (the home), mysql/<db>.sql files (databases), mail/<domain>/ (mail), dnszones/<domain>.db (DNS).
  4. Spot-check a known file. If the source account had a specific file, tar -tzf cpmove-<user>.tar.gz | grep <known-path> confirms it made it into the archive.
  5. Estimate restore time. tar -tzf | wc -l gives the file count; multiply by your server’s tar restore rate (typically 200-500 files/second) for a rough estimate. Account for the database import step separately.

Stack Harbor inspects cpmove archives before every restore as part of migration services.