Skip to content

Migrating a cPanel account between filesystems with quotas enabled

Quota inheritance during a transfer is filesystem-specific. ext4 quotas, XFS project quotas, and ZFS quotas each have a different propagation story; getting it wrong gives the customer no warning until they hit the cap.

A cPanel account is moved from a server with ext4 quotas to a server with XFS quotas (or vice versa), and a week later the customer reports they can’t upload past 25 GB even though the package shows 50 GB. The quota was set on the source filesystem; the transfer carried the cPanel-side limit but the filesystem-side enforcement didn’t follow. cPanel quotas come from two layers — what cPanel thinks the limit is, and what the kernel actually enforces on the inode — and they have to be re-synchronized on the destination.

What’s happening

cPanel’s quota system on Linux delegates enforcement to the filesystem. On ext4, quotaon tracks usage by UID against aquota.user files. On XFS, project quotas (preferred for cPanel) bind a quota to a directory subtree by project ID. On ZFS, quotas live in dataset properties. When you pkgacct from one and restorepkg to the other, cPanel re-runs its quota init on the destination but uses the cPanel-stored value (the package limit), not whatever was on the source filesystem. If the package limit and the kernel limit diverged on the source (because someone ran setquota manually), the destination will only have what the package says.

How to verify

On both source and destination, compare cPanel’s view and the kernel’s view:

whmapi1 accountsummary user=acme
quota -u acme
xfs_quota -x -c "report -p" /home
zfs get refquota tank/home/acme
repquota /home | head -5
grep DISK /var/cpanel/users/acme

The accountsummary shows what cPanel believes is the quota. The kernel quota tool shows what’s actually enforced. They should match; when they don’t, one of them is wrong.

The fix

  1. On the source, snapshot the kernel-enforced quota before packaging: repquota /home > /tmp/quota-snapshot-$(date +%F).txt. If you discover a divergence post-restore, this is your “what it was” reference.
  2. Run pkgacct normally. The cPanel package value is what travels in the archive.
  3. On the destination, after restorepkg, force a quota init: whmapi1 quota_update user=acme or /scripts/fixquotas. The latter rebuilds the kernel quota database from the cPanel user files for every account on the box.
  4. Validate the post-restore state: quota -u acme should show the package limit; repquota should show the same; accountsummary should agree. Three-way agreement is the success condition.
  5. For filesystem transitions (ext4 to XFS, XFS to ZFS), test the package limit by running du -sh /home/acme and confirming the visible usage is below the limit. If the source had ext4 group quotas and the destination uses XFS project quotas, the migration is converting two different counter philosophies; the package limit is the only safe baseline.
  6. Watch the first 24 hours of customer activity for quota-cap reports. If the customer reports they can’t write past a lower bound than the cPanel limit, the kernel quota is wrong — re-run /scripts/fixquotas and confirm.

Quota migration across filesystem boundaries is the kind of detail Stack Harbor’s cPanel and WHM management practice catches at the discovery stage so customers don’t experience a silent regression after the move.