Backups & Disaster Recovery
How to backup your website with cPanel | Storm Internet
On March 10th of 2021, a fire destroyed OVHcloud’s SBG2 data centre in Strasbourg. Dystopian survival game Rust was among the victims of the fire, losing 25 servers, with some data unrecoverable. Other victims included the Deribit cryptocurrency exchange, the website of the Centre Pompidou arts centre, and the animation site Catsuka.
Free online chess service, Lichess, was also among the victims, and, in a tweet, encapsulated why backups are critical to online survival:
“Several of the Lichess servers burnt down in a datacenter fire tonight. No-one was harmed. Thanks to our zealous sysadmin and his backups, all we lost was 24h of puzzle history.”
Even though some hosts, like Storm, automatically backup customer websites, it’s simply good practice to keep a copy of your website files and databases safely stored away from your main data vault.
Why backups are important
Data centre disaster scenarios like the one described above are incredibly rare, and typically not something you need to worry about. (We’ll look at some of the contributing factors to the OVHcloud data centre fire at the end of this post.) For the average business, however, other more immediate threats emphasise the need to back up site data regularly.
Since the start of the COVID pandemic, attacks on websites have increased. According to many online sources around 30,000 websites are hacked every day – which is likely incorrect since that statistic appears to come from this 2013 Forbes article.
ExpertInsights, on the other hand, cites a SiteLock report that gives a more recent account, stating that websites experience roughly 94 attacks a day and are visited by bots roughly 2,608 times a week. If you’ve ever kept an eye on your website’s security logs, you’ll know this pretty much reflects what’s happening all the time.
Backups don’t necessarily protect against attacks or bots, but rather provide the means to restore compromised files once an attacker’s entry point into the site has been identified and mitigated. This means a business can resume operations with minimal downtime and, if backups are recent, with minimal data loss.
When should you backup your website
Strictly speaking, you should backup whenever information on your website changes. Adding, deleting, or changing a page, post, or other items of content constitutes a change. Updates applied to your website also constitute a change.
If such changes occur once or twice a week, you can get away with a pretty relaxed backup schedule.
However, if you run a website with information that changes frequently, you’ll have to run backups far more often. Given that backups also have to be spot-checked (restored and tested), it becomes a tedious task. At this point, it’ll be worth looking into a fully-managed backup solution.
How to backup your website with cPanel
cPanel is included with most Linux-based shared hosting services, and included with all Storm VPS and dedicated servers. It is a control panel that provides a visual interface that simplifies management of all your hosting data. It also makes backing up your website a breeze.
Backup your site’s files
Once you’ve logged into your cPanel account, open the file manager.
In the cPanel File Manager, you’ll be presented with two panes. On the left, you have the folder hierarchy, and on the right, the contents of the current folder in the hierarchy. The cPanel File Manager opens at the top of the hierarchy by default, which means both panes will display the same folders.
While all these directories / folders serve an important purpose, two of them require special mention:
- mail: Contains all your email in a raw format, as well as webmail settings
- public_html: Contains all your website files, but NOT the database
For this tutorial, we’ll be backing up the public_html directory. However, the same steps can be followed to backup the mail directory.
Right-click on the public_html directory, and left-click on ‘Compress’.
A dialog box will appear, giving us a few archive format options. If you’re on Windows, choose the first option, ‘Zip Archive’ (.zip files open natively in Windows explorer). If you’re on Linux or any other operating system, you’re free to choose any compression format.
At the bottom of the dialog box, you have the option to enter a name for your backup. It’s recommended that you choose a name that uniquely identifies the backup, rather than leave it on the default public_html.xxx.
Since I regularly backup several sites, I use a site name – date format: isgreen-24Jul2022.tar.gz.
Note: The ‘/’ immediately preceding the backup name is important – it signifies the root directory as the backup location. Include it when changing the backup file name. Additionally, it’s not advised to compress files from within the public_html directory, since the compressed file (which could contain site credentials) is then available for direct download from the public internet.
When you’re ready, click ‘Compress Files’.
Once the compression is complete, click ‘Close’ on the Compression Results dialog.
Right-click on the newly created archive, and left-click ‘Download’ to download the archive to your computer.
When the download is complete, right-click on the archive again, and left-click on ‘Delete’ to free up the space consumed by the archive. This is especially important if you’re on shared hosting where account space is often limited.
Remember to check ‘Skip the trash and permanently delete the files’, since trash also consumes space. Click ‘Confirm’.
Backup your site’s database
Return to your cPanel Dashboard and open the database management utility phpMyAdmin.
phpMyAdmin is divided into two panes, the left showing our databases, and the right various tabs, options, and functions.
In addition to your database in the left-hand pane, you may see other databases such as information_schema, which is a required system database. Here we’re only concerned with the database powering our website.
Click on the name of your site’s database to select it. This action will enumerate our site’s database tables in the right-hand pane.
Click on the ‘Export’ tab at the top, and then, without modifying any of the other options on the page, click ‘Go’ to automatically download your site’s database.
Unlike the backup of our site’s files, there’s nothing to delete here since no archive was created and stored. Close the window once your database has been downloaded.
According to TechRadar, a number of factors contributed to the OVH data centre fire, which reportedly started with an electrical inverter that caught fire. Nor did the building have a killswitch for the electricity (it took two hours to cut the power), and there was no automatic fire suppression system.
To OVH’s credit, they’ve been fully transparent about the incident and will likely come back fully prepared. But it does highlight the need to always keep a recent backup of your website. After all, disasters aren’t always caused by misbehaving inverters. The world is getting warmer and extreme weather is becoming more common, making events of the future anyone’s guess.
In the words of Robert Baden-Powell, the English soldier who founded the Boy Scouts: “Always be prepared.”
Speak with a Storm Expert
Please leave us your details and we'll be in touch shortly
A Trusted Partner