Learning Movable Type: Backing Up Your Blog


Occassionally databases get corrupted, servers fail or web hosts go out of business. So it's a good idea to back up your Movable Type blogs. There are many methods for doing so, a few of which I will cover here. The back-up process is much easier if you are using MySQL as your database.

Backing up your MT blogs with MySQL

If you have chosen MySQL as your database for your MT install you can easily back-up the entire blog - entries, comments, authors, templates, etc. - with a simple MySQL "dump" command. The dump command will create a large "dump" file that will have all of the data from your database in it that can be used to easily restore all of your weblogs. To do this you need either command line access to your database or phpMyAdmin installed on your server. The instructions for the dump command and phpMyAdmin can be found in the MT 3.2 User Manual. You can also find instructions for the dump command at MySQL's website. All that said, phpMyAdmin is not installed on my server and I could not get the dump instructions to work. So I ended up needing some handholding from tech support from my web host. Tech support also set up a "cron job" for the server to automatically create a dump file, backing up all of my blogs every night. Every few days I FTP into my server and download the dump file to my desktop, so I have a local copy of the database.

Backing up your MT blogs if you use BerkeleyDB or MySQL

If you are using BerkeleyDB or if you are using MySQL and don't have phpMyAdmin and don't want to deal with Unix commands - the back-up process is a bit more involved. The three elements of your weblog installation that you want to back up are a) the entries with their comments, b) your index and archive templates, and c) your weblog configurations for each of the weblogs that you have on your MT installation. If you are using BerkeleyDB you can download a copy of the db file in binary mode but this won't be useful if you ultimately upload it to a server with a different version of BerkeleyDB.

1. Export your entries.

Using MT's export function you can export all of the entries for a particular blog, and their comments. In MT Weblog Edit, click "Import/Export" from the menu at the left. If you are on a Mac, hold down the "option" key or if you are on a PC hold the shift key. Next (while holding the option or shift) click the link, "Export Entries From yourBlogName" and you can save the export. The resulting file should be saved as a .txt file. If it shows up as "mt.cfg" don't worry - just change it to somethingmemorable.txt. Check the file and make sure the export worked and you have a text file with the data from all of your entries.

If you have multiple blogs on one MT installation, you can follow the above instructions for each weblog. Or you can create an Export Blog that will more easily automate the export process.

2. Back up your templates.

Using an FTP client, create a templates folder in the same directory of the index file of each of your blogs. In MT Weblog Edit, for each blog that you have, go to the manage templates section. Template by template, create a backup template by inserting a file name into the "Link this template to a file" window. For example, for your main index template, type in templates/mainindex.tmpl. Rebuild your files. This tip comes from MT forum moderator Girlie (Shelley) and can be found in detail at http://www.thegirliematters.com/tips/archives/0207/back_up_templates_with_link_this_template.php

You can also output your templates using MySQL and PHP.

3. Record your weblog config preferences.

For each weblog, click the "Weblog Config" button in the left-hand menu. For Core Setup, Preferences, Archiving and IP Banning, record your current settings by printing them out. Some printers don't fill out the check boxes when printing, so check your check boxes on your printouts for future reference.


Links:
Backing up your MySQL database
TypeMover - a plugin to help you backup, restore, and migrate your Movable Type weblog.
Creating Automatic Backups of your MT Database


Posted by Elise Bauer on July 19, 2004 10:37 PM to Learning Movable Type http://www.learningmovabletype.com/