What is your favorite backup method?

David Beroff

Well-known member
Joined
Jun 14, 2016
Messages
1,261
Points
63
I have been looking for better ways to back up my websites' data but i am still confusing to choose a best backup method. What is your favorite backup method? Waiting for your shares!
 

ProResellerHost_Jack

Premium Member
Premium Member
Joined
Sep 11, 2020
Messages
32
Points
6
Hello David,
Backing up your website and data is extremely important in case of a disaster. The general consensus is the following :

3 copies of your data
2 different storage mediums
1 offsite backup

For my personal websites I choose to utilize cpanel backup features, but also backup to my local server at home. That server then gets backed up to a cloud provider. So multiple copies.

Another option is something like using Jet Backup or similar and backing up to Backblaze B2 storage (great pricing and control), Crash plan, rsync.net, and others.

I would highly suggest having an automated backup to an offsite location. This means a location other than the server your site is being hosted on.

If you have any questions or would like me to expand on anything, feel free to let me know.
 

Efe Agbontaen

Member
Joined
Sep 4, 2020
Messages
34
Points
6
The files and the Database are the main things so your control panel backup system should be fine.

But since they will be stored on the same server, or the same company server, I will advice you manually move the backups somewhere else. Because even if they have stable servers with redundancy, an account suspension will affect you.

We are actually working on a service to do this automatically.
 

fiz

Well-known member
Joined
Aug 6, 2020
Messages
109
Points
16
1. cPanel/WHM Backup: (Home directory and Database separately) You can take a Full backup but will contain everything in that cPanel account, Also select a remote destination in your backup configuration in WHM
2. Using SSH:
Code:
/scripts/pkgacct <cpanel-user> --skiphomedir
and then use rsync to sync the home directory to another server. You can write an SSH script and add it to cron to let this happen by itself every day/week or month. (Recommended because its fastest and use fewer resources) My Favorite.

Be advised, if you don't know how to use SSH, do not go for the second option. You might end up with nothing.
 

Kaz Wolfe

Well-known member
Joined
Jul 7, 2016
Messages
520
Points
28
Kaz Wolfe
You can take a Full backup but will contain everything in that cPanel account, Also select a remote destination in your backup configuration in WHM
I am concerning about this way. Can you share detailed configurations for this method?
 

fiz

Well-known member
Joined
Aug 6, 2020
Messages
109
Points
16
Best answer
fiz
Sure, Let me help you with this. I wrote a response that I intend to post somewhere else.

You can log in to WHM

Go to Backup > Backup Configuration
  1. Check Enable Backups
  2. Configure Backups by choosing the desired options
  3. Go to the Additional Destinations tab and click select your Destination from the dropdown and click Create New Destination
  4. Add the destination information and click Save Destination
  5. It will automatically copy the backups to the destination server.

But this is my favorite method and more efficient and uses less resources.

On the source server (that has the cPanel account), I've ssh script similar to this one.

Bash:
#!/bin/sh

exec 1>/backup-ssh-logfile 2>&1

echo "Server Backup Start - $(date)";

echo "Making Today's Backup Folder..";

mkdir /auto_backup_script_$(date +"%d-%m-%y");

echo "Starting Backup Home Folder without Home Directory...";

/scripts/pkgacct --skiphomedir cpanel_username /auto_backup_script_$(date +"%d-%m-%y");

echo "Deleting Backups from day before yesterday..";

rm -rf /auto_backup_script_$(date -d "-2 day" '+%d-%m-%y');

echo "Old Backups Deleted";

(echo "Subject:Backup Log: $(date +"%d-%m-%y") "; cat /backup-ssh-logfile) |  sendmail -i  [email protected];


Explanation:

Create a log file name backup-ssh-logfile and put the script response in it
echo date and info that you might need in future
make a backup directory with today's date
create a cPanel backup without the user's home directory
remove old backups
send an email to the desired address with the log file content.


And this script on Destination Server (Backup Server):



Bash:
#!/bin/sh

exec 1>/backup-ssh-logfile 2>&1

