3 Golden Rules to Keeping Your Data - Backup... Backup... Backup!

Added on 28th April 2010

Last night, I decided to update my live Drupal 6 multi-site setup. My development version is continually running the latest version of the Drupal core code and modules, but my live setup was slightly outdated. I'd also re-organised my 'sites' structure slightly on my development setup, and found several modules on the live server that I wasn't using. So, I decided to remove everything from the live server and replace it with the shiny up-to-date version from my development setup.

I'll be one of the first to admit that I don't always 100% backup my code and databases everytime I do an update in development, but seeing I was altering live sites (including sites that I'd built for friends as personal projects) I opened Terminal and created a ZIP archive of my entire setup (which took a while) and also logged into phpMyAdmin and exported a copy of my databases. I placed these in a folder called 'Backups' on my hard drive and renamed both files to yesterday's date.

I'm glad that I did!

To begin with, I couldn't log into any of my sites, which I realised quickly was because I'd copied over each settings.php file from development, and that these weren't attempting to connect to the live databases. Having forgotten some of the passwords for some of my databases, I extracted the settings.php file for each site and uploaded it back to the live server. I also realised that one of my sites was in a different location on my development setup and hadn't been uploaded, so I moved it into the appropriate directory (where it should have been in the first place) and uploaded it. I then found that the new theme for this site that I've been working on was missing! Again, I extracted it from my backup archive and uploaded it.

The moral of the story is always backup code and databases when updating! Hopefully the update process will be a bit easier and quicker in Drupal 7. From now on, I will make sure that I take a copy of my remote code and databases, maybe once a month, just in case! Whilst I didn't have any major problems this time, it could have been much worse!

Add new comment