Not many are aware of creating a secure backup that can be used in times of server crash, db malfunction or hacking. For many who are involved in eBusiness, a website is like a virtual store front. Downtime, crash, hacking, ddos attach, malware, virus and heck a lot of things can damage your website and corrupt your files. In such a situation, it is very important to have a secure backup to switch back to your old files. Before jumping into the topic, let's go through some basics (Apologies to pros here - pls feel free to add your thoughts). Who is a host? Web hosting is nothing but renting a place on a server which is just like our PC. It runs on an operating system (Mostly Linux or Windows) and has standard software as out PC has. When we purchase a hosting package all we are doing is sharing a space of some one's server and paying for it. You may need to be familiar with few jargons before dealing this. WHM - Web Host Manager - User level who can create accounts. I mean create websites within a hosting package. VPS - Virtual Private Server - A segment of a server is rented out where a person can host only his/her website. cPanel - Software that runs on the server for easy one click commands. Now before going into steps, we must understand that a hosting package purchased from a host is shared. Which means, the server space will be shared by 10 to 1000 customers depending on the server memory. This is called shared web hosting. Most of us will go for shared hosting unless and until you have a high traffic website or huge number of websites to mange with. In this case your auto backup criteria is defined by your host. You will have to discuss with your host to see what are their terms and conditions. For eg: Hostgator offers free weekly backup while some other hosts charges for this feature. Remember backup in cPanel or WHM is a default option provided by cPanel and it is up to your host to offer this to you. However if you are having a VPS, you can create your own back up and mange it. This thread will focus on VPS based backup feature as other forms are typically configured by your host and are not available to you in your website cPanel. Activating auto backup Here I will show how one can activate auto backup feature. Remember the fact that you must have VPS and WHM enabled. If you are on shared hosting, you will have to request your hosting company to do this for you. WHM > BackUp > Configure Backup I have highlighted important sections in the screen shot where you will have to make the changes. Once you have enabled this auto backup feature, the data will be compressed and will be store on your server separately. This tool is intelligent enough to replace the files over and over again to avoid size overshoot. So at any point of time you will only have three latest copies of back up - Yesterday, last week and last month. How to roll back? If you want to roll back to a specific period, all you have to do is a simple click on your WHM. There is a roll back option from WHM where you can do this. However if you want to retrieve the file and store a local copy of the back up, you will either need to write shell script programs or you will have to use third party tools. Here are the steps: 1. Download WinSCP from http://winscp.net/download/winscp419.exe 2. Double click on the exe file downloaded to execute it. 3. In the WinSCP login window you can configure the connection to the server. Host name : Deleted for privacy Port number : Deleted for privacy User name : Deleted for privacy Password : Deleted for privacy File protocol : SCP Check the "Advanced options" check box and select "SCP/Shell" option under the Environment option in the left pane and change : Shell : /bin/bash 4. Click on save button at the bottom of the window to save the details. Give the session name and check the "Save password" option, if needed and save the details. 5. Now the session will list in "Session >> stored sessions". 6. Select the stored session by clicking it and click on login button at the bottom. 7. The WinSCP may show a warning regarding the server key at the first login to the server. You need to click on the "Yes" option to access the server. 8. The WinSCP will ask the root password, if you have not saved the password,provide it. 9. After connecting to the server. The WinSCP will show the file manager. The default file manger contains two panes. The left pane will list the local files and the right pane will list the remote server files. 10. The default remote directory will be /root. You can use the drop down box at the top of the remote server pane ( right pane ) to change the directory to / 11. The user files will be usually in /home. You can drag and drop the local files to remote and vice versa. Through Win SCP you can download a copy on your local system. Server backup vs account backup This is one of the confusions that is floating around. Server level back up is nothing but configuration files. Those will include OS files of the server. As you might know server is nothing but a computer like our PC with Windows or Linux server operating system. This server level backup is nothing but creating a restore point as we can do in our own PC - Start > Accessories > System Tools > System Restore. In a scenario like server crash (just like OS crash on our PC), this backup will be able to restore the server to its original state and not the files. You can not restore your files or db only with server level backup. Always ask this to your host when they say backup, what level of back up it is? To store your website files, db etc., you will have to have account level backup activated. Once you activate using the above mentioned steps in case of VPS or through your host in case of shared hosting, you can be rest assured that you can recover your files in a disaster situation.
Wonderful post Sam! I'm sure it'll help many out there. For those who are not aware, many webhosts advertise "daily backups" as one of their features. Mind you, this is only for their use in case of server failure. If only your website/database crashes, they won't provide you with backups. Backing up your website (especially databases) and downloading them offline is your responsibility.
If you have all of your original content at home don't I just re-upload it if there's a problem? That probably wouldn't work for databases though...
Good stuff here, For Wordpress you can simply export your blog into an easy to handle .xml file that has all your blogs and pages in it.
You might look at Backup Buddy. I was hacked and was able to restore my websites with just a few clicks. Everything was restored. Plug-in settings, posts, databases, etc.. It isn't free, but it is not expensive. Google for discounts.
Gosh, I never realised the importance of passwords. I am one of those who chooses easy passwords so i can remember them and recently one of my accounts was hacked into. Is there no way to backup everything on a laptop incase of a crash. I'm not very tech savvy and some of what you have said has stayed where it should - the rest has just flown over my head. I will have to read and re-read all the info. Just wondering what I can do straight away that will keep me protected.
Ritu Anand: Is there no way to backup everything on a laptop incase of a crash. Have a portable hard drive and keep regular backups of local data in it. If your site uses databases, then you need to take regular backups of that too (and download them to your PC at regular intervals). There is no way around.