Skip to content

Bandwidth accounting after a whmtransfer — why the new server shows zero usage

After a WHM transfer, the customer's monthly bandwidth shows zero on the destination. The data is in the archive; cPanel just doesn't re-import it automatically.

A customer is moved from the old WHM to the new one on the 15th of the month. The transfer succeeds. The customer logs in and sees their bandwidth at 0 bytes for the month — they were at 18 GB on the old server the day before. They assume something is broken; the team assumes the data didn’t transfer. The truth is that bandwidth history is in the archive, but cPanel doesn’t reimport it on restorepkg unless you tell it to. The mid-month transfer effectively gives the customer a free month — or a missed billing event, depending on how you look at it.

What’s happening

pkgacct includes bandwidth history files (/var/cpanel/bandwidth/<user>.bw) in the archive. restorepkg copies them to the destination’s /var/cpanel/bandwidth/, but the daily summarization daemon cpanellogd doesn’t recompute totals from imported history files on its own. The current-month total in WHM is computed from the source Apache and Exim logs; on the new server, those logs start at zero. The history file is present but not reflected in the live counter.

How to verify

Compare the on-disk bandwidth file with what WHM is reporting:

ls -la /var/cpanel/bandwidth/acme.bw
cat /var/cpanel/bandwidth/acme.bw | head -5
whmapi1 get_bandwidth_usage_for_user user=acme
whmapi1 accountsummary user=acme
ls /usr/local/apache/domlogs/acme/

The .bw file should contain bandwidth records for prior months. The accountsummary output for totalbytes is the live counter — it can be zero on the destination even when the file is present.

The fix

  1. After the restore, force a bandwidth recompute: /usr/local/cpanel/scripts/update_bandwidthdb. The script reads the per-user bandwidth files and rebuilds the WHM-visible totals.
  2. For mid-month transfers specifically, decide your billing policy first. If the customer’s bandwidth allowance is monthly and the source already counted their usage, importing it preserves the cap. If you treat the transfer as a billing reset, leave the import out — but tell the customer.
  3. Set the source server to read-only before the transfer if you want a clean cutover. The customer’s domlogs on the source stop accruing once Apache is told to stop logging; the bandwidth count freezes; the transfer captures a final state.
  4. For the destination, run a one-time sync of the source’s recent domlogs if your billing requires it. Rsync the last seven days of /usr/local/apache/domlogs/<user>/ from source to destination, then run update_bandwidthdb.
  5. Document the policy in your transfer runbook. “Mid-month transfers reset bandwidth” vs “Mid-month transfers preserve bandwidth” is a customer-facing question; the answer must be the same every time.

For shops where transfers happen regularly, Stack Harbor’s cPanel server management practice writes the bandwidth-handling step into the standard transfer runbook so the policy is consistent across every move.