<?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>Beyond Syntax &#187; os x</title>
	<atom:link href="http://www.beyond-syntax.com/category/os-x/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.beyond-syntax.com</link>
	<description>Looking beyond syntactical meaning</description>
	<lastBuildDate>Thu, 01 Jul 2010 22:45:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The nth Backup Solution</title>
		<link>http://www.beyond-syntax.com/2010/02/the-nth-backup-solution/</link>
		<comments>http://www.beyond-syntax.com/2010/02/the-nth-backup-solution/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 20:01:24 +0000</pubDate>
		<dc:creator>Michael Schultz</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[cron]]></category>

		<guid isPermaLink="false">http://www.beyond-syntax.com/?p=147</guid>
		<description><![CDATA[In the past, I had developed my own backup solution.  Unfortunately, over time it didn&#8217;t work out (mainly from changing systems, moving, using a laptop instead of a desktop, and maintaining it).  However, I still like the idea of incremental backups as well as a mirrored version of my files (it saves space and lets [...]]]></description>
			<content:encoded><![CDATA[<p>In the past, I had developed my own <a href="http://www.beyond-syntax.com/2007/10/automatic-backups-using-cron-and-tar/">backup solution</a>.  Unfortunately, over time it didn&#8217;t work out (mainly from changing systems, moving, using a laptop instead of a desktop, and maintaining it).  However, I still like the idea of incremental backups as well as a mirrored version of my files (it saves space and lets me keep a history going back some number of days).</p>
<p><span id="more-147"></span>Now that I&#8217;m somewhat settled (and a little wiser), I decided to once more try my hand at a solid backup plan.  This was mainly motivated by a recent reinstall of my wife&#8217;s system (no lost data, just operating system upgrade).  Since I don&#8217;t have vast amounts of time on my hands, I didn&#8217;t want to forward port my old solution to get it to work on Linux and Mac OS X, so I looked for new solutions.  I recalled <a href="http://www.mscs.mu.edu/~brylow/">my advisor</a> from Marquette mentioning <a href="http://rdiff-backup.nongnu.org/">rdiff-backup</a> as what he put on his wife&#8217;s machine during her dissertation days.</p>
<p>As it turns out, rdiff-backup does most of what I wanted out of my backup solution and, in fact, does it a little better.  The main issue I had with my system was that it would periodically (monthly) take a snapshot of my home directory, after that it would periodically (weekly) build incremental diffs based off that snapshot.  What this boils down to is that, if a catastrophic failure happens I would roll back to the most recent snapshot, then progress forward in time to the most recent incremental file.  Not bad, but if you want better-than-weekly granularity it could be a lot of work.  Obviously, I had scripted this part, but still it is wasted time.  With rdiff-backup, it would be a single copy operation to restore to the most recent version.  If you wanted older versions you could roll back through the incremental diffs (again, it is automated).</p>
<p>The other feature that I needed was the ability to remove backups/incremental data older than some time frame (monthly).  Again, rdiff-backup gives me this ability at the command line.  Other bonuses include the fact that it is cross-platform (via macports or most Linux repositories), written in Python, and not maintained by me!</p>
<p>With the basic service in place, it was time to make it automated.  Again, linked off rdiff-backup&#8217;s page is an article on <a href="http://arctic.org/~dean/rdiff-backup/unattended.html">how to do unattended backups</a>.  Besides the typical unattended SSH-keypair-without-a-passphrase and protecting-the-account steps, it introduced me to a new trick (which for some reason, despite having the knowledge on how to do it, never put together) using SSH config.</p>
<pre>Host athena-backup
	Hostname athena.olympus
	User backups
	IdentityFile ~/.ssh/backups_rsa
	Compression yes
	Protocol 2</pre>
<p>Now, if I try to <code>ssh athena-backup</code>, it&#8217;ll automatically use the correct identity file and user name which saves me from having to specify it on the command line (which you can&#8217;t typically do with wrapper functionality).  More importantly, it doesn&#8217;t break normal SSHing onto that host since we made it a special host (that&#8217;s the part I never put together, even though I knew it was possible).</p>
<p>The next issue I never took that time to think about before was my having moved from desktop to laptop (thereby making 1:00am backups worthless sense the laptop isn&#8217;t always on).  Because rdiff-backup does a roll-back model instead of my roll-forward model, I decided to do hourly backups to my home machine, thus I&#8217;ll likely catch at least one of these a day.  But I&#8217;m not always at home!  Getting around that is trivial, I&#8217;ll just ping the backup server before trying.  If it doesn&#8217;t respond, I don&#8217;t backup.  This is done through:</p>
<pre>ping -c1 -t1 $SERVER &gt; /dev/null 2&gt;&amp;1</pre>
<p>where <code>$SERVER</code> is just the name of the backup server.  It pings the host once with a timeout of 1 second, if it succeeds the backup continues; otherwise the script exits.</p>
<p>Of course, setting up the cronjob is as simple as:</p>
<pre>0 */1 * * * $HOME/.crontab/rdiff-backup.sh</pre>
<p>Hopefully this time around the backup solution is more robust than before.</p>
<p>Attachment: <a href="http://dev.beyond-syntax.com/scripts/rdiff-backup.sh">rdiff-backup.sh</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beyond-syntax.com/2010/02/the-nth-backup-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
