Backing up the entire home directory is the safe default, but it’s not the fastest or cheapest. A typical cPanel account has 20-40% of its bytes in directories that regenerate from source: caches, build artifacts, sessions, lock files. Excluding them shaves the backup window noticeably.
What’s happening
Common regenerable directories on cPanel: wp-content/cache/, wp-content/uploads/cache/ (some plugins write here), vendor/ (Composer rebuilds from composer.lock), node_modules/ (npm rebuilds from package-lock.json), ~/tmp/ (sessions, lock files), Magento var/cache/ and var/page_cache/, all .cache directories, application-specific compiled view caches.
Excluding them is safe if the application can rebuild from source. It’s not safe if the customer is treating the cache directory as canonical (rare but does happen on legacy WordPress installs).
How to verify
Inspect what’s there:
du -sh /home/<user>/public_html/wp-content/cache 2>/dev/null
du -sh /home/<user>/public_html/vendor 2>/dev/null
du -sh /home/<user>/public_html/node_modules 2>/dev/null
find /home/<user> -type d -name 'cache' 2>/dev/null
These are the bytes you’d shed by excluding. If the total is more than 500 MB, the exclusion is worth configuring.
The fix
- Edit the JetBackup job: WHM > JetBackup 5 > Backup Jobs > Edit > Exclude Files/Folders. Add patterns:
wp-content/cache/*,vendor/*,node_modules/*,var/cache/*,var/page_cache/*,tmp/*. - Use absolute-style patterns relative to the home: JetBackup interprets exclusions per account.
- Don’t exclude application code or user-uploaded media. The decision: “would this be reconstructable from the package manager or build pipeline?” If yes, exclude. If it’s customer-uploaded content, include.
- Document the exclusion list in the runbook. Operators restoring from this backup need to know they have to run
composer install,npm install, or equivalent after restore to repopulate the excluded directories. - Test the restore flow with the exclusions in place. A restore that doesn’t include the build artifact directories leaves the application running until the next cron-driven cache regen — which may be fine, or may be 24 hours of broken site.
Stack Harbor tunes backup exclusion lists per application as part of environment management.