<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title>Parallels knowledgebase (KB)</title>
<link>http://kb.parallels.com/</link>
<description>Parallels knowledgebase (KB)</description>
<language>en</language>
<copyright>Copyright 2008 Parallels</copyright>
<pubDate>Wed, 10 Sep 2008 00:00:00 +0600</pubDate>
<lastBuildDate>Wed, 10 Sep 2008 00:00:00 +0600</lastBuildDate>
<webMaster>rt-team@parallels.com</webMaster>

<item>
<title><![CDATA[How to extract web files, databases etc from Plesk backup manually?]]></title>
<link>http://kb.parallels.com/en/1757</link>
<description><![CDATA[<div id="article">
	




	<div id="kb" class="kb">
		<div class="article-container">
			<h2 class="title">How to extract web files, databases etc from Plesk backup manually?</h2>
			<div class="ab-frame"><div class="bl"><div class="br"><div class="tl"><div class="tr"><!-- frame -->
				<div class="articleProperty">
					<div>Article ID: 1757&nbsp;</div>
					<div>Last Review: Jan,27 2009</div>
					<tr>
						<td>Author: </td>
						<td>Maxim Kutov</td>
					</tr>
					<br/>
					<tr>
						<td>Last updated by: </td>
						<td>system</td>
					</tr>
				</div><!-- articleProperty -->
			</div></div></div></div></div><!-- frame -->

			<div class="article-internal-flag"></div>

			<div id="article-content">
				<div class="article-part">
					<h2>Resolution</h2>
					<strong>I. FIRST WAY:<br /><br /></strong>If you have not so big dump file, for example 100-200MB, you can unzip it and open in any local Email client. Paths of the dump will be shown as attachments. Choose and save needed one then unzip it.<br /><strong><br />II. SECOND WAY:</strong><br /><br />It can be done using <strong>mpack</strong> tools to work with MIME files. This packet is included into Debian:&nbsp;&nbsp;&nbsp; &nbsp; <div class="commandline"><code># apt-get install mpack</code></div>&nbsp;For other Linux systems you can try to use RPM from ALT Linux:<p><a target="_blank" href="http://kb.parallels.comftp://ftp.pbone.net/mirror/ftp.altlinux.ru/pub/distributions/ALTLinux/Sisyphus/files/i586/RPMS/mpack-1.6-alt1.i586.rpm">ftp://ftp.pbone.net/mirror/ftp.altlinux.ru/pub/distributions/ALTLinux/Sisyphus/files/i586/RPMS/mpack-1.6-alt1.i586.rpm</a></p><p>or compile mpack from the sources: <a target="_blank" href="http://kb.parallels.comhttp://ftp.andrew.cmu.edu/pub/mpack/">http://ftp.andrew.cmu.edu/pub/mpack/</a>.</p>&nbsp;- Create an empty directory to extract the back up file:&nbsp; <div class="commandline"><code> # mkdir recover<br /># cd recover</code></div> <br />and copy backup into it.By default Plesk backup is gzipped (if not, use <strong>cat</strong>), so run <strong>zcat</strong> to pass data to <strong>munpack</strong> to extract content &nbsp;of directories from the backup file:&nbsp; <div class="commandline"><code># zcat  DUMP_FILE.gz &gt; DUMP_FILE <br /># cat  DUMP_FILE | munpack </code></div><br />&nbsp;In result you get the set of tar and sql files that contain domains' directories and databases. Untar the needed directory. For example if you need to restore the httpdocs folder for the DOMAIN.TLD domain:&nbsp; <div class="commandline"><code># tar xvf DOMAIN.TLD.htdocs</code></div><br /><br /><strong>NOTE: 'munpack' utility may not work with files greater then 2Gb and during dump extracting you may receive the error like</strong><br /> <br /> <div class="commandline"><code># cat  DUMP_FILE | munpack<br />DOMAIN.TLD.httpdocs (application/octet-stream)<br />  File size limit exceeded</code></div><br /> <br />In this case try the next way below.<br /><br /><strong>III. THRID WAY:</strong><br /><br />First, check if the dump is compressed or not and unzip if needed: <br /><br /><div class="commandline"><code># file testdom.com_2006.11.13_11.27<br />testdom.com_2006.11.13_11.27: gzip compressed data, from Unix<br /><br /># zcat testdom.com_2006.11.13_11.27 &gt; testdom.com_dump</code></div> <br /><br />Dump consists from the XML path that describes what is included into the dump and the data itself. Every data pie can be found by appropriate CID (Content ID) that&nbsp; can be found in the XML path.<br /><br />For example if the domain has hosting, all path that are included in the hosting are listed like:<br /><br />&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>&lt;phosting cid_ftpstat=&quot;testdom.com.ftpstat&quot; cid_webstat=&quot;testdom.com.webstat&quot; cid_docroot=&quot;testdom.com.htdocs&quot; cid_private=&quot;testdom.com.private&quot;</span><br />&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>cid_docroot_ssl=&quot;testdom.com.shtdocs&quot; cid_webstat_ssl=&quot;testdom.com.webstat-ssl&quot; cid_cgi=&quot;testdom.com.cgi&quot; errdocs=&quot;true&quot;&gt;</span><br /><br />If you need to extract domain's 'httpdocs' you should look for value of '<strong>cid_docroot</strong>' parameter, it is 'testdom.com.htdocs' in our case.<br /><br />Next, cut the content of 'httpdocs' from the whole dump using the CID you found. In order to do it you should find the string number from that our content begins and the string where it ends, like:<br /><br /><div class="commandline"><code># egrep -an '(^--_----------)|(testdom.com.shtdocs)' ./testdom.com_dump | grep -A1 &quot;Content-Type&quot;<br />2023:Content-Type: application/octet-stream; name=&quot;testdom.com.shtdocs&quot;<br />3806:--_----------=_1163395694117660-----------------------------------------</code></div><br /><br />Increase the first line number on 2 and&nbsp; subtract 1 from the second line number, then run:<br /><br /><div class="commandline"><code>head -n 3805&nbsp; ./testdom.com_dump | tail +2025&nbsp; &gt; htdocs.tar</code></div> <br /><br />You get the tar archive of the 'httpdocs' directory in result.<br /><br />If you need to restore the database, the behaviour is similar. You should find databases XML description for the domain you need, for example:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>&lt;database version=&quot;4.1&quot; name=&quot;mytest22&quot; cid=&quot;mytest22.mysql.sql&quot; type=&quot;mysql&quot;&gt;</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>&nbsp; &lt;db-server type=&quot;mysql&quot;&gt;</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>&nbsp;&nbsp;&nbsp; &lt;host&gt;localhost&lt;/host&gt;</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>&nbsp;&nbsp;&nbsp; &lt;port&gt;3306&lt;/port&gt;</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>&nbsp; &lt;/db-server&gt;</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='font-family: courier new,courier;font-size: 12px;'>&lt;/database&gt;</span><br /><br />Find the database content by CID:<br /><br /><div class="commandline"><code> # egrep -an '(^--_----------)|(mytest22.mysql.sql)' ./testdom.com_dump | grep -A1 &quot;Content-Type&quot;<br />1949:Content-Type: application/octet-stream; name=&quot;mytest22.mysql.sql&quot;<br />1975:--_----------=_1163395694117660-----------------------------------------</code></div><br /><br />Increase the first line number on 2 and subtract 1 from the second line number, then run:<br /><br /><div class="commandline"><code>head -n 1974&nbsp; ./testdom.com_dump | tail +1951&nbsp; &gt; mytest22.sql </code></div><br /><br />In result you get the database in SQL format.
				</div>
			</div>
		</div><!-- article-container -->


			<br/><br/>

			<div id="SubscriptionLink24Article" class="subscriptionLink2">
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=1757&ArticleLanguage=en&Product=&Category="><img src="http://kb.parallels.com/images/mail.png" width="15" height="15" alt="Subscription for changes to this article"></a>
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=1757&ArticleLanguage=en&Product=&Category=">Subscription for changes to this article</a>

<script type="text/javascript">

$(document).ready(function() {
	$('#SubscriptionLink24Article a').each(function(){
		$(this).click(function(event) {
			event.preventDefault();
			MainPageContentHide();
			$('#subscription').html('');
			$.get('/Stuff/Subscription', {
													'Type' : 'Article',
													'ArticleID' : '1757',
													'ArticleLanguage' : 'en',
													'Product' : '',
													'Category' : ''
												}, function(data) {
																	$('#subscription').html(data);
																	$('#subscription').show();
																	SUBbuildsubmenus_product();
																});
		});
	});
});

</script>

</div>





	</div><!-- kb -->

</div><!-- article -->


]]></description>
<author>Maxim Kutov</author>
<guid isPermaLink="false">1395 LastUpdated: 2009-01-27 11:09:20</guid>
<pubDate>2007-03-26 03:42:25</pubDate>
</item>
</channel>
</rss>