echo "Copying cPanel Accounts Backup without Home Directory - $(date +"%d-%m-%y")";

/usr/bin/rsync -avz -e "ssh -p 22" source.ibeehost.com:/auto_backup_script_$(date +"%d-%m-%y") /home/destination_folder/;

/usr/bin/rsync -avz -e "ssh -p 22" --exclude /path/to/exclude --exclude /path/to/exclude/ server.ibeehost.com:/home/source_username/ /home/destination_folder/cpanel_username;

(echo "Subject:Backups Sync Log: $(date +"%d-%m-%y") "; cat /backup-ssh-logfile) |  sendmail -i  [email protected];


Explanation:

Create a log file name backup-ssh-logfile and put the script response in it
echo date and info that you might need in future
Sync Automated generated backups on source server without home directory using rsync
Sync user's home directory using rsync (add as many users as you want)
send an email to the desired address with the log file content.
You can remove old backups automatically if you want.



Add both of these files in corn job using the following method or any alternative if you know.

1.
Bash:
nano /etc/crontab
2. Paste the following in the crontab file:
Bash:
5 3 * * *    root    ./backup.sh
(this means cron will run everyday at 3:05 AM)

3. Save the file and restart cron service using the command

Bash:
service crond restart
There is one more thing that you should do to make sure cron can run the sh script. Run the command to apply the correct permissions to backup.sh file
Bash:
chmod +x backup.sh

If you still need any help let me know. I've simplified as much as I could in short time.
 
Last edited:

fiz

Well-known member
Joined
Aug 6, 2020
Messages
109
Points
16
fiz
There is one more thing that you should do to make sure cron can run the sh script. Run the command to apply the correct permissions to backup.sh file
I've added one more step that I forgot initially to mention for corn to work correctly.
 

Kaz Wolfe

Well-known member
Joined
Jul 7, 2016
Messages
520
Points
28
Kaz Wolfe
Can I see crons in an user interface? or define it via an user interface, it is easier than create codes like this 5 3 * * * root ./backup.sh or after that managing it.
 

fiz

Well-known member
Joined
Aug 6, 2020
Messages
109
Points
16
fiz
I'm afraid you can't.
 

Kaz Wolfe

Well-known member
Joined
Jul 7, 2016
Messages
520
Points
28
Go to Backup > Backup Configuration
  1. Check Enable Backups
  2. Configure Backups by choosing the desired options
  3. Go to the Additional Destinations tab and click select your Destination from the dropdown and click Create New Destination
  4. Add the destination information and click Save Destination
  5. It will automatically copy the backups to the destination server.
For the first step, I created like you guide but it didn't work. I didn't see backup file on destination server after some days.

Create a log file name backup-ssh-logfile and put the script response in it
Create backup-ssh-logfile.log file?
 

fiz

Well-known member
Joined
Aug 6, 2020
Messages
109
Points
16
For the first step, I created like you guide but it didn't work. I didn't see backup file on destination server after some days.
I cannot really figure out the issue without seeing it. You might need to look into the log files.
Bash:
/usr/local/cpanel/logs/cpbackup
This directory contains the cPanel backup log files.

Bash:
/usr/local/cpanel/logs/cpbackup_transporter
This directory contains the cPanel Backup Transporter's log files.

Create backup-ssh-logfile.log file?
Its just a name if you want it to be a .log file then rename it to backup-ssh-logfile.log. I am creating it in /root/ directory that's why I wrote
Bash:
/backup-ssh-logfile
if you want it to be in different directory like /home/ then write
Bash:
/home/backup-ssh-logfile.log
 

Localnode

Moderator
Staff Member
Joined
Dec 15, 2015
Messages
329
Points
43
For cPanel servers I use the in-built method to backup to an external source.
I also use ClusterLogics (formerly Bacula4) CDP to a different external source.
In addition to the above - there is also on-site backups done daily.
All of these methods have different retention times.
 

williammark

New member
Joined
Nov 12, 2020
Messages
1
Points
1
Data is the most important thing. I am using for the storage of data Dropbox, google drive and cpanel as well.
 
Similar Threads

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top