How to Backup a cPanel Website

cPanel is a web based hosting control panel used by many hosting providers. The program gives their customers a graphical interface from which they can control their portion of the Linux server. If you haven’t configured the backup of your cPanel website in a while, you might want to redo it. cCPanel updated things recently, giving cPanel users a completely different way to backup their websites, and it’s much better than previous versions.

To see the new cPanel Backup Configuration, just log into WHM and select Backup Configuration. The old backup configuration is now listed as “Legacy Backup Configuration.” You can actually run both of them, but once you have the new one working you should probably disable the old one for space reasons.

The first two options are relatively easy to understand. Simply enable the backup configuration and specify that it should be compressed. That is, unless you like taking up a lot of additional space for your backups. I left the timeout values at their defaults.

The next set of options have to do with how often you want to perform certain types of backups. All backups are actually the same; this just allows you to expire certain backups at different times. I specified to perform a backup every day, which oddly enough is not the default configuration. I perform daily backups every day except Sunday, and perform a weekly backup on Sunday. I retain daily backups for a week, weekly backups for a month, and monthly backups for three months. Having variable expiration times for daily, weekly and monthly backups is one of the new features of this latest backup version.

Now you need to select what to backup. Make sure you have Backup Accounts selected. I really have no idea why anyone would backup their cPanel host without backing up their accounts, as the accounts are where the actual websites are. I also believe that you should backup system files, as those are needed to restore the server. The other options about backing up suspended accounts, access logs, bandwidth data, or whether or not to use local DNS I will leave as an exercise for the reader.

The next configuration option is extremely important. Without the MySQL database associated with your website, the backup of said website would be worthless. Therefore the minimum choice here would be to backup the Per Account databases. Unfortunately, there are other databases on the server that would not be included in that, such as the configuration database of cPanel itself. In order to backup those databases, you need to select either entire MySQL directory or per account and entire MySQL directory. Selecting the last option is the safest, but it does use up a lot more space, as it will backup the account databases twice. This is one of the options I didn’t like. I didn’t like being forced to choose between bad backups and backups that waste space. You could work around this with custom scripting, but I wouldn’t advise it unless it’s going to save you a ton of money.

Finally, you need to choose a directory as the destination for your backup, with /backup being the default directory. It’s important to understand that in many cPanel configurations, /backup is a very dangerous place to put your backups. The best case scenario is that /backup is a separate drive on the same server, which is bad enough. The more typical scenario is that /backup is actually simply a subdirectory on the same drive you are backing up! Neither of these scenarios is good, but the last one could be disastrous if you are counting on /backup to hold your backups. This is why cPanel now offers the option to send the backups of your server to the cloud. We’ll cover that in the next few blog posts.

W. Curtis Preston (aka Mr. Backup) is an expert in backup & recovery systems; a space he has been working in since 1993. He has written three books on the subject, Backup & Recovery, Using SANs and NAS, and Unix Backup & Recovery. Mr. Preston is a writer and has spoken at hundreds of seminars and conferences around the world. Preston’s mission is to arm today’s IT managers with truly unbiased information about today’s storage industry and its products.

Tagged with: , , , , , , , ,
Posted in Blog

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 21,861 other followers

Blog Stats
  • 1,233,272 views
%d bloggers like this: