Centralized Backup Server With Amanda On CentOS

Want to support HowtoForge? Become a subscriber!
 
Submitted by kcharoen (Contact Author) (Forums) on Tue, 2008-09-30 13:43. :: CentOS | Backup | High-Availability

Centralized Backup Server With Amanda On CentOS

This document describes how to set up a centralized network backup with Amanda. We will use virtual tape to store the backup.

In my environment, I have 2 Linux servers that I want to backup.

192.168.20.200 (Alpha) : /home/kulathep

192.168.20.201 (Beta) : /data and /var

I am going to build a new server with Amanda as a centralized backup server.

192.168.20.202 (Gamma)

 

Setup Server (Gamma)

1. Install Amanda with yum:

yum -y install amanda*

2. Edit Amanda conf in xinetd.d:

vi /etc/xinetd.d/amanda
vi /etc/xinetd.d/amandaidx
vi /etc/xinetd.d/amidxtape

Change Disable = yes to Disable = no.

3. Copy Amanda conf files:

cp -r /etc/amanda/DailySet1 /etc/amanda/intra

4. Edit amanda.conf:

vi /etc/amanda/intra/amanda.conf

org "Configuration name"
mailto "email"
netusage 600 Kbps

dumpcycle 2 weeks
runspercycle 10
tapecycle 15 tapes

#tpchanger "chg-manual"
tpchanger "chg-disk"

changerfile "/etc/amanda/intra/changer"

#tapedev "null:"
tapedev "file:/backup/intra/slots"

#tapetype HP-DAT
#labelstr "^DailySet1-[0-9][0-9]*$"

tapetype HARDDISK
define tapetype HARDDISK {
comment “Backup to Virtual Tape”
length 3072 mbytes # each tape is 3 Gigs
}

# amrecover_changer "null:"
amrecover_changer "changer"


#infofile "/etc/amanda/DailySet1/curinfo" # database DIRECTORY
#logdir "/etc/amanda/ DailySet1" # log directory
#indexdir "/etc/amanda/ DailySet1/index" # index directory
infofile "/var/log/amanda/intra/curinfo" # database DIRECTORY
logdir "/var/log/amanda/intra" # log directory
indexdir "/var/log/amanda/intra/index" # index directory

With this configuration, Amanda will do a full backup every 2 weeks, and an incremental backup every week day. The backup will be stored and rotated on 15 virtual tapes.

5. Edit disklist (tell Amanda which servers, directory to backup, what dumptype to use).

vi /etc/amanda/intra/disklist

Remove every lines including “localhost /etc comp-root-tar” at the end of the file. And add:

alpha   /home/kulathep     comp-user-tar
beta          /data     comp-user-tar
beta          /var     comp-user-tar

Note: See amanda.conf for the dumptype.

6. Edit hosts file:

vi /etc/hosts

Add:
192.168.20.200 alpha
192.168.20.201 beta

7. Create backup directory (we will store the backup here):

mkdir -p -m 770 /backup/intra/slots
chown -R amanda:disk /backup

8. Create tape list:

touch /etc/amanda/intra/tapelist
chown –R amanda:disk /etc/amanda/intra

9. Create slots (virtual tapes):

su - amanda
cd /backup/intra/slots
for ((i=1; $i<=15; i++)); do mkdir slot$i; done
ln -s slot1 data

10. Test virtual tapes:

/usr/sbin/ammt -f file:/backup/intra/slots status

11. Label the virtual tapes:

for ((i=1; $i<=15; i++)); do /usr/sbin/amlabel intra intra-$i slot $i; done

12. Reset the tape:

/usr/sbin/amtape intra reset

13. Edit .amandahosts to allow communications from clients:

vi /var/lib/amanda/.amandahosts

alpha amanda
beta amanda
gamma amanda

14. Start xinetd service:

su –
service xinetd start

15. Check amanda process:

lsof | grep amanda


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Tue, 2010-11-30 04:18.

Please help me, I always receive email report from amanda server like this:

*** A TAPE ERROR OCCURRED: [No writable valid tape found].
Some dumps may have been left in the holding disk.
Run amflush to flush them to tape.
The next tape Amanda expects to use is: intra-15.


STATISTICS:
                          Total       Full      Incr.
                        --------   --------   --------
Estimate Time (hrs:min)    0:00
Run Time (hrs:min)         0:00
Dump Time (hrs:min)        0:00       0:00       0:00
Output Size (meg)           4.3        0.0        4.3
Original Size (meg)         5.3        0.0        5.3
Avg Compressed Size (%)    82.1        --        82.1   (level:#disks ...)
Filesystems Dumped            1          0          1   (2:1)
Avg Dump Rate (k/s)      8794.5        --      8794.5

Tape Time (hrs:min)        0:00       0:00       0:00
Tape Size (meg)             0.0        0.0        0.0
Tape Used (%)               0.0        0.0        0.0
Filesystems Taped             0          0          0

Chunks Taped                  0          0          0
Avg Tp Write Rate (k/s)     --         --         --


DUMP SUMMARY:
                                       DUMPER STATS               TAPER STATS
HOSTNAME     DISK        L ORIG-KB  OUT-KB  COMP%  MMM:SS   KB/s MMM:SS   KB/s
-------------------------- ------------------------------------- -------------
alpha        -r/www/html 2    5420    4450   82.1    0:01 8781.8   N/A    N/A

(brought to you by Amanda version 2.5.0p2)

Submitted by James (not registered) on Wed, 2008-10-01 15:20.

Some of the config you used appears to be outdated, or incorrect. Since I have seen other sites with the same blocks of config, I must assume outdated.

Great tutorial, but you might want to specify versions that it will [not] work with.

 

Just in case it might help someone, here is my dumptype, and tapetype definitions.

CentOS5:

[root@wt26 intra]# rpm -q amanda
amanda-2.5.0p2-4
[root@wt26 intra]#

 define dumptype custom-tar {
 program "GNUTAR"
 comment "root partitions dumped with custom compression"
 compress server custom
 server_custom_compress "/bin/gzip"
 priority low
}

define tapetype HARDDISK {
 length 100000 mbytes
}

But as far as setting it up, awsome tutorial, much appreciated!

 

Submitted by Mike (not registered) on Fri, 2009-11-06 16:48.
Thanks for clearing that up James, and thanks author for this nice how to.