<?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>Oracle of ONE1 &#187; FreeBSD</title>
	<atom:link href="http://dvector.com/oracle/category/freebsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://dvector.com/oracle</link>
	<description>Obscure words of unity</description>
	<lastBuildDate>Wed, 31 Aug 2011 21:25:43 +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>Backing Up to Amazon S3</title>
		<link>http://dvector.com/oracle/2008/10/18/backing-up-to-amazon-s3/</link>
		<comments>http://dvector.com/oracle/2008/10/18/backing-up-to-amazon-s3/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 22:29:35 +0000</pubDate>
		<dc:creator>one1</dc:creator>
				<category><![CDATA[Amazon web services]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[duplicity]]></category>

		<guid isPermaLink="false">http://dvector.com/oracle/?p=75</guid>
		<description><![CDATA[Recently, I have started backing up my servers to Amazon S3 (Simple Storage Service) using Duplicity. So far, I am pleased with the process and the costs involved. I still do regular disk dumps to my own backup server but may slowly phase down the frequency of these dumps.
What is Amazon S3?
Amazon S3 provides a [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I have started backing up my servers to Amazon S3 (Simple Storage Service) using Duplicity. So far, I am pleased with the process and the costs involved. I still do regular disk dumps to my own backup server but may slowly phase down the frequency of these dumps.</p>
<h2>What is Amazon S3?</h2>
<p><a title="Amazon S3" href="http://aws.amazon.com/s3/">Amazon S3</a> provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefits on to developers.</p>
<h2>What is Duplicity?</h2>
<p><a href="http://duplicity.nongnu.org/">Duplicity</a> backs up directories by producing encrypted tar-format volumes and uploading them to a remote or local file server. Because duplicity uses librsync, the incremental archives are space efficient and only record the parts of files that have changed since the last backup. Because duplicity uses GnuPG to encrypt and/or sign these archives, they will be safe from spying and/or modification by the server.</p>
<p><span id="more-75"></span></p>
<h2>Why move from the old method?</h2>
<p>The main reason is that my backup server, located in my home, regularly loses connectivity during the disk dump. My ISP is Time Warner and while I am generally quite pleased with their service, it seems to regularly disconnect me during the early morning hours. I intend to continue using disk dumps to my backup server but now augment this with using Amazon S3.</p>
<p>There is an important difference between the two methods.</p>
<p style="padding-left: 30px">Dump backs up the entire file system &#8211; not the files. Dump does not care what file system is on the hard drive, or even if there are files in the file system. It examines files on a file system, determines which ones need to be backed up, and copies those files to a specified disk, tape, file or other storage medium. It dumps one file system at a time quickly and efficiently. Unfortunately, it does not do individual directories, and so it eats up a great deal more storage space than tar.</p>
<p style="padding-left: 30px">Duplicity uses the rsync library to determine changes to files and directories. It then uses tar to create a compressed archive of all changes it has found.</p>
<p style="padding-left: 30px">With dump, you are able to restore your filesystem back to a snapshot of any previous point in time for which a dump exists. With Duplicity, you are able to restore your system back to its last duplicity backup.</p>
<p>There are some advantages to including this method among a repertoire of backup methods. These include:</p>
<ul>
<li>Distributed storage</li>
<li>Encrypted storage</li>
<li>Space efficient</li>
<li>Low cost</li>
<li>Easy and unlimited expansion</li>
<li>Multiple backup methodologies</li>
</ul>
<h2>How to implement?</h2>
<p>The main assumption for my implementation instructions is that the servers are running FreeBSD version 6.x or greater. Since all the software is open source, it should be a simple matter to get Duplicity running on your brand of server.</p>
<p>Implementation is really quite easy and involves mainly some initial installation, setup, and learning a few commands.</p>
<h3>Install Duplicity</h3>
<pre>&gt; cd /usr/ports/sysutils/duplicity
&gt; make install clean

## The py-boto port is needed for duplicity to work with S3.
&gt; cd /usr/ports/devel/py-boto
&gt; make install clean
&gt; rehash</pre>
<h3>Register for Amazon S3</h3>
<p>In order to use this service, you must register for an account and provide credit card information. See <a title="Amazon S3" href="http://aws.amazon.com/s3/">http://aws.amazon.com/s3/</a> to view pricing, terms of service and to register for an account.</p>
<p>Once you have an account, you need to login to get your Access Identifiers. You need both the regular Access Key and your Secret Access Key. Make a note of these.</p>
<h3>Prepare to backup</h3>
<p>I strongly suggest you read the man files for duplicity and boto. Beyond that, I have found it convenient to set and later unset some environment variables. The method to set environment variables depends on your shell. Using the CSH shell:</p>
<pre>## Keys from Amazon
&gt; setenv AWS_ACCESS_KEY_ID regular_Access_Key
&gt; setenv AWS_SECRET_ACCESS_KEY your_Secret_Access_Key

## Encryption password of your choice
## This must be the same for each incremental backup
## If you do not set the variable here, the shell will request it
&gt; setenv PASSPHRASE GnuPG_Encryption_Password</pre>
<h3>Perform the backup</h3>
<p>I have adopted some conventions to ease my use of duplicity and insure my uniformity. Mainly, wherever Amazon or duplicity speak of bucketname, I use the name of the server and directory to backup. Here are my commands:</p>
<pre>## Backup my entire FreeBSD system
&gt; duplicity /var s3://s3.amazonaws.com/servername/var
&gt; duplicity /home s3://s3.amazonaws.com/servername/home
&gt; duplicity /usr s3://s3.amazonaws.com/servername/usr
&gt; duplicity / --exclude=/home --exclude=/usr --exclude=/var --exclude=/sys --exclude=/dev --exclude=/proc --exclude=/tmp --exclude=/mnt s3://s3.amazonaws.com/servername/root

## List files in one of the buckets
&gt; duplicity list-current-files s3://s3.amazonaws.com/servername/var

## Restore files from one of the buckets to the specified directory
&gt; duplicity s3://s3.amazonaws.com/servername/home /backup/servername/duplicity/home</pre>
<h3>Unset environment variables</h3>
<p>For security reasons, it is important to unset your environment variables. Here&#8217;s how:</p>
<pre># Unset environment variables
&gt; setenv AWS_ACCESS_KEY_ID
&gt; setenv AWS_SECRET_ACCESS_KEY
&gt; setenv PASSPHRASE</pre>
<h3>Build a Shell Script</h3>
<p>From this point, it is a simple matter to build a shell script so that these commands may be run from cron or periodic. I&#8217;ll leave this as an exercise for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://dvector.com/oracle/2008/10/18/backing-up-to-amazon-s3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

