Lesson Re-learned: Backups !
I just shot my blog in the foot, or more accurately, I didn’t follow IT 101 and back things up before making a change.
I had moved my site to be completely WordPress based a while ago, and as a result I had a bit of a convoluted setup on my server.
When I first set up my WordPress blog it was as a sub-domain of accuweaver.com, and was housed at http://wordpress.accuweaver.com/ (also aliased to http://blog.accuweaver.com/). The https://www.accuweaver.com/ site just static pages that hadn’t changed for years.
So when I finally got my blog set up to host the few static pages I had, I just changed the directory on my server to have a symbolic link to the directory where wordpress.accuweaver.com had it’s content:
- Removed the directory httpdocs from /var/www/vhosts/accuweaver.com
- Added a link in that folder to /var/www/vhosts/accuweaver.com/subdomains/wordpress/httpdocs.
This actually worked really well, since the content was only in one place, and all I had to do was change the host name in WordPress.
The problem came in recently when I was diagnosing a different problem with my server (mail wasn’t working). I noticed a weird error message on the Plesk control panel telling me there was a problem with a software update due to permission problems.
In hindsight I realize this was because Plesk was trying to update a config file multiple times, and either it had the wrong permissions, or the file was being accessed by multiple threads.
At any rate, I decided to simplify my directory tree and get rid of the symlink. So I deleted the symlink, and copied the directory to the right place on my server for the accuweaver.com site (for Plesk this turns out to be /var/www/vhosts/accuweaver.com) and checked my server: all good.
Then, thinking (but not thinking it through) it would be easier, I decided to to use the Plesk control panel to remove the old sub-domains. I didn’t want to just delete their directories, because I figured there would be stuff left behind in the database and I’d never be able to remove them.
What didn’t occur to me was this: I had originally installed WordPress through the Plesk control panel, and so unexpectedly (at least to me) when I deleted wordpress.accuweaver.com as a subdomain, the panel decided to help me out and delete the WordPress tables in the database.
As a result I got a completely misleading message on my home page that told me there was a database connectivity issue. What that actually meant was that the tables holding all my posts, users and subscribers was now completely gone.
The one saving moment for me was when I realized that because I’m running WP Super Cache, all of my posts have actually been translated to static HTML pages.
So while it’s going to be painful, I should be able to get most of them back and posted eventually. I downloaded a local copy of the cache, and have started rebuilding my server.
But before that, I’ll be setting up a backup and trying to remember to actually do one …