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

Right now, I have cron to run a backup of my server at certain intervals. I manually download this file right now onto my home computer. I was just thinking about making it so that all of my backup images are stored in binary tables in an SQL database. Is this a good idea? It sounds like it might be.


share|improve this question
How big are the backup images? – stukelly Aug 1 '10 at 15:43
At this moment, they are about 50 - 60 MB. – QAH Aug 1 '10 at 15:57
up vote 2 down vote accepted

Think for a moment: what's the main purpose of taking backups?

Yes, you need them to be able to recover as fast as possible in case of some unfortunate event.

That's why you should use the KISS principle when planning your backups. Make the backups sophisticated (so you can restore from some specific date/version), but not TOO sophisticated. Use some alreadily available backup software. Storing binary blobs in MySQL doesn't sound like a fool-proof solution for me. I would store files as files and databases as databases.

I realize that this time you are planning to transfer the data from the ISP to your home, but imagine if the MySQL server is located in the same datacenter than the servers you'd like to backup and the datacenter goes down due an electricity blackout. A Very Important Server gets electrocuted due the blackout and does not boot due a hard drive failure. Your MySQL server boots up, but has some table corruption which needs to be fixed, IF it can be fixed. That would make the recovery part much slower and much more hassle than it should be.

Also, a big part of taking backups is not actually the backup phase, it's regularly TESTING them. It's way easier to see if your latest image backup is correctly done if you can just open up your file manager and browse the pictures, instead of performing some MySQL SELECT's (or use some application that fetches the blobs from the DB).

But databases are not completely useless when it comes to backups. A backup software can use it for all kinds of metadata; backup date, backup set, backup duration, file version, file checksum and so on. That kind of data is easy to store and quick to fetch from a DB. A binary blob, not so much.

share|improve this answer

I don't see any advantages of storing the images in a database. I could see string information about them in the db, plus the images location on disk. This would let you search, for example, for when certain files changed. The reason for a db is its search capability. Storing images a blobs doesn't let you search them, so there isn't any benifit, unless I'm missing something.

share|improve this answer
Well, its hypothetical but one benefit could be that it keeps other people from moving the files or altering the images if they're in a blob that only you have access rights to. I probably wouldn't but OP might have different requirements. – hotei Aug 1 '10 at 16:45
If data protection/integrity is a goal (and for important backups it should be), a db is the wrong tool for that. Encryption and checksums/hashes are what you want to be using. A db would be a great place to store the checksums, but not the backup images themselves. – KeithB Aug 1 '10 at 16:54

You must log in to answer this question.

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