This is going to sound terrible, but bear with me. I currently have a cron job that does a mysql dump, a git add all and commit, and a git push to bitbucket. I set this up almost a year ago, when I didn't know much about git, backups, and general web development and administration. I haven't had the time to fix this and do it properly, but the repo has now grown quite big from accumulating large temporary files from my forum, so now I have to do something and I want to do it properly this time around.

What processes do semi-large websites and personal site admins use for backing up server content?

Based on what I've learned since I set this up, what I'm currently think of doing is:

  1. Making changes on a development domain and committing the code frequently
  2. Archiving the entire site after a successful deployment from the development domain
  3. Having automatic daily database and user-content backups.

I still like the idea of backing up sqldumps with git, though. I know git isn't a backup tool and that this is beyond its purpose, but the textual queries that are exported would be easily managed by git and would save a lot of space in archives.


There isn't a canonical backup process any more than there's a canonical web structure/organization.

But you mention that the repo's gotten bloated due to temporary files. Add the files/directories involved to .gitignore and they should no longer be a factor. There's obviously no reason to save them.


I think most sites use a simple cron job to copy the files to a backup server. However, git is becoming the norm as it allows you to easily branch development and revert to earlier versions. I think what you are doing is fine.

Regarding the database, why not back it up directly? At least, if it's MySQL you can simply back up the folder containing the database (e.g. /var/lib/mysql/database). This way you don't need to explicitly run mysqldump all the time, and you get some more granular versioning (each table is stored in separate files).

  • "simply back up the folder" - Can you simply copy a live MySQL database? – MrWhite Nov 22 '12 at 19:03
  • 1
    Yes you can. However I did just realise that in MySQL, only MyISAM tables are stored in separate files; InnoDB tables are stored in one big file. Also note, the files are binary so you do lose the ability to do diffs. – DisgruntledGoat Nov 22 '12 at 21:17
  • Must admit I'm stuck in the mind set of having used several relational/SQL databases in the past where if you tried to simply copy a live database you just ended up with a corrupt copy. It was mandatory to disconnect from the DB server before copying the files or use the provided backup utilities to do a live backup. – MrWhite Nov 23 '12 at 0:54
  • It's possible there are some caveats I am not aware of, but I've never had problems backing up the MySQL folder and restoring on my local system. They both run Ubuntu; trying to copy between Linux and Windows might not be as forgiving... – DisgruntledGoat Nov 23 '12 at 1:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.