LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Suggested backup solution for easy recovery (https://www.linuxquestions.org/questions/linux-server-73/suggested-backup-solution-for-easy-recovery-4175536404/)

Tons of Fun 03-11-2015 09:39 AM

Suggested backup solution for easy recovery
 
I set up a Debian 7 server for our intranet using a re-purposed server. After the OS, I installed Apache, MySQL, and PHP for the site. I then installed Joomla and started creating the site. About the time I was researching a backup solution for the server, the HD died and I lost everything. Not critical as the site wasn't online yet, but still irritating that I didn't install a backup solution right after I installed Joomla.

So I would like suggestions on a good backup solution that will allow me a quick restoration. I have set up backup solutions with Windows servers in the past using Symantec and Shadow Protect, but never a Linux backup.

Should I look at images, or maybe a series of full backups? I have been looking at rsync, Bacula, and Back in Time, but not sure which solution would be the easiest to restore if I need to.

Thanks in advance for any advice you can provide.

veerain 03-11-2015 10:03 AM

Some say tar is the simplest tool and also the easiest one. Rsync reliable for local or network transfer.

TenTenths 03-11-2015 10:04 AM

First off, if you can do so then set up a hardware RAID, while RAID IS NOT A BACKUP it gives you a little mitigation against a single HD failure.

My personal preference is to take daily MySQL dumps of databases to a specific folder (unimaginatively I use /backup).
Then use dirvish to create remote snapshots of at least /etc, /backup and /home at regular intervals, generally daily.

For my personal sites I keep dervish vaults on separate servers, one of which is configured as a "warm" standby for my main sites and I also backup to a RasPi at home.

At work I do something similar with the resulting backups being written to a rotation of LTO-4 tapes in an autochanger (hoping to go to LTO-6 soon).

One of the joys of using dirvish is that the backups are differential so it's also easy to go back a few generations if necessary and the files are presented as a familiar folder "tree".

Tons of Fun 03-11-2015 10:30 AM

Thanks to both of you for your reply. If I use Dirvish to take snapshots, how would I restore if I needed to do a complete restore? Would I need to reinstall Debian, install Dervish, and then restore the last image?

Miati 03-11-2015 10:43 AM

You could also do a "poor mans" incremental with rsync and cp's hard linking.

Code:

#!/bin/bash

dir_name="$(date '+%m_%d_%Y')"
rsync -tha --delete-after /directory/backup-from/ /Backup/backup-to/

cp -al /Backup/backup-to/ /Backup/increm_backup/"$dir_name"

The above rsync's to the destination and delete's extra files (so it stays clean)
Then, it hard links the contents to a directory named for that day.
Since hard links are just another pointer to the same info no extra space is used (except for pointer info)
If the data is corrupted or written over (shredded) you'll have issue, but otherwise works really well.
You can go back to whatever day and grab a file that's be deleted for example.
It won't rotate them though, so it'll keep piling up.

This link gives a good explanation.
http://www.mikerubel.org/computers/rsync_snapshots/

TenTenths 03-11-2015 10:44 AM

Quote:

Originally Posted by Tons of Fun (Post 5330452)
Thanks to both of you for your reply. If I use Dirvish to take snapshots, how would I restore if I needed to do a complete restore? Would I need to reinstall Debian, install Dervish, and then restore the last image?

Depends on what you back up. Personally I back up content and key configuration files rather than doing whole system backups, that way if I have to restore on to different hardware or a different distro I can do so relatively easily.


There would be nothing to stop you taking a complete system backup if you so desired though.

Tons of Fun 03-12-2015 07:40 AM

Quote:

Originally Posted by TenTenths (Post 5330460)
Depends on what you back up. Personally I back up content and key configuration files rather than doing whole system backups, that way if I have to restore on to different hardware or a different distro I can do so relatively easily.

That's something for me to think about. This is a re-purposed server. If it dies, I would like to be able to restore to a new machine if I need to.

My biggest concern is to be able to restore Joomla. It uses Apache, MySQL, and PHP, all of which I can install via instructions, but don't have a working knowledge of. How would I back up Joomla to make sure that if I did need to restore it to a rebuilt machine, I could restore it and be back in service? If it was a typical program or a group of files, I would know how. But being a CMS, I'm not sure of how to approach it. I will use Akeeba Bacup within Joomla, but don't want to have to rely on it exclusively.

Thanks again for everyone's help!

TenTenths 03-12-2015 08:49 AM

Quote:

Originally Posted by Tons of Fun (Post 5330886)
My biggest concern is to be able to restore Joomla. It uses Apache, MySQL, and PHP, all of which I can install via instructions, but don't have a working knowledge of. How would I back up Joomla to make sure that if I did need to restore it to a rebuilt machine, I could restore it and be back in service? If it was a typical program or a group of files, I would know how. But being a CMS, I'm not sure of how to approach it. I will use Akeeba Bacup within Joomla, but don't want to have to rely on it exclusively.

In addition to any internal backup "plugin/add-on" I'd do a mysqldump of the relevant Joomla database on a regular basis (daily? hourly? how often does it change?) and then back that up along with the whole of the Joomla install folder and any folders used for attachments.

Tons of Fun 03-12-2015 08:53 AM

Thanks a lot for the help. It was the MySQL backup that I was concerned with. So I would do a backup on the /var/joomla folder with a separate MySQL backup. Upon restoration, I would restore var/joomla and then do a MySQL restore?

TenTenths 03-12-2015 08:58 AM

Quote:

Originally Posted by Tons of Fun (Post 5330922)
Thanks a lot for the help. It was the MySQL backup that I was concerned with. So I would do a backup on the /var/joomla folder with a separate MySQL backup. Upon restoration, I would restore var/joomla and then do a MySQL restore?

Yup.

You might find this interesting: http://centos.tips/mysql-backup/

This is the script I use on my personal web servers to backup MySQL databases and rsyncing them to a remote server.


All times are GMT -5. The time now is 06:58 AM.