<?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>Technical Diary &#187; amanda</title>
	<atom:link href="http://andriigrytsenko.net/tag/amanda/feed/" rel="self" type="application/rss+xml" />
	<link>http://andriigrytsenko.net</link>
	<description>With Andrii Grytsenko</description>
	<lastBuildDate>Wed, 28 Jul 2010 09:02:46 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Quickstart: backup on hard disk with AMANDA</title>
		<link>http://andriigrytsenko.net/2009/07/quick-start-backup-on-hard-disk-with-amanda/</link>
		<comments>http://andriigrytsenko.net/2009/07/quick-start-backup-on-hard-disk-with-amanda/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 12:10:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[amanda]]></category>
		<category><![CDATA[backup]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=370</guid>
		<description><![CDATA[In this post I will explain how to backup data to hard disk instead of tape with amanda backup tools over the network.

!!!CATION: Use this information on your own risk. Please remember that every step should be double checked unless you want to lose your data.
Preamble
I have two host and one of them will be [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I will explain how to backup data to hard disk instead of tape with amanda backup tools over the network.<br />
<span id="more-370"></span></p>
<p><span style="color: #ff0000;">!!!CATION: Use this information on your own risk. Please remember that every step should be double checked unless you want to lose your data.</span></p>
<p><strong>Preamble</strong><br />
I have two host and one of them will be used as backup server another as backup client:</p>
<ul>
<li>node1 &#8211; uses as client it will be backuped side. It&#8217;s critical server and directory <em>/etc</em> should be backuped as well.</li>
<li>node2 &#8211; backup server which has good RAID equipment for backup mounted at <em>/opt/backups</em>.</li>
</ul>
<p>Let&#8217;s start from server side:</p>
<p><strong>SERVER SIDE</strong></p>
<p>Go to the node2 and get all needed software</p>
<pre>yum install amanda
yum install amanda-client
yum install amanda-server</pre>
<p>After that we are ready to start server in over xinetd. Go to the <em>/etc/xinetd.d</em> directory and set directive
<pre>disable</pre>
<p> to
<pre>no</pre>
<p> in files : amanda, amandaidx and amidxtape.</p>
<pre>service amanda
{
socket_type             = dgram
protocol                = udp
wait                    = yes
user                    = amanda
group                   = disk
server                  = /usr/lib/amanda/amandad
disable                 = no
}
service amandaidx
{
socket_type             = stream
protocol                = tcp
wait                    = no
user                    = amanda
group                   = disk
server                  = /usr/lib/amanda/amindexd
disable                 = no
}
service amidxtape
{
socket_type             = stream
protocol                = tcp
wait                    = no
user                    = amanda
group                   = disk
server                  = /usr/lib/amanda/amidxtaped
disable                 = no
}</pre>
<p>to make new configuration works, restart xinted daemon:</p>
<pre>/etc/init.d/xinetd restart</pre>
<p>Check that everything is running:</p>
<pre>netstat -a | grep amand</pre>
<p>You should get something like that:</p>
<pre>tcp        0      0 *:amandaidx                 *:*                         LISTEN
udp        0      0 *:amanda                    *:*</pre>
<p>Make changes at .amandahosts allow users  amanda and root from host localhost connect to server:</p>
<pre>cat /var/lib/amanda/.amandahosts
localhost amanda  amindexd amidxtaped amdump
localhost.localdomain amanda  amindexd amidxtaped amdump
localhost root amindexd amidxtaped
localhost.localdomain root amindexd amidxtaped
node1 root  amindexd amidxtaped amdump</pre>
<p>Set properly permissions to protect config from illegal access :</p>
<pre>chmod 600 /var/lib/amanda/.amandahosts</pre>
<p>I will store backups at local hard disk.Mount point is <em>/opt/backups</em>. First, make directory with read-write permissions for user amanda:</p>
<pre>mkdir /opt/backups
chown amanda /opt/backups</pre>
<p>Next step, check value in
<pre>tapecycle</pre>
<p> at your <em>amanda.conf</em>. In my case it&#8217;s 25. That means that I should have 25 virtual tapes at my <em>/opt/backups</em>. Let&#8217;s create it and label, put in console next line:</p>
<pre>i=1; while [ $i -lt 26 ]; do mkdir -v /opt/backups/slot$i; let i=i+1; done</pre>
<p>also make symlink to first tape:</p>
<pre>ln -s /opt/backups/slot1 /opt/backups/data</pre>
<p>and set owner:</p>
<pre>chown -R amanda.disk /opt/backups/</pre>
<p>Now, login as amanda and label slots:</p>
<pre>su - amanda
i=1; while [ $i -lt 26 ]; do /usr/sbin/amlabel DailySet1 DailySet1-$i slot $i; let i=i+1;  done</pre>
<p>Check is everything labeled properly:</p>
<pre>/usr/sbin/amtape DailySet1 show</pre>
<p>Let&#8217;s take a look at amanda.conf. It&#8217;s located at <em>/etc/amanda/DailySet1</em>.</p>
<p>Below describe some change in configuration file which should be done.<br />
Add new section into your amanda.conf :</p>
<pre>define tapetype HARD-DISK {
comment "On Hard Disk"
length 3000 mbytes
}</pre>
<p>Specify directory for backups:</p>
<pre>tapedev "file:/opt/backups"</pre>
<p>and change
<pre>tapetype</pre>
<p> to
<pre>HARD-DISK</pre>
<pre>tapetype HARD-DISK</pre>
<p>In section
<pre>define dumptype global</pre>
<p> comment out and set to yes next:</p>
<pre>index yes
record yes
</pre>
<p>Change
<pre>tpchanger</pre>
<p> to this:</p>
<pre>tpchanger "chg-disk"</pre>
<p>If you have CentOS and Amanda Version 2.5.0p2  set chunksize to 0:</p>
<pre>chunksize 0</pre>
<p>to prevent errors concerning with recovery.</p>
<p>There is listing of main configuration file <a href="http://andriigrytsenko.net/files/amanda.conf">amanda.conf</a>:</p>
<p>Next files and directories should be created set owner to user amanda:</p>
<pre>touch /etc/amanda/DailySet1/tapelist
chown amanda /etc/amanda/DailySet1/tapelist
mkdir -p /dumps/amanda
chown amanda /dumps/amanda
mkdir /etc/amanda/DailySet1/curinfo
mkdir /etc/amanda/DailySet1/index
chown amanda /etc/amanda/DailySet1/index
chown amanda /etc/amanda/DailySet1/curinfo
mkdir  /etc/amanda/DailySet1/curinfo/localhost
chown amanda /etc/amanda/DailySet1/curinfo/localhost
mkdir  /etc/amanda/DailySet1/index/localhost
chown amanda /etc/amanda/DailySet1/index/localhost
mkdir /etc/amanda/DailySet1/curinfo/localhost/_etc
mkdir  /etc/amanda/DailySet1/index/localhost/_etc
chown amanda  /etc/amanda/DailySet1/index/localhost/_etc
chown amanda  /etc/amanda/DailySet1/curinfo/localhost/_etc
touch /etc/amanda/DailySet1/curinfo/localhost/_etc/info
chown amanda  /etc/amanda/DailySet1/curinfo/localhost/_etc/info</pre>
<p>Also very important file disklist located at <em>/etc/amanda/DailySet1</em>. Its consist all targets which have to backuped.</p>
<pre>cat disklist
node1 /etc comp-root-tar</pre>
<p><strong>CLIENT SIDE</strong></p>
<p>First, you should install software:</p>
<pre>yum install amanda-client</pre>
<p>and edit access file:</p>
<pre>cat /var/lib/amanda/.amandahosts
localhost amanda amindexd amidxtaped amdump
localhost  root amindexd amidxtaped
node2 amanda amindexd amidxtaped amdump
node2 root amindexd amidxtaped</pre>
<p>Set properly permissions:</p>
<pre>chmod 600 /var/lib/amanda/.amandahosts</pre>
<p>And last step enable amanda in xinetd as was mentioned above. Set
<pre>disable = no</pre>
<p> at <em>/etc/xinetd.d/amanda</em> and restart xinetd:</p>
<pre>/etc/init.d/xinetd restart</pre>
<p><strong>LITTLE PRACTISE</strong></p>
<p>Make test file at client side(node1) :</p>
<pre>echo "test"  &gt; /etc/testing</pre>
<p>To make backup go to the node2 login as amanda and run
<pre>amdump</pre>
<pre>su - amanda
/usr/sbin/amdump  DailySet1 node1</pre>
<p>Now you are ready to restore any file from backup. Go back to node1 and delete test file:</p>
<pre>rm /etc/testing</pre>
<p>Try to restart it over the amrecovery.</p>
<pre>amrecovery -t node2 -s node2</pre>
<p>if you get interactive mode type:
<pre>
&gt; sethost node1
&gt; setdisk /etc
&gt; add testing
&gt; lcd /etc
&gt; extract </pre>
<p>type &#8220;y&#8221; twice when you be prompted. Go to the <em>/etc</em> and check if was file restored:</p>
<pre>cat /etc/testing
test</pre>
<p>As you can see we successfully recover file which was mistaken delete.</p>
<p>!!!Keep in mind that in case of node1 will be failed date could be recovered from node2 as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/quick-start-backup-on-hard-disk-with-amanda/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
