Partial Backup/Restore - Exclude Email

jethrodesign

Well-Known Member
Feb 17, 2012
50
1
58
cPanel Access Level
Root Administrator
Hi. We use cPanel partial backups ('Home' & 'Database') to keep versions of sites as backups, to transfer sites, etc. Most of the time this works really well.

But we have a couple sites that have a HUGE amount of email (multiple GB) that choke up the backup process. It either takes forever or times out. We just need backups of the sites in an easy way, not the email.

1) Is there any way to exclude the email from a 'Home' backup? I read that this can be done for 'Full Backups', but those can't be restored easily (correct?), so kind of defeats the purpose.

2) We also want to migrate a site from one cPanel account to another. The source does not have email created (it was a temp development account), but the destination does have a huge amount of email (5GB+). If we do a 'Home' backup on the source (with no email), then restore on the destination, will it delete all existing email?

Thanks for any tips or advice here!
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,110
660
263
Houston
cPanel Access Level
DataCenter Provider
Hi @jethrodesign

1) Is there any way to exclude the email from a 'Home' backup? I read that this can be done for 'Full Backups', but those can't be restored easily (correct?), so kind of defeats the purpose.
You can exclude pretty much anything you'd like from the automated backup system. The documentation here should be helpful for that: How to Exclude Files From Backups - cPanel Knowledge Base - cPanel Documentation

You can also restore through WHM: Restore a Full Backup cpmove File - Version 78 Documentation - cPanel Documentation

2) We also want to migrate a site from one cPanel account to another. The source does not have email created (it was a temp development account), but the destination does have a huge amount of email (5GB+). If we do a 'Home' backup on the source (with no email), then restore on the destination, will it delete all existing email?
In this case if you have the same user for the backups you could potentially use the file and directory restoration tool: File and Directory Restoration for cPanel - Version 78 Documentation - cPanel Documentation
 

jethrodesign

Well-Known Member
Feb 17, 2012
50
1
58
cPanel Access Level
Root Administrator
Hi, thanks for the reply!

1)
You can exclude pretty much anything you'd like from the automated backup system. The documentation here should be helpful for that: How to Exclude Files From Backups - cPanel Knowledge Base - cPanel Documentation
I had read that article. It specifically states:
  • If you initiate a Home Directory backup in cPanel's Backup interface (cPanel >> Home >> Files >> Backup), the global and local exclude files do not affect the contents of the backup file.

We are hoping to be able to use manually-created backups, not our normal automated full backups setup through WHM. We just need to be able to choose exactly when a particular backup occurs, than store it indefinitely with the date & some details as part of the filename so we don't forget. The automated backups only occur on their regular schedule and are eventually rotated out, so not a great option.

Also, having the files & database separate, using the cPanel Backups feature, helps allow us to only restore what's necessary. We often make these backups before we do any major software updates, for instance, so we can restore quickly if something goes awry.

- Basically, we ONLY need the contents of the 'public_html' directory, along with the database, to quickly restore or move sites. All of the other contents of the 'home' directory (stats, email, caches, etc.) are not needed or relevant when just trying to migrate or restore a site. We also do not want to make any DNS changes that might typically happen with a true 'migration'.

- If this can't really be configured or automated, would I have to manually zip all of the contents of 'public_html', download them to store locally, then upload and replace contents of destination cPanel account's 'public_html' directory to complete the process (along with database backup when relevant)?

2)
In this case if you have the same user for the backups you could potentially use the file and directory restoration tool:
These are separate cPanel accounts, and therefor separate cPanel users (if that's what you mean).

- What is the default behavior if restoring a cPanel 'Home' partial backup that does NOT contain email to another cPanel account that DOES have email?

I was under the impression that it would only append email/files if not present, not completely erase or replace, but could be wrong.

THANKS!
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,110
660
263
Houston
cPanel Access Level
DataCenter Provider
I had read that article. It specifically states:
  • If you initiate a Home Directory backup in cPanel's Backup interface (cPanel >> Home >> Files >> Backup), the global and local exclude files do not affect the contents of the backup file.
Yes which is why I noted that this could be done with the automatedd backup system in my response not manually.

These are separate cPanel accounts, and therefor separate cPanel users (if that's what you mean).
I'm not sure there's a method of backups that will work for routinely restoring backups from another server/user like you're requesting. If it was a matter of just needing to restore from manual backups you've taken on the account itself the file and directory restoration feature would work for you.

What is the default behavior if restoring a cPanel 'Home' partial backup that does NOT contain email to another cPanel account that DOES have email?
A partial backup would include the /home directory which would in turn always include mail though. What you might want to look into in this case is rsync most likely - or manually create a compressed file of just the public_html of the other account, then use that to restore from if necessary.
 

jethrodesign

Well-Known Member
Feb 17, 2012
50
1
58
cPanel Access Level
Root Administrator
OK, thanks for the clarification. Looks like we'll have to do manual compressing & transferring of the 'public_html' directory in these cases.

But just a little more clarification on the second issue if that's OK, in case something happens in the future.

A partial backup would include the /home directory which would in turn always include mail though.
Could you just verify the following scenarios so I fully understand what to expect:

A) If the 'Home' backup had no stored mail, or created mail accounts (and their corresponding sub-directories), then any mail and individual accounts on the destination would be CLEARED out so that the destination would match the source exactly, correct?!?

B) If the 'Home' backup was from the existing cPanel account and made say a month ago, and it DID include email and most/all email accounts, would it clear out any stored email in the destination (including email received in the month since the backup was taken) so it would match the source exactly?!?


Thanks. We just want to be sure in case we need to restore a backup due to a site being hacked, or software upgrade causing failure, and be more assured what will happen with the email part of it.