Child pages
  • Backup Configuration FAQ
For cPanel & WHM version 76

Skip to end of metadata
Go to start of metadata

What are my backup options?

You can configure backups for your server in WHM's Backup Configuration interface (WHM >> Home >> Backup >> Backup Configuration). This interface allows you to configure the way in which backups run on your server.

What does the system store in a backup?

System backup files include system files and directories. 

Account backup files include home directory contents, databases, email and email settings, DNS records, and other account-related information.

Which files does each cPanel user's backup include?

After you enable account backups, the backup process runs as the cPanel user who owns the backed-up data. The system does not back up anything that a user does not own and cannot access.

  • The system includes all of the files that the user owns in the backup.
  • The system includes any files that the user does not own but has access to in the backup.

Can I select specific users' accounts to back up?

Use WHM's Backup User Selection interface (WHM >> Home  >> Backup >> Backup User Selection) to select specific cPanel accounts to back up.

How does the system back up DNS zones?

If you use a DNSONLY™ cluster, the pkgacct script examines all of the DNS zones in the DNS cluster to find the record with the newest serial number. It then stores that DNS zone in the backup.

By default, backups are cluster-aware and pull the account's zone from the DNS cluster itself. To pull the account's zone from the local machine, enable the Use Local DNS option in WHM's Backup Configuration interface (WHM >> Home  >> Backup >> Backup Configuration).

How can I use the rsync script with a cPanel & WHM backup?

We do not support backup procedures that use the rsync script.

While it is possible to use the rsync script with cPanel & WHM backups, we strongly recommend that you use cPanel-provided tools to ensure reliable backups. Under certain conditions, the rsync script may corrupt SQL database backups.

Which scripts run backups?

The following scripts are the main scripts that run backups:

/usr/local/cpanel/bin/backup
/usr/local/cpanel/scripts/pkgacct
For more information, read our The pkgacct Script documentation.

Where does the system store backup logs?

The system stores backup logs and backup error logs in the /usr/local/cpanel/logs/cpbackup/ directory. The log filenames correspond to the second at which the system created them, in Unix epoch time.

For more information about log files, read our The cPanel Log Files documentation.

Where does the system store backups?

You can select the location in which you wish to store backups in the Configure Backup Directory section of WHM's Backup Configuration interface (WHM >> Home  >> Backup >> Backup Configuration).

Note:

You must provide an absolute path to the local backup directory.

 

Use the BACKUPDIR variable to retrieve the system's current setting from the /etc/cpbackup.conf and /var/cpanel/backups/config files, as in the following example:

: awk '/BACKUPDIR/{print FILENAME": "NR": "$0}' /etc/cpbackup.conf
/var/cpanel/backups/config
/etc/cpbackup.conf: 8: BACKUPDIR /backup
/var/cpanel/backups/config: 28: BACKUPDIR: /backup

What does the system back up when I select configuration files? Where can I find the backups?

When you back up configuration files, the system automatically stores the files in the dirs and files directories. When you back up the entire MySQL directory, its contents are stored in the dirs directory.

cPanel & WHM backs up the following files and directories:

Files

/etc/exim.conf
/etc/exim.conf.local
/etc/exim.conf.localopts
/etc/named.conf
/etc/named.conf
/etc/proftpd.conf
/etc/pure-ftpd.conf
/etc/localdomains
/etc/apache2/conf/httpd.conf 
/etc/group
/etc/shadow
/etc/passwd
/etc/fstab
/etc/ips
/etc/ips.remotemail
/etc/ips.remotedns
/etc/reservedips
/etc/reservedipreasons
/etc/quota.conf
/etc/wwwacct.conf
/etc/remotedomains
/etc/rndc.conf
/etc/secondarymx
/etc/my.cnf
/root/.my.cnf
/etc/apache2/conf/httpd.conf

Directories

/etc/cpanel
/etc/named
/etc/valiases
/etc/proftpd
/etc/vdomainaliases
/etc/ssl
/etc/vfilters
/usr/local/cpanel/3rdparty/mailman
/var/lib/rpm
/var/named
/var/cpanel
/var/spool/cron
/var/cpanel/bandwidth
/var/cpanel/ssl
/var/lib/mysql 
/etc/pki/tls/certs/

Custom files

To configure system backups to include custom files or directories, create a new file or directory in the /var/cpanel/backups/extras directory (for example, /var/cpanel/backups/extras/etc). In that file, enter an absolute path to any files that you wish to back up (for example, /etc/example.conf).

Note:

The server administrator can edit the /etc/my.cnf file to change the MySQL data directory location. The system will back up the directory at its new location.

Can I run backups to locally mounted remote filesystems?


Warning:

  • If you use a mounted filesystem to store backups, we strongly recommend that you mount the system with the noexec option. If you pass the noexec parameter to the mount parameter, the binaries cannot run on the mounted filesystem.
  • We strongly recommend that you do not perform backups to remote filesystems (for example; NFS, CIFS, smbfs, or other types of network drive systems). While you can store a backup directly to a remote filesystem, cPanel & WHM does not support this configuration. We strongly recommend that you work with a qualified system administrator to manage this custom backup path to avoid potential risks.

