cPanel: Exclude Directory during Backup
Backup is the first thing-to-do and should not be forgotten by a good system administrator. Since cPanel has their built-in backup creator as well as backup management system, we can take advantage of this tool and use them to suit our needs. In my situation, we have many cPanel accounts and some of them is higher than 10GB of disk usage, mostly due to website uploaded contents.
Creating backup will be a hard thing if you have too many inodes or too much disk consumption. It is a good thing if we can exclude some of the directory for example user_uploaded when creating cPanel backup, and the rest can be backup manually by downloading them to a local server.
In this tutorial I will create a full backup what some directories being excluded. Variables as below:
OS: RHEL 4 32bit
cPanel account: premen
Home directory for user: /home/premen
1. Identify the directory that we want to exclude. In this case, I will exclude the high disk storage directory. Using following command might help:
$ cd /home/premen $ du -h | grep G |
The command should list all directories which more than 1GB of size. Example as below:
6.4G ./public_html/portal/tmp 8.7G ./public_html/portal/user_uploaded 15.1G ./public_html |
2. Then we need to generate a file called cpbackup-exclude.conf under respective home directory of the user as refer to cPanel documentation at here:
$ cd /home/premen $ touch cpbackup-exclude.conf $ vi cpbackup-exclude.conf |
Paste following line:
public_html/portal/tmp public_html/portal/user_uploaded |
3. Now we will create the backup either via pkgacct script:
/usr/local/cpanel/scripts/pkgacct premen /home userbackup |
or you can click “Download or Generate a Full Website Backup” under cPanel as screenshot below:
Once the backup ready, you will notice that both directories have been excluded from the cPanel full backup and your backup size should be smaller and faster to be compressed. Cheers!
Related Posts
- CentOS: Restore/Recover from Amanda Backup
- High Availability: cPanel with MySQL Cluster, Keepalived and HAProxy
- cPanel with CentOS 6 as Internet Gateway
- CentOS: Install and Configure Amanda Backup Server
- Install OpenFiler from USB Drive
- CentOS: ClamAV Scanning on FTP Service
- MySQL: Live Backup using LVM Snapshots
- cPanel: Auto Backup and Remote Transfer using API + PHP
- cPanel: Trigger Alert from Munin
- cPanel: Install PHP SSH2 Module
Sci/Tech – Google News- Privacy officials raise concerns over Glass - swissinfo.ch 19 June 2013
- Samsung might make the next Facebook phone following HTC First disaster - Inquirer 19 June 2013
- Huawei Ascend P6, world's thinnest smartphone, unveiled! - Business Today 19 June 2013
- World Bank warns of economic impact of climate change - Deutsche Welle 19 June 2013
- Video: Moment Volcano in Mexico erupts sending ash three miles high - Irish Independent 19 June 2013

