How to take the backup of a huge website on hostgator or any other shared hosting

How to take the backup of a huge website on hostgator or any other shared hosting

This article also suits webmasters looking for:
backup files on shared hosting, manual backup on shared hosting, file compression not working in cPanel, file compression taking too long in file manager
Situation: I recently ran into a situation where one of my client wanted to sell his wallpaper website and the collection of files was huge. I am talking hundreds of gigabytes here. I was not able to create an automatic backup using any of the available backup plugins as the script was giving a timeout error. I tried compressing the folder using cpanel’s file manager so that I could download it but it took forever and zip file never got created. Now I could have started the download via ftp but it would have taken about 1000% of regular download time to finish downloading (ftp download of multiple files is slower than downloading them in a chunk because the protocol requires the transfer’s success to be acknowledged each time).

Solution: With backup plugins not working and FTP not a fancy solution, I was left with the only option of using SSH to compress the folder and then download it. This method requires you to have ssh access so make sure you have it before we begin. You can initiate a live chat session with your hosting support, start a ticket or simply give them a call.

1. Open an SSH client & connect to your server

Mac and Linux operating systems come with a built in Terminal. If you are on Windows and already don’t have one, download Putty or get one of the clients mentioned in this list of free SSH clients.

Login to your server using your SSH details provided by your hosting company. In most cases it is:

ssh -p 2222 cpanelusername@135.198.23.198

## 2222 is the port used on hostgator. Default SSH port is 22. It might vary for security reasons.
## cnapelusername - the username you use to login
## 135.198.23.198 - The IP Address of your server that can be found in the left sidebar when you log into cpanel

2. Change your path to the directory where you would like to create backup

On Hostgator, you log into the directory containing public_html (something like /home3/cpanelusername) folder by default. You can see your current directory by typing in the command pwd. Change the directory to the one where our folder that needs backing up is by typing in the following command:
Note: if you wish to backup entire public_html directory, there is no need to change directory.

cd public_html

If you can’t remember the name of directory you wanted to backup (don’t worry happens to me all the time), type in the following command:

ls

3. Zip the folder you wish to backup

Now that we are in the correct directory, let’s get on with the magic:

zip -r sitebackup.zip websitetobebackedup.com/

The zipping will take a while so you might want to grab a cup of coffee or do some exercise 🙂 Download the zipped file by pointing to this file in a browser or your download manager like:

http://yourprimarydomain.com/sitebackup.zip

or

http://xxx.xxx.xx.xxx/sitebackup.zip (replace xxx bit with your server’s ip address)

You can backup and hence download the database for this website using the phpmyAdmin tool in your cPanel.

This finishes our manual site backup. If you have any questions, feel free to ask them in the comments section below.

The following two tabs change content below.
Vikas is a Perth Based SEO Consultant and Front End Developer. He likes helping out web enthusiasts and learning from them along the way.

Subscribe to the Tips & Tricks newsletter and get the best of our tricks in your inbox every month.

Post a Comment

Your email is kept private. Required fields are marked *

hits counter