Previously on the CogitActive Saga:
It is recommended to create a full backup of your site . . . If there is any issue, you will be able to restore your website.
A good backup system is ESSENTIAL. Interestingly, I have already mentioned this process twice: the first time when I turned my regular WordPress installation into WordPress Multisite and the second time in the Updates & Upgrade Network post. Specifically, in the latter occurrence, I emphasized the importance of backing up your website before any WordPress updates (or at least before major core updates). Yet, until now1, I didn’t address how to back up your WordPress website or, to be more specific, what system I put in place.
I should not even have to explain why you must back up your website (on a regular basis), but I will do it anyway in order to drive home the prime importance of backups.
Why backups are crucial?
For the same reasons you have a backup for your computer at home – you have a backup, right? – you need to back up your website. I am sure that you have heard about, or experienced, a tragic loss of data after a system crash or a hard drive failure. Backing up your data, in general, is the cornerstone of good digital security.
An online daily (or at the very least, weekly) backup solution is essential. If you don’t regularly download a full backup, you’re playing Russian roulette with your website.Peter Pollock
Of course, the server that hosts your websites has a whole host of safety features to ensure everything keeps running smoothly. However, even in the most secure setups, there are still many threats, which can break or compromise your website: system failures, viruses, malicious attacks, volume and directory glitches, transfer corruption, and human errors.
Apart from that, there are also events before which you should definitely make a new backup copy. In particular, updating WordPress is not risk-free as emphasized in Updates & Upgrade Network. There is always the possibility that something will go wrong; hence, the necessity to create a backup before updating your site. It is a good idea to do so, and what is more, a step that should not be skipped (under any circumstances).
Backing up your website helps you to safeguard against your own mistakes as well (e.g. accidentally erasing some important files or modifying the wrong ones). Similarly, it is smart to make a new backup before tinkering with your website (see Creating a child theme). Whether your changes crash your site or cause serious functionality issues, you will be happy to have a recent copy available.
Whatever the reason behind your data loss/corruption or website crash, the question is whether you are prepared for the worst-case scenario or not. As explain in WordPress.org documentation2,
site backups are essential because problems inevitably occur and you need to be in a position to take action when disaster strikes. Backups do not prevent the threats, but they ensure that your critical data will survive any of the likely hazards.
There are two kinds of people in the world: those who have a regular backup system—and those who will.David Pogue
The 3-2-1 backup rule
Having a backup system is an essential component to ensure the security of your website. In particular, a comprehensive data protection plan should include the 3-2-1 backup rule. In short, this means that you should keep at least three copies of your data (i.e. the primary data and two backups), and store these two backup copies on different media storage, with one of them located offsite.
Having one backup is not enough, especially if it is stored in the same premise as the primary data and on the same type of media. Any storage device will fail eventually. The more backup copies you have, the less chance you have to lose all of them at once.
There are other backup strategies than the 3-2-1 rule (e.g. 3-2-2 or 3-2-3), but you get the idea.
Do not make the backup . . . on the same server as the master copy. If the server goes down, you will not be able to access either the master or the backup.Peter Pollock
Putting things into context
Before to explain what backup system I opted for, I need to depict what were the circumstances that led to my choice. As you would expect, it starts with my hosting provider. I was looking for a worry-free hosting solution in term of security and found in SiteGround the right fit for my project. While I decided to entrust them with my website, the hosting plan I chose – StartUp – is their most basic and clearly not the best (see Getting my web host). In particular, the absence of free backup restore option was a serious concern.
Even though SiteGround was, and still is, backing up my account on a daily basis – keeping 30 copies available – they were not providing free access to these backups. If I were to use one of the automatic daily backup to restore my website, they would have charged me for that service: $19.95 per restore. This was far from satisfactory!
Not long ago, SiteGround performed a massive upgrade to all their hosting plans, now providing the restore option free to all users (i.e. including those hosted on a StartUp plan).
Similarly, the possibility to create instant backups on demand was not available free for the StartUp plan. This means that every time I were to create a backup using their tool (e.g. before to tinker with my website), I would have to pay $29.95 (price per backup). Unfortunately, this reality has not changed despite the aforementioned upgrade. The only way to have this feature free of charge would be to upgrade my hosting plan (to GrowBig).
Note that in regards to WordPress updates, which require creating a backup as well, the situation was better. Indeed, I decided to take advantage of their Auto-Update tool to have the major core updates taken care of automatically (see Updates & Upgrade Network). Fortunately, the tool creates a backup before to start updating and offers the possibility to reverse your site to its previous state (free of charge).
Back then, given the restriction of the StartUp plan, having a separate backup solution was a necessity. Now, let assume for a second that
all is for the best in the best of all possible worlds, meaning that I had access to all of the aforementioned backup services – or at least the restore option – free (without upgrading to GrowBig). There is no doubt that SiteGround’s Daily Backup service provides peace of mind; yet, should I still have looked for an additional backup solution?
As secure as your automatic backup may be,
don’t solely rely on it.Laurence Bradford
Clearly, the above quote betrays what is coming next. To make a long story short, my decision was chiefly influenced by two articles:
- Should You Rely on WordPress Backups by Your Web Hosts?
- How Well Does SiteGround Backup Your WordPress Site?
Briefly, one of the main point of the author was that
backups must be independent3 such as
you should be able to access [them] without depending on your web host3. In keeping with this idea, the second article, while probably
a little biased4 – as acknowledged by the author himself – and not up-to-date, was concluding that,
unless you’re manually downloading your backups and storing them securely, none of your backups are completely independent of SiteGround’s infrastructure4.
Your host may already back up your [website] as part of its normal backup routines, but it is still wise to ensure that you have a recent copy held locally just in case.Peter Pollock
Undoubtedly, the storage location is an important aspect of a good backup system (see the 3-2-1 backup rule above). In particular,
saving backups on the same server as your site defeats the purpose if the server is the reason why your site is going down5. As stated earlier, I entrusted SiteGround with my website for good reasons. In regards to this concern, they do off-site backups, meaning that the backups are stored off the main location of the host server.
To recap, given the aforementioned issues, I was looking for a backup solution that would allow me to 1) do a full website backup whenever required (i.e. on demand), 2) store a copy on my computer (i.e. not on the server) and 3) restore it free of charge. Certainly, there are other things to look for in a backup solution, such as the
ability to automate5 and having a
granular control3. However, my needs were relatively basics, i.e. not requiring every possible features. Moreover, I was seeking a free (and convenient) solution.
Before to review the many (free) backup solutions available, there is one key thing to understand:
there are two parts to backing up your WordPress site: Database and Files2. To have a full copy of your WordPress site, you need to backup BOTH – either separately or simultaneously, but
one without the other is not your full site6.
It’s as “easy” as 1) downloading the files you want to save via FTP and 2) exporting your database through phpMyAdmin.
Those who follow The CogitActive Saga know that I’ve been there before (when I wanted to setup a Multisite network). As explained in the FTP or File Manager? post, FTP is the recommended way to transfer large or multiple files. However, this method requires an FTP account and an FTP client, among other things. Given the hassle of using FTP on the one hand and the simplicity of the task I had to perform back then (i.e. editing few files on the server) on the other hand, I opted for File Manager.
Now, the latter is also great for quick transfers of few files; however, as stated in the aforementioned post, not for large files or several files at the same time. Using the Compress File(s) feature of File Manager might be an option7 for small websites, though.
Yet, another issue remains – which files to download? A WordPress website consists of many files2:
- WordPress Core Installation
- WordPress Plugins
- WordPress Themes
- Images and Files
- Additional Files and Static Web Pages
These files are essential in running your WordPress site; therefore, you need to download them all. While some files (and folders) have a wp- prefix (e.g. wp-config.php), not all of them have such an easy-to-identify prefix (e.g. index.php). Fortunately, they all are within your WordPress directory, which – in most cases – is your Home directory (i.e. public_html). Beware not to forget the hidden files (e.g. .htaccess).
Needless to say that the download process will take a while (for big sites); hence the importance of using an FTP client. Features such as auto resuming of the transfer, among others, will prove critical. You don’t want to end up with corrupted files for you backup!
Regarding the restore process, it is globally the same as above, but in reverse: you just have to upload the files back to your hosting account. Of note, this give you a granular control as you can restore only the faulty element (if you can pinpoint the source of the issue) or a specific part of your site’s content.
phpMyAdmin is a free and open source application for MySQL database management, which allows – among other things – to import and export MySQL database tables. You don’t need to know much about this tool (located in cPanel > Databases) to use it for creating a database backup. Still, there are two methods – Quick and Custom – to choose from (in the Export tab), as detailed in this article:
While some people recommend the Quick method for simplicity, others stress that this method
doesn’t compress [databases] before download5. And, more importantly, that
to restore a database backed up this way, you need to import it into a database without any tables5.
All tables in the file you selected are restored to the database. If you have not dropped all the tables you are restoring, the restore may fail with an error due to duplicate records being created.Peter Pollock
Thankfully, if you follow the step-by-step instructions from the aforementioned WordPress article, in which the displayed options of the Custom method are explained, the export process is not so intimidating.
As for the restore process, it is simply the reverse of creating a backup. You will import the backup inside the database via the Import tab.
cPanel Backup tool
Another option to back up both the files and database is the cPanel Backup tool (available in the Backups Manager section of cPanel).
Backups allow you to download a zipped copy of your entire site or specific parts of your site, such as your home directory, databases, email forwarder configuration, or your email filters configuration.
Indeed, the tool allow you to do a Full Backup or Partial Backups (i.e. each of the aforementioned items separately). Again, to have a full copy of your WordPress site, you need to backup both your files and database. For this reason, the Full Backup option appears to be a great solution. However, you cannot restore such a backup through the system’s interface.
Do not generate a full backup, as these are strictly for archival purposes and cannot be restored via cPanel.WordPress codex
The Partial Backups option, therefore, appears to be a better alternative. Besides, it is strongly recommended to back up your database at regular intervals, i.e. more frequently than your files. Given that I kept my e-mails separated from my hosting account (see Self-hosting: a hard egg to crack), I would just have to click on the Download button bellow Download a Home Directory Backup; that would take care of the files. Concerning the database, I should click the name of my database under Download a MySQL Database Backup. According to WordPress documentation,
a *.gz file will be downloaded to [my] local drive and
there is no need to unzip this file to restore it. Not so complicated, indeed!
To restore any of these two (partial) backups, I will have to browse to each backup files (from the cPanel tool) using the Choose File button and click on the Upload button. Concerning the database,
the bottom of the browser will indicate dump complete at the end of the process.
This auto-installer (available in cPanel > Autoinstallers) can do more than just installing new applications; it can be used to create a full backup of your website (i.e. both files and database, either separately or simultaneously). The only requirement to use this tool is that WordPress was installed by Softaculous. Still, if this is not the case, you can import your installation to the system8.
The backup process is stress-free. You can
select whether to backup only the WordPress files, only its database or both, as explained in their How to Backup an Installation article. A confirmation for successful backup creation will be displayed, along with a link to the Backups page. From there, you can press the blue arrow icon to download the backup to your computer (and/or trash it by clicking on the red cross icon).
You can even automate the process – at least the backup part – as detailed in their Automated Backups documentation. You can choose the Backup frequency from a drop-down list (One a Day, Once a Week, Once a Month, Don’t Backup). You can even choose to implement a Backup Rotation to limit space use. Once the maximum number of automated backups is reached, Softaculous will delete the oldest backup from the server. In order to store the backup locally, you will still have to download the file manually to your computer, though.
Restoring either the files, the database or both is a breeze as illustrated in How to Restore a Backup.
Exporting site data with built in export
WordPress provides an Export tool (Tools > Export) to export your data (posts, pages, custom post types, comments, custom fields, categories, tags, custom taxonomies, and users). While the tool is quite simple to use – you just have to click on the Download Export File button to save the file to your computer – it is not a suitable backup solution. Indeed, it does
not export your theme, plugins, and other important website files6. In other words, it doesn’t backup your files and database.
As for the “restore” process, the Export tool works hand in hand with the Import tool.
Using a plugin
Even though the above methods are not that demanding, it might be
a little too complicated to do on a regular basis5. For those who believe so, there are many free plugins to make the backup process hassle-free. In fact, for many people,
the easiest and most reliable way to back up your site is by using a plugin. However, being a little reluctant to use (too many) plugins, I ascertained whether the use of a plugin was the best approach.
It’s smart to rely on yourself rather than a 3rd party—especially when it comes to backing up your treasured site files.Laurence Bradford
In The Foolproof Guide to Backing Up WordPress Without a Plugin, Laurence Bradford enumerates many reasons why not using a plugin. The main one – to my opinion – is that
backing up is best done at the server level—not the site level6. Indeed, server-level backups do not depend on your website being functional or even online. Well, most plugins work right from within your WordPress admin.
In the same line, I found that most backup plugins store their data in a folder on the WordPress site. If your site is corrupted, then those files will be too. In addition, many basic ones may only backup the website content (as the Export non-solution described above), not the server settings.
Last, but not least, the major drawbacks with plugins, is than eventually you will need to upgrade to the paid (premium) version.
Clearly, there was no shortage of free options. Yet, the only serious backup solutions – to my opinion – were 1) the manual approach (FTP + phpMyAdmin), 2) the cPanel Backup tool, and 3) the Softaculous method. In fact, there are not mutually exclusive. For instance, it is possible to back up the database using phpMyAdmin and the files using the cPanel Backup tool (instead of via FTP). Granted, the cPanel Backup and Softaculous options may not provide as much control as a manual backup. Yet, having the possibility to backup both files and database within a single interface is a significant asset. In keeping with simplicity, Softaculous offers the possibility to backup both files and database9 either separately or simultaneously. For these reasons, I decided to implement this method as my secondary Backup solution.
Importantly, I want to insist on the “secondary” aspect of this backup solution. The automatic daily backup service offered (as in free) by SiteGround is great. They keep 30 versions (i.e. 30 days) of backups and store them off-site (i.e. off the main location of the host server). Admittedly, I don’t have access to these copies and SiteGround would have charged me to restore my website (at the time of my decision; but not anymore). Now, given that backups are more of a better-safe-than-sorry kind of thing, I may never have to use them. Therefore, SiteGround backing up system was, and still is, enough for my peace of mind.
Your host may already back up your [website] as part of its normal backup routines, but it is still wise to ensure that you have a recent copy held locally just in case.Peter Pollock
Besides this sound advice, i.e. to keep a recent backup copy locally, I wanted to perform backups on demand (a service not available free with the StartUp plan) and to be able to restore them without seeking the paid help of SiteGround. The backup solution provided by Softaculous fulfilled these two requirements. Trusting my primary Backup solution (namely SiteGround), I didn’t even activate Softaculous Automated Backups feature. Moreover, as pointed out earlier, I will have to download the backups manually to my computer – a functionality not taken care of natively by the Automated Backups.
On that matter, while storing one backup copy offsite strengthens your data security, having another backup copy onsite provide faster and simpler recovery in case of failure. Therefore, each time I perform a backup with Softaculous, I keep two copies of this backup. Specifically, I download it to my computer, but delete only the previous version (i.e. not the latest backup) from the Softaculous interface. Actually, the local copy is also backed up as part as my personal backup system.
Undeniably, this approach would not be practical for a daily backup. However, it is perfectly suitable for a monthly backup or some occasional on demand backups.
1 While backing up your website from the beginning is a smart move, given my brand new installation I was able to defer this step a bit. For instance, before to create a network (i.e. setting up Multisite), it is recommended to back up the database and files –
unless this is a fresh install and you have nothing to lose. Regarding updates, I was taking advantage of the built-in backup functionality of the SiteGround Auto-Update tool (see Updates & Upgrade Network). ^
2 See WordPress Backups. ^
3 Suhas Udayakumar (2016) Should You Rely on WordPress Backups by Your Web Hosts? BlogVault. ^
4 Suhas Udayakumar (2016) How Well Does SiteGround Backup Your WordPress Site? BlogVault. ^
5 Nick Schäferhoff (2018) How to Backup WordPress. WebsiteSetup. ^
6 Laurence Bradford (2018) The Foolproof Guide to Backing Up WordPress Without a Plugin. skillcrush. ^
7 To do so, select (but do not enter) the public_html folder and click Compress. You will have this warning: “Note that directories bigger than 2 GB should not be archived”. Given the current size of my site, this would not be a concern. Select Zip Archive and click Compress File(s). Once done, a popup window will provide the Compression results. You can close it, download the zipped file to your computer and delete it from the server. ^
8 Within the Import tab (on the WordPress page in Softaculous), simply provide the name of the directory where WordPress is installed and click on the Import button. Of note, I didn’t use Softaculous to install WordPress, but instead relied on SiteGround Setup Wizard (see Installing WordPress). Nonetheless, my installation was listed within Softaculous. ^
9 I was a little concern with my Multisite installation; in particular, how would Softaculous handle the database backup. Thankfully, the backup contains all the tables, including the extra ones that come with WordPress Multisite. ^