You can configure a file system to use the noexec option by default. To do so, edit the /etc/fstab file. This file contains a list of mountable file systems and their configuration options.


To configure a mountable file system that automatically uses the noexec option, edit its entry in the /etc/fstab file to resemble the following example:

/dev/sda5 /backup ext3 defaults,noexec 0 0

Note:

Users who wish to mount or unmount a partition must place the partition in the /etc/fstab file. The backup utility only mounts or unmounts partitions that appear in the /etc/fstab file.

The example above describes the following configuration options:

DeviceDefault mount pointfile system typeMount optionsDump optionfsck order
/dev/sda5/backupext3defaults,noexec00

To remount a backup disk while the system boots, run the following command:

mount -o remount,noexec /backup


Why do I see "Permission denied" errors when I back up to a CIFS-mounted drive?

When you try to back up to a CIFS-mounted drive, you may see errors that resemble the following:

/bin/cp: failed to preserve ownership for `': Permission denied
/bin/cp: failed to preserve ownership for `': Permission denied

This may be due to missing extended attributes on the CIFS mount.

To resolve this issue, perform the following steps:

  1. Edit the /etc/fstab file so that the CIFS mount uses the user_xattr option. For more information about this option, read the mount command's manual page.

  2. Run the remount mount command to remount the CIFS mount.

  3. Run the lsattr /CIFS_mount command.

If the lsattr /CIFS_mount command returns the following error, the mount does not support extended attributes:

Error means not available: lsattr: Inappropriate ioctl for device While reading flags on ...

A mount that does not support extended attributes will not function with cPanel's backup.

Can I control when backups run?

To choose which days to run backups and how many backups to retain, use the Scheduling and Retention section of the  Backup Configuration  interface (WHM >> Home  >> Backup >> Backup Configuration). 

  • You must manually alter the times at which backups run.
  • You can manually edit the dates on which backups run in the  /var/cpanel/backups/config  file.

To choose the time at which backups run, manually edit the root user's crontab.

For example, by default, the backup runs at 2:00 am. To change this time to 3:30 pm, run the following commands:

  1. Run the crontab -l command to retrieve the time at which the Backups crontab runs. You will receive output that is similar to the following example: 

    0 1 * * * /usr/local/cpanel/scripts/cpbackup
  2. Run the crontab -e command to open the cron editor.
  3. Alter the 0 2 * * * /usr/local/cpanel/bin/backup line to resemble the following line:

    30 15 * * * /usr/local/cpanel/bin/backup

    Note:

     For more information about the time syntax of Crontab, read Wiipedia's Cron article.

Why does my system retain more backups than I configured it to retain?

If your system system retains a greater number of backup files than you configured in WHM's  Backup Configuration interface (WHM >> Home  >> Backup >> Backup Configuration), your system cannot properly rotate your backup files. Your system's failure to rotate backup files indicates that the system experiences an error when it attempts to generate a new backup. 

To check your system for backup file generation errors, change to the /usr/local/cpanel/logs/cpbackup directory and run the ls -al command to view a list of backup logs. Backup logs that contain errors may resemble the following example:

[2016-11-17 07:52:47 +0200] mr_toad: mysqldump failed -- database may be corrupt
[2016-11-17 09:52:59 +0200] mr_frog: mysqldump failed -- database may be corrupt

Important:

You must troubleshoot the affected files or databases before the system will successfully create and rotate backup files.


Note:

The example above displays the error log in the following format:

  • The time, in YYYY-MM-DD hh:mm:ss format, that the error occurred.
  • The affected file or database.
  • An error message.

 


How can I configure my system to notify me when it attempts to create backup files and an error occurs?

To configure your system to send you notifications when an error occurs with a backup file, perform the following steps:

  1. Navigate to WHM's Contact Manager interface (WHM >> Home  >> Server Contacts >> Contact Manager).
  2. Click the Notifications tab.
  3. Select the desired priority for the Successful Backup setting.

    Note:

    The template for this notification resides in the Backup/PartialFailure.*.tmpl file.

For more information about notification templates, view our Notification Templates documentation.

Network File System (NFS) settings with backups

Important:

cPanel Support does not officially support NFS. We provide this information for reference.

An NFS mount allows users to access files through a computer network similar to how you would access local storage. System backups utilize an NFS as mount options in the /etc/fstab directory. Backups use the following mount option:

10.215.218.163:/volume1/datastor /mnt/nfs nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800 0 0

In this example, NFS bases both the ip.ad.dre.ss:/export/path and /mountpoint values entirely on your setup.

Note:

We do not recommend that you use NFS over the Internet. You may use NFS as the primary backup directory, but this degrades your performance. We strongly recommend that you make the NFS mount point an additional "local directory destination." This action ensures that the system localizes backups and transfers them to the NFS directory.


 

Additional documentation