Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a LAMP website on Linux 10.0.4 LTS. I am a newbie sysadmin (I am a developer though) and I am seeking some advice on how best to implement backup for my website. My database is mySQL and ALL my database tables use the InnoDb database engine.

These are the requirements for the backup I want to implement:

  1. Incorporates incremental and full backups of mysql database I would like to have hourly incremental backups, but also daily, weekly and monthly backups But it is not clear in my mind what rotation to use for these various backup datasets - and also how to manage them (and more importantly, how to restore the database from a set of full/incremental backups for a date)

  2. I would like to compress and encrypt the data, so that I can store it remotely (Amazon S3)

  3. I want to have this fully automated (i.e. run as a cron job).

Note: My server is 'headless' in that it has no X windowing or other GUI installed, so I am thinking of implementing the backup us a bash script. Alternatively, if there is software out there that can help me run these kind of backup, then it needs to be able to be run from the command line.

The items I need to backup are:

  • mysql database
  • website files (in a specified folder. Ideally, I would like to leave out some files that are autogenerated)
  • configuration files
  • miscellaneous data files in different folders

Here are my questions:

  1. Is there existing software out there that I can use to do this, or do I need to write my own (bash script)?

  2. What is the recommended backup strategy to use (in terms of what is run hourly, daily, weekly etc), and how to restore the website from a particular point in time?

If I have to write my own bash script (being a bash scripting newbie as well), I will be grateful if someone could provide a skeleton script to help me get started.

share|improve this question

closed as primarily opinion-based by random Jul 8 '14 at 4:38

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 2 down vote accepted

I used rdiff-backup for years and it's stable and you can trust it. It makes incremental backups of whatever you give to it. So I would solve your problem with a bash script doing the following:
(1) mysqldump your database
(2) archive your database
(3) rdiff-backup to remote location.
Rdiff-backup stores only once the files and all future backups are incremental additions and you can revert to any backup.
Others may suggest "rsnapshot" which is somewhat faster but it is not keeping delta for files, only for folders.

share|improve this answer

I'm a big fan of DAR.

It has it's pros and cons, many of which can be read about with some Google love. It is pretty processor intensive (but most good incremental solutions are), so it should be a consideration if the server is in a shared environment (shared hosting or VPS).

As for strategy, DAR is pretty easy to implement in a bash/python via CRON setup. There's some pre-built bash scripts on the DAR site to review and customize as needed.

You can upload the DAR backup and diffs to S3 via many pre-built S3 applications.

As always, try a few solutions to work out what's right/best for your needs.

share|improve this answer

I manage 4 very small websites with db's that rarely change. My backup stategy is mysqldumping 4 databases, then ziping up everything (the owner of the websites uses Windows, so tar's are out of the question), and then use WGET on the owner's machine to download them. Easy, free, and uses standard linux tools that rarely break.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .