Backups play a critical role in server management by preserving data and allowing quick restoration in case of failure, corruption, or accidental deletion. In web hosting, especially with WHM/cPanel environments, regularly configuring backups becomes essential to protect websites, databases, emails, and other crucial information.
cPanel simplifies the backup process with its built-in backup configuration feature. This tool lets administrators schedule automated backups, set retention periods, and select specific files, databases, or entire accounts for backup. As a result, it offers flexible backup management, tailored to the unique needs of each server. Moreover, administrators can easily choose storage locations, whether locally or via remote destinations such as FTP, Amazon S3, or Google Drive.
A reliable backup strategy is vital for disaster recovery and business continuity. With the right setup, you can quickly restore services after data loss, minimizing downtime and preventing data compromise. This WHM/cPanel Backup guide will go over the best backup practices, 3-2-1 backup rule, the ideal backup layout in your server, and backup configuration options within WHM/cPanel.
Best Backup Practices
When managing backups in WHM and in general, following best practices ensures data protection and smooth recovery in case of emergencies. By following these best practices, you ensure that your WHM backups and overall backup strategy provide strong protection against data loss and enable quick recovery in case of failure.
- Schedule Regular Backups: Regular backups are essential to safeguard your data. In WHM, configure automated daily, weekly, or monthly backups to keep your server data up to date. This reduces the risk of losing critical information due to unexpected events. Make sure the frequency aligns with your business needs to avoid large gaps between backups.
- Store Backups in Multiple Locations: Relying solely on local backups can be risky. Use WHM’s options to send backups to remote destinations like FTP, Amazon S3, or Google Drive. Storing backups both locally and remotely ensures that if one storage option fails, you still have a secure copy elsewhere
- Use Incremental Backups: WHM offers an incremental backup option, which only saves changes made since the last backup. This method saves storage space and speeds up the backup process. Incremental backups are ideal for large servers where full backups may take too long or consume too much space.
- Implement Retention Policies: Set up retention policies to keep a specific number of backup copies. This practice ensures that older backups are automatically deleted when they’re no longer needed, freeing up storage space and reducing costs. Be mindful of keeping enough backups to cover potential data loss scenarios.
- Monitor Backup Processes: Keep a close eye on your backup processes through WHM’s backup logs and notifications. Monitoring helps you identify issues such as failed backups or insufficient storage space. Addressing these issues promptly ensures your backups remain reliable.
3-2-1 Backup Rule
The 3-2-1 backup rule is a widely recommended strategy for ensuring data protection and recovery. Following the 3-2-1 rule enhances data security and ensures that you can quickly recover your information in the event of data loss.
- Three Copies of Your Data: Keep at least three total copies of your data. This includes the original data and two backups. Having multiple copies reduces the risk of data loss from hardware failures or corruption.
- Two Different Media Types: Store the backups on at least two different types of storage media. For example, you might use an external hard drive and a cloud storage service. This diversification helps protect against failures specific to one medium, such as a hard drive crash.
- One Offsite Backup: Keep at least one backup offsite to protect against local disasters such as fires, floods, or theft. This could be a cloud backup or a physical backup stored at a different location. Offsite backups ensure your data remains safe even in catastrophic scenarios.
Designing the Ideal Server Backup Layout
When designing the ideal server backup layout, it’s essential to consider how to organize backups across different partitions and types of drives. Proper partitioning and selecting the right storage media for your backups can significantly improve performance, reliability, and recovery times.
Partitioning for Backup Layout
- Create a dedicated partition solely for storing backups. This ensures that backups do not interfere with the system’s primary operations or other partitions, preventing scenarios where filling up the root or home partitions could crash the system.
- It’s best practice to keep the operating system, application data, and backup data on separate partitions. For example:
- / for the operating system.
- /var or /home for application and user data.
- /backup (or another designated partition) for backups
Choosing the Right Storage Media
The type of drive you use for storing backups is critical in determining how fast you can back up and restore data, as well as the long-term reliability of the storage.
- Hard Disk Drives (HDDs): Cost-effective and high-capacity, HDDs are suitable for local backups that don’t require rapid access. Use them for less frequent backups, such as weekly full backups, stored on a dedicated partition to avoid impacting system performance.
- Solid-State Drives (SSDs): SSDs offer faster read/write speeds, making them ideal for critical backups that need quick recovery, like daily or incremental backups. Create a separate SSD partition to enhance access speed and reliability for frequently used backup data.
NVMe drives, while fast, are not ideal for backup storage due to their high cost per gigabyte and lower write endurance, leading to faster wear from frequent backups. Their speed is often unnecessary for backup tasks, where traditional HDDs or SATA SSDs suffice. Additionally, NVMe drives generate more heat and offer fewer cost-effective redundancy options.
WHM/cPanel Backup Configuration
The WHM/cPanel Backup Configuration feature simplifies automated backups, allowing users to schedule, customize, and store data locally or remotely for secure, reliable recovery. WHM backups involve all accounts and are server-wide while cPanel backups are backups within specific accounts. We will review both and provide procedures accordingly below.
WHM Backups (All Accounts/Server-Wide)
Backup Status & Type
- Access the feature by navigating to Home / Backup / Backup Configuration within WHM.
- Proceed to check the box for “Enable Backups”.
- Select a backup type. For starters it is good to go with the default “Compressed” option.
- Compressed: This option saves disk space by compressing the backup but takes longer to create. It’s ideal when storage space is limited and backup speed is not critical.
- Uncompressed: Backups take more space but are created faster. This option is useful when you need quicker backups and have enough storage space available
- Incremental: Only backs up changes since the last backup, saving both time and disk space. It’s the most efficient option for ongoing backups, especially in environments with frequent changes.
Available Disk Space Check & Timeout Values
- Check the “Check the Available Disk Space” option and set it to 10% so that if the available disk space is less than the amount that you specified, the system will not run the backup.
- Leave the values for “Maximum Destination Backup Timeout” and “Maximum Backup Restoration Timeout” untouched.
- The default scheduling and retention section value is of course to have “Daily Backup” checked along with all the days you wish to backup but that can be modified as needed along with adding a weekly or monthly backups if dailies are not a good fit.
Files Settings
- “Back up User Accounts” should be checked with access logs and bandwidth Data” both checked. The option to “Back up Suspended Accounts” is also available but not checked by default.
- Ensure to have “Back up System Files” checked to support server restoration.
Databases
- Select the “Databases” option works best for you, however, the default and most recommended is to select “Per Account Only”.
- Per Account Only: Use the “mysqldump” command to create backup files with the “.sql” file extension for each account.
- Entire Data Directory: Back up all files in the “/var/lib/mysql/” directory.
- Per Account and Entire Data Directory: Back up all files in the “/var/lib/mysql/” directory, and use the “mysqldump” command to create backup files with the “.sql” extension for each account.
Backup & Retention Directories
- Configure the backup path under the “Configure the Backup Directory” section to match the directory/mounting point of your designated backup location. For example, if my partition is mounted to the /backup directory, then /backup is what will go into that field.
- Backup Staging Directory can be set to the same path as your regular backups, however, that can be changed if necessary based on your preference, partition layout, and storage conditions.
- Ensure to check the “Retain Backups in the Default Backup Directory” so that once backups are made and the system transfers the backups to another destination it will maintain the backups in the default directory. If you disable this option, the system will delete the backups after they move to another destination.
-
By default, the “Mount Backup Drive as Needed” is unchecked but can be checked if you’re experiencing any issues with the mounting point not mounting properly. Note that this requires a separate drive or other mount point.
Additional Destinations
WHM Backups can be sent to another location off server if needed. This can be useful if you do not wish to store backups locally on the server.
- Proceed to the “Additional Destinations” tab within “Home / Backup / Backup Configuration” at WHM.
- There are multiple options for backing up the account externally as shown in the image below.
-
Information about the different types of Remote Backup Destinations and how to configure them can be found in the official cPanel documentation as that is a live document that should be examined upon configuration of that section.
cPanel Backups (Specific cPanel Accounts)
A cPanel account backup creates a complete copy of your website files, databases, and emails, ensuring easy recovery and data protection in case of issues. This section is more specific to clients accessing their cPanel accounts as they would not normally have access to the WHM section unless they are the owner of the server/have access to the root user.
- The cPanel backup section can be reached by entering your cPanel account and navigating to “Backup” under the “Files” section.
- Within the section you can download a zipped copy of your entire site or a part of your site that you can save to your computer. When you backup your website, you have an extra copy of your information in case something happens to your host. The following can be made as well within the feature.
- A full backup which will create an archive of all of your website’s files and configuration. You can use this file to move your account to another server or to keep a local copy of your files.
- Account backups by date as per available backups on server.
- Partial Backups are also available along with the ability to restore them. The available items are listed below for reference.
- Home Directory Backup.
- Database Backup.
- Email Forwarders.
- Email Filters.
Further Assistance
For any further assistance involving partitions and backup configuration in WHM, do not hesitate to reach out to the Hivelocity Support team via a chat, support ticket, or phone at 888-869-4678.