<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jon&#039;s Blog &#187; s3</title>
	<atom:link href="http://bombdiggity.net/blog/tag/s3/feed/" rel="self" type="application/rss+xml" />
	<link>http://bombdiggity.net/blog</link>
	<description>Ramblings of a php coder</description>
	<lastBuildDate>Fri, 14 May 2010 17:36:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Splitting Tar Archives&#8230;</title>
		<link>http://bombdiggity.net/blog/2009/03/06/splitting-tar-archives/</link>
		<comments>http://bombdiggity.net/blog/2009/03/06/splitting-tar-archives/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 14:32:34 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[Amazon AWS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[s3]]></category>

		<guid isPermaLink="false">http://www.bombdiggity.net/blog/?p=117</guid>
		<description><![CDATA[With working on deploying sites on Amazon EC2 we wanted to cut down on the time that it took to sync the sites from our seed servers to the new server. Our logical way to do this was to put a snapshot of the sites are Amazon S3 as a tgz file. Our sites are [...]]]></description>
			<content:encoded><![CDATA[<p>With working on deploying sites on Amazon EC2 we wanted to cut down on the time that it took to sync the sites from our seed servers to the new server.  Our logical way to do this was to put a snapshot of the sites are Amazon S3 as a tgz file.  Our sites are around 2gb each and while that is no problem to S3 as it max file size is 5gb but in interest of taking less time to upload each site and save on the chance of the file be corrupted on upload we decided to split the files.</p>
<h3><span id="more-117"></span>Splitting The Archive In To Pieces.</h3>
<pre class="brush: bash">
tar czPf - /dir_to_tar/ | split -b 200m -d - test_backup.tgz.
</pre>
<p>The code is very simple.  First well tell <a title="Gnu Tar man page" href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=3&amp;url=http%3A%2F%2Fwww.gnu.org%2Fsoftware%2Ftar%2Fmanual%2Ftar.html&amp;ei=ZTSxSd6YOIKyNM_l7cYE&amp;usg=AFQjCNEzGYgb_p-YLD-0JPJw5Lawxxdj9Q&amp;sig2=H5dSlNqZ1NKfNUKBGI1miw">tar</a> to create (c), gzip (g), absolute names (P) and force (f) and the path that we want in the archive.  It then gets piped to the <a title="Split man page" href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Funixhelp.ed.ac.uk%2FCGI%2Fman-cgi%3Fsplit&amp;ei=kjSxSdK7KI6-M8fQqMUE&amp;usg=AFQjCNFXY1GH8Ze_F4t8PDhjiObJFdcOTA&amp;sig2=k4MMPmg59miHMyjqaF7Ybw">split</a> command where split is told to make no larger than 200mb files (b) and to put numeric suffixes on the files (d).  Since we don&#8217;t have an input file the &#8211; represents the stream in from the tar command and we want it to output to test_backup.tgz. as the 00, 01, 02&#8230;. will be added to the end of that file.</p>
<p>After that is done running we just put the files on s3 using the <a title="s3Sync" href="http://s3sync.net/wiki">s3Sync</a> utility.</p>
<h3>Combining The Pieces In To One Archive:</h3>
<p>What happens when you want to extract the archive that you split.  You can just extract each file like you normally do.  This is how I do it but I&#8217;m always open for better ideas.</p>
<pre class="brush: bash">
cat test_backup.tgz.* &gt; test_backup.tgz
</pre>
<p>I must state that I&#8217;ve never had a split archive over 09 so i&#8217;m not sure how it will act when when you get more than that but like I said before if you have any better methods I&#8217;m open to new and better ways.</p>
]]></content:encoded>
			<wfw:commentRss>http://bombdiggity.net/blog/2009/03/06/splitting-tar-archives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
