Exclude mail folder from backup for all accounts

Arvy

Well-Known Member
Oct 3, 2006
139
10
168
Brazil
cPanel Access Level
Root Administrator
Twitter
Hi there!

How to exclude the mail folder from the backups but don't lost information about accounts (mail accounts, passwords, etc)? So, in a disaster recover (hd crash) cPanel will restore everything, including mail accounts and passwords, but not the email messages, webmail user folders, etc?

My users use only POP3, and they're adviced that cannot store remote email. But most users let 30 days of messages in the server to sync with cellphone, and I don't want to lost backup space with this.

I read about edit "/etc/cpbackup-exclude.conf" and add a single line "mail" at end. But I'm not sure if this is right and enough for what I need.

Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463

Arvy

Well-Known Member
Oct 3, 2006
139
10
168
Brazil
cPanel Access Level
Root Administrator
Twitter
Hello Michael,

that's the link I read. My idea is backup everything except the email messages. So, if I need to restore the machine from backups, users will still use POP/SMTP with their old passwords, but if access the webmail, will have no old messages, like a new mail account.

Which folders I need to exclude then? Probably "new" and "cur" folders. How can I configure cpbackup-exclude.conf for this?

Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463

WebHostPro

Well-Known Member
PartnerNOC
Jul 28, 2002
1,715
28
328
LA, Costa RIca
cPanel Access Level
Root Administrator
Twitter
Any luck finding out how to do this?

Thanks for the advice not to do this, but the time to restore emails is drastic when a restore is needed. We would prefer to back up email another way. Most emails are just junk people don't care about anyways that will take hours to restore that could be utilized to get accounts back quickly.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463

WebHostPro

Well-Known Member
PartnerNOC
Jul 28, 2002
1,715
28
328
LA, Costa RIca
cPanel Access Level
Root Administrator
Twitter
Thanks I read it but I still don't understand exactly.

Can you give an example?

1. I would look at the back up directory.
2. Check the server to see if each username is still there.
3. Then I would add the /home/username/ to the back up exclude file?

This is better then just deleting the account's directory because you don't have to wait for the folder to be deleted?

This is the best way as of now right?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Thanks for the advice not to do this, but the time to restore emails is drastic when a restore is needed. We would prefer to back up email another way. Most emails are just junk people don't care about anyways that will take hours to restore that could be utilized to get accounts back quickly.
If you are backing up email through another method, you could simply backup the full "/home/$username/mail" directory for each account using whichever backup method you prefer, and then exclude that directory from backups by adding this line to the /etc/cpbackup-exclude.conf file:

mail

Thank you.
 
Oct 8, 2013
19
1
3
New Richmond
cPanel Access Level
Root Administrator
Twitter
Any luck here ? My clients are advised that I'm not responsible for email lost. They have to backup them email on their own. The problem is that I have client with 10GB of email. I was really tolerant from many years, but my backup process now take 16 hours to complete. So I want to remove email from backup. My only problem is that like it's being already stipulated I do want a full restore to at least reinstall mailbox with password. In the event that my server crash and I need to reinstall 130 clients, I don't want to add back all them email account, but I will not take care of them email data.

From the inside of every account I see this :

.Archive
courierimapkeywords
courierimapsubscribed
courierimapuiddb
courierpop3dsizelist
cur
dovecot-acl-list
dovecot.index
dovecot.index.cache
dovecot.index.log
dovecot.index.log.2
dovecot-keywords
dovecot.list.index
dovecot.list.index.log
dovecot.mailbox.log
dovecot-quota
dovecot-uidlist
dovecot-uidvalidity
dovecot-uidvalidity.5603358b
.Drafts
.Junk
maildirsize
new
.Notes
.Sent
.spam
subscriptions
tmp
.Trash


what is needed inside of this to make sure it recreate the account ? Do I just add "mail" to cpbackup-exclude.conf or do I have to add

mail/*/.Archive
mail/*/courerimapkeywords
...

and just omit certain important files to make sure it recreate the account ?

Thank you.
 

WebHostPro

Well-Known Member
PartnerNOC
Jul 28, 2002
1,715
28
328
LA, Costa RIca
cPanel Access Level
Root Administrator
Twitter
Yeah exactly, it just makes restoring back ups take an extra 10-15 hours on a full server. I would rather have an easy way for customers to back up mail or a manual way in the WHM. To do it in the backups makes a bad situation horrible.

And no I haven't found a way to block it yet. rsync doesn't allow the formats that email uses to name files. The names are like 124.554.username.344.mail some crazy stuff like this, I can't tell rsync to ignore.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Hello @jonathanlafleur,

The email account information is stored in the account's "/home/$username/etc" directory, so you'd want to exclude the files within each directory that includes actual email data. Here's an example of how the lines would look in the cpbackup-exclude.conf file:

Code:
mail/*/*/cur/*
mail/*/*/new/*
Add additional entries for any other directories where email is stored (e.g. .Junk, .Sent). I also encourage you to open a feature request for the ability to manage email exclusion via an option in the UI:

Submit A Feature Request

Thank you.