I had to extract a single database record from a Plesk backup today. The backup utility within Plesk 7.5.4 is not intended for accessing like this. It’s designed to restore a whole domain at once rather than getting hold of mistakenly deleted items, but with a few tools and a modicum (JCB) of patience, it can be done.

The backup file is a mime-encoded, part gzipped file which contains an xml file as an index.
You first need to unencode it using something like ripmime.
Download the latest stable version, unzip and install it following the instructions in the contained ‘INSTALL’ file.

# wget http://pldaniels.com/ripmime/ripmime-1.4.0.7.tar.gz
# tar -zxvf ripmime-1.4.0.7.tar.gz
# cd ripmime-1.4.0.7
# make
# make install

Then you can unencode your backup file. Move to a location where you have plenty of space to work… typically a user’s home directory, and start the unencoding.
On my server ‘backupfile’ was stored as ‘/var/lib/psa/dumps/domain.tld/domain.tld_yyyyy.mm.dd_hh.mm’

# cd ~username
# mkdir restoredir
# cd restoredir
# ripmime -i backupfile -v --name-by-type --postfix

This should create a fair few files in the directory ‘restoredir’. They will be named according to their contents, and you can see whether the files are gzipped or not using the ‘file’ command. All application-x-dir files are tar.gz files of the backed up directories. Hopefully this will be enough for you to determine the files you are after. You can also open up the text-xml1 file to help with ascertaining the correct files.

# file *
# cat text-xml1

Once you’re settled on the ones you want.. in my case ‘application-x-mysql-dump55’.. you can rename them to have the correct file extension and unzip them.

# mv application-x-mysql-dump55 application-x-mysql-dump55.gz
# gzip -d application-x-mysql-dump55.gz

Hope this works out for you.. it proved handy for me anyway.

References:
Original tip in a SWSoft discussion thread
http://forum.swsoft.com/showthread.php?threadid=23669
ripMIME – unencodes MIME files
http://pldaniels.com/ripmime/ripmime-1.4.0.7.tar.gz

Categories: LAMPPlesk

Jonathan Adjei

Jon's expertise in web development is legendary and he oversees all technical aspects of our projects from development to hosting (all through the command line!) Jon is excited by the latest techniques and keeps the company on track by finding ways to adopt new practices into our workflow.

5 Comments

Killswitch · September 5, 2006 at 10:40 am

I am having the problem. Host removed my backups, luckily I had downloaded one. I uploaded it back, but Plesk doesnt recognize. Found your guide off google but I cant follow 🙁 Never worked hands on with commands like this before. Guess I get to start my entire site over…

jon · September 5, 2006 at 10:50 am

Hi, these instructions are only going to be much use if you manage your own server and have ‘root access’. Has the version of Plesk changed between when you downloaded the backup and the version on there now? If not, you should be able to get it working. Try detailing the steps you are taking, the point it fails along with the exact error message on the swsoft forums (http://forum.swsoft.com/). There are plenty of gurus on there.

Killswitch · September 5, 2006 at 2:47 pm

Thanks, I will check there. I do manage my own VPS, just the first time I’ve worked with a linux machine.

Flo · May 27, 2008 at 11:49 am

Thanks for this tutorial, you are great 🙂 Saved me a lot of time!!!

Jonathan Adjei · May 27, 2008 at 2:29 pm

Thanks for the comment Flo.. great to know this is still useful.

Comments are closed.