System Backups
Valid for versions 90 through the latest version
Version:
90
Last modified: October 7, 2024
Overview
If you enable system backups, your server saves system backup files in the local backup directory (/backup
) by default. You can also save system backup files to an additional destination. You can do this manually, via API, or via WHM’s Backup Configuration interface (WHM » Home » Backup » Backup Configuration).
The /usr/local/cpanel/bin/backup
script uploads a .tar
file that contains all of the system backup files to each destination that you configure to receive system backups. The system only sends system backup files to destinations whose files contain a upload_system_backup
value of 1
(enabled).
- cPanel & WHM does not include an interface to restore system backup files. To restore content from system backup files, you must perform the restoration manually.
- The additional destination configuration file uses YAML format, which contains a simple associative array.
- For security purposes, ensure that the destination server is on your secure network. If your backups will not transfer to a server on your secure network, use a secure method such as SFTP, Amazon S3™, or WebDAV with SSL.
How to enable system backup file saves
To enable system backup file saves, you can perform one of the following actions:
- Select the Back up System Files checkbox in the Backup Settings tab in WHM’s Backup Configuration interface (WHM » Home » Backup » Backup Configuration).
- Use the WHM API 1
backup_config_set
function and set thebackupfiles
value to1
.
System backup files and directories
The server backs up DNSSEC databases as part of the system files backup. The system can corrupt the DNSSEC database if it encounters an Out Of Memory (OOM) or disk full condition. The system administrator can also corrupt this database inadvertently.
The system administrator can restore the database from the system backup files. If they do not back up system files, they will need to perform the following steps:
- Rebuild the
PDNS.db
file from scratch. - Regenerate the DNSSEC keys for each domain that lost its DNSSEC key.
- Tell users to register the new DNSSEC keys with their domain registrar.
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/manualmx
/etc/reservedips
/etc/reservedipreasons
/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
).
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.
How to configure an additional destination to receive system backups
To configure an additional destination to receive system backups, perform one of the following procedures:
Interface method
In WHM’s Backup Configuration interface, select the Additional Destinations tab and enter the additional destination’s information.
Make certain that you select the Transfer System Backups to this Destination checkbox.
Manual configuration method
To manually modify the configuration file of an additional destination, perform the following steps:
- Identify the configuration file in the
/var/cpanel/backups
directory.- Each destination requires its own configuration file.
- The file name contains the destination name, the User ID (UID) label, and a UID character string. For example:
myftp_UID_Z6rdq0rko2Z28uWTIN33SeCY.backup_destination
Note:The UID sequence prevents conflicts with previously-created destinations that share the same name.
- Open the file with a text editor and add the following line:
upload_system_backup: 1
- Save the file.
API call method
To use API calls to modify the configuration file of an additional destination, perform the following steps:
- Call the WHM API 1
backup_destination_list
function to retrieve the ID of the additional destination to which you wish to send system backups. - Call the WHM API 1
backup_destination_set
function and include the following parameters and values:id
— The ID that thebackup_destination_list
function returned.upload_system_backup
—1
Log files
The system’s backup initialization logs to the /usr/local/cpanel/logs/error_log
file. The error_log
file points to the individual account package logs. For more information, read our cPanel & WHM Log Files documentation.