Why Backups are Important

Posted on November 17, 2011 by

One of the biggest mistakes a web developer can make is to not back up production files before making changes to them. For those that don’t use any version control tools; or, in those instances where you aren’t the only one with access to the files on the server, not backing up before you deploy is like playing Russian Roulette.

But It’s Only a Text Change …

Really? Unless you can 100% guarantee that no one else has touched this file don’t take a chance. For all you know, someone may have updated the file without informing you. Overwriting it with your updated page may cause problems … and when the client gets back to you about something now not showing up or not working as it did before, you’re at a loss to even start to know where to look.

Always perform a backup before changing things.

But I’ll do it Right on the Server

Argh!! No! Updating a production file on the fly; or downloading and making the change to the file and then re-uploading it is dangerous. If you are typing or pasting changes in directly this might lead to data being missed (i.e., copying & pasting, “$var = $a + $b”, but missing the semi-colon at the end and not realizing it).

If something strange happens during the deployment that causes the site to crash (or a blank screen to appear), you can easily switch back to the backup and take a look at your change to see what went wrong. Having a broken page sit there while you try to diagnose the problem looks bad on you as a developer, and doesn’t endear you to the client much.

Always perform a backup before changing things.

Bulk Uploads

So you have an updated folder with 100′s of files in it, 50% of which have been updated, 10% are new files, and a bunch that have been removed as they were no longer needed.

Yes, it’s easier to just delete the current folder and upload the new one in one shot, but as I said earlier, unless you can 100% guarantee that no one else had access to it you should make a backup. This is especially important when files are being removed.

There was one instance where a developer did not backup a site before updating it. He removed the bulky folders and uploaded the new ones. Unfortunately for him, the new folders did not contain the image files (since only those files that were changed were included in the update).

Needless to say they were dumbfounded when the didn’t see the images, and then probably freaking out when they realized the consequences of not backing up data before deployment.

Always perform a backup before changing things.

Back up that Database

Before you make any changes to a database (either to the content or the structure) it is very important that you back that database up. Without a database backup, if your updates fail and cause data to become corrupted you are at the mercy of server back up tapes … which can take a day or more to retrieve and restore. Oh, and there’s typically a cost for recovering backups which either you or your client will have to cover.

Also, a day or more is like eternity to a client – especially one with a highly visible web site or web application. Don’t take chances – back up the database so that you can easily revert back if problems arise.