Skip to content

Backing up cPanel databases without backing up the home directory

When and how to take a database-only backup of a cPanel account — for pre-migration snapshots, daily fast restores, or compliance scenarios — without bundling the home.

A full account backup of a 200 GB cPanel customer takes hours. A database-only backup of the same customer’s 4 GB MySQL takes minutes. Database-only is the right granularity for cases where the home is stable but the database changes constantly: high-write CMS deployments, transactional sites, applications where the data is the asset and the code is in git.

What’s happening

JetBackup supports configuring jobs with selective scope. A database-only job runs against each cPanel account’s MySQL databases (and PostgreSQL if enabled), produces dumps, and writes to a destination. It bypasses the home directory and mail. The result is a much faster job that can run more often — hourly database backups become practical.

How to verify

Confirm what databases exist per account and their sizes:

mysql -e "SELECT table_schema, ROUND(SUM(data_length+index_length)/1024/1024,1) AS MB FROM information_schema.tables GROUP BY table_schema"
whmapi1 list_mysql_databases_and_users user=<user>
ls /var/lib/mysql/<user>_*
du -sh /var/lib/mysql/<user>_*

Databases over 10 GB benefit most from frequent database-only backups; databases under 100 MB don’t need a separate job.

The fix

  1. Create a dedicated JetBackup job in WHM > JetBackup 5 > Backup Jobs > Add. Set “Type of Backup” to include only Databases. Disable Home, Email, DNS, etc.
  2. Schedule it more frequently than the full backup. Hourly for high-write sites; every 4 hours for typical commerce; daily for static-content sites.
  3. Use a different destination directory than the full backup. dest_id for full + dest_id for database-only — gives separate retention scopes.
  4. Verify dumps occasionally by restoring one to a scratch MySQL: mysql --execute "CREATE DATABASE test_restore" && mysql test_restore < dump.sql. A backup that doesn’t restore is theoretical.
  5. Document the recovery procedure. For a database-only restore, the customer also needs the matching application code — make sure git or the home backup is consistent with the database snapshot.

Stack Harbor designs backup tiering to match RPO/RTO requirements as part of environment management.