bamed.org | chown -R bamed. ~/base

Oops… Did I do that? And basic Cpanel restore guide.

Um.. I hate to admit it, but I just made a (l)User mistake.  I just deleted my blog.  Not sure exactly how, must have clicked on the wrong thing or something, or else things weren’t setup the way I thought they were.  Basically, I was trying to clean up my hosting account with the wonderful hosting company Hostgator.  My wife has had several blogs through the years and I was trying to remove one that she hasn’t used in a few(4-5) years.  I had installed it using Fantastico Deluxe, so I went to remove it from Fantastico, but instead it deleted bamed.org!!!

Well, unlike many users I run across, I had a backup.  it was about a week old, but I only lost one blog post, so not really a huge deal.

So, as any IT guy will tell you, BACKUP! BACKUP! BACKUP!

FYI, Cpanel makes this pretty easy and HostGator has an easy to follow tutorial at http://support.hostgator.com/articles/cpanel/how-to-generatedownload-a-full-backup.  Restoring is actually pretty simple too.  If you have root on the server it’s real easy (I don’t from home), but if you are a HostGator customer and you have a full backup all you need to do is upload it to your account and fill out the form at https://secure.hostgator.com/restore.php and be sure to specify the location of the backup that you generated and a friendly HostGator admin (maybe even me) will restore the backup for you at no charge.

If you don’t have root, and you only need to restore a few files, or a database or two, you can also do it manually.  The CPanel generated backup is just a zipped up tarball that includes all of your account information in a few directories, a tarball of your home directory, and some SQL dumps of your MySQL databases.  So, I untarred my backup from SSH on the suer as my user:

~: tar -xvzf ????backup-4.5.2011_18-38-58_bamed.tar.gz

?This puts the content of the backup in ~/backup-4.5.2011_18-38-58_bamed.  Then all of my home directory is in a tarball named homdir.tar, so I untar it with:

~: tar -xvf backup-4.5.2011_18-38-58_bamed/homedir.tar

I ran this from my home directory, so the contents of homedir.tar extract directly into my home directory all the files going into the right places.  Once that was done, then I re-created my WordPress database in MySQL by following the instructions at http://www.hostgator.com/tutorials/cpanel/hgx3/creating-a-mysql-database.htm.  Not that I needed to actually follow the tutorial, I just low HG video tutorials.  Save me a lot of time trying to explain step-by-step instructions.  Anyway, I created the same DB name, unsername, and password that I had used before accidentally deleting everything.  If you don’t have this information saved, after you restore your homedir you can pull it from your wp-config.php file.

Anyway, after recreating the DB, I was able to restore it from the backup in ~/backup-4.5.2011_18-38-58_bamed/mysql.  The actual name of the backup file is the same as the name of the database you are restoring.  Just go to PHPMyAdmin from Cpanel and restore the database using the instructions at http://support.hostgator.com/articles/cpanel/how-to-import-your-mysql-database.  (Again, love those HG tutorials)

Then my site was back exactly as it had been on 4-5-2011 at 18:38:58(CDT).  Pretty exciting ehh?

So, that’s a quick rundown of doing a manual restore.  If I actually needed to restore some domain names, or email addresses, or anything else it would be a little more complicated, but I was only worried about a few files and one database so it was pretty easy and only took a few minutes.  I could have let my peers at HG do it, but why waste their time when I can do it myself.  Let them spend their time helping our customers.

Anyway, hopefully I’ll get back and blog some more stuff later.

Write a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Essentials