Ubuntu Linux, ubuntu desktop, Linux operating system, ubuntu guide

Archive for March, 2012

Amanda backup setup and configuration using Virtual Tape in Fedora

by on Mar.27, 2012, under Amanda, Backup, Ubuntu

This document describes the steps to be followed to amanda backup setup configuration using virtual tape.  As of date, the current stable version of Amanda is 3.3.0.

AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is a backup system that allows the administrator to set up a single master backup server to back up multiple hosts over network to tape drives/changers or disks or optical media. Amanda uses native dump and/or GNU tar facilities and can back up a large number of workstations running multiple versions of Unix.

This will guide you through setting up virtual tapes (utilize hard disk space for backups)

Here we are using Fedora 14 as Amanda server – backup.server.com (hostname)

and amanda client is an ubuntu desktop machine – backup.client.com (hostname)

  

Fedora we have installed using minimal packages and not installed the default amanda software with send mail server. Download the amanda latest version 3.3.0 stable version

 

Step 1

Open the terminal

#wget -c http://prdownloads.sourceforge.net/amanda/amanda-3.3.0.tar.gz?download

#tar -xvzf amanda-3.3.0.tar.gz

#cd amanda-3.3.0

#./configure

#make

#make check

We get error when we missed any packages and libraries.

#make install

 Step 2

The Amanda services are started by the extended internet daemon, xinetd, which is why you must have xinetd installed on every Amanda server and client. In any text editor, create one xinetd startup file, /etc/xinetd.d/amandaserver

If you have not already installed xinetd, install it

# yum install xinetd

Create an amanda xinetd entry

# vim etc/xinetd.d/amandaserver

Give it the following contents

Code: 

# default: on
#
# description: Amanda services for Amanda server and client.
#
service amanda
{
        disable          = no
        socket_type  = stream
        protocol        = tcp
        wait               = no
        user               = amandabackup
        group            = disk
        groups          = yes
        server            = /usr/lib/amanda/amandad
        server_args   = -auth=bsdtcp amdump amindexd amidxtaped
}

 Restart xinetd

# /etc/init.d/xinetd restart

Become amandabackup user

# su amandabackup
Create copies of the configuration files, just in case

$cp -r /etc/amanda/DailySet1 /etc/amanda/DailySet1.bak

Step 3

Edit amanda.conf

$ vim /etc/amanda/DailySet1/amanda.conf

Make the following changes in the file

Code:

Make the following changes in the file
Code:
      org “DailySet1″                                                
# your organization name for reports
      mailto “backupadmin@yourdomain.com”  
# space separated list of operators at your site
      dumpuser “amandabackup”
      tpchanger “chg-disk”                                      
# the tape-changer glue script
      tapedev “
file:/amandabackup/DailySet1/slots”   # the no-rewind tape device to be used
      tapetype HARDDISK
 

define dumptype global {
      comment “Global definitions”
       auth “bsdtcp”
}
define dumptype gui-base {
       global
       program “GNUTAR”
       comment “gui base dumptype dumped with tar”
       compress none
       index yes
}
define tapetype HARDDISK {
length 100000 mbytes
}

#Add the following lines to support the encrypted backup

define dumptype client-encrypt-ossl {
        global
        program “GNUTAR”
        comment “no compression and client symmetric encryption with OpenSSL”
        compress none
        encrypt client
        client_encrypt “/usr/sbin/amcrypt-ossl”
        client_decrypt_option “-d”
    }

 

 Step 4

Choose a location for your virtual tapes to reside. Here we using /amandabackups/ Create the tapelist file that is necessary for indexing tapes available
Code:

#touch /etc/amanda/DailySet1/tapelist

create the location and set permissions for the virtual tapes
Code:

#mkdir -p -m 770 /amandabackup/DailySet1/slots

#chown -R backup:backup /amdndahosts

CD to the new directory from amandabackup user

$cd /amandabackup/DailySet1/slots

Create the necessary directories for the tapes
Code:

$for ((i=1; $i<=25; i++)); do mkdir slot$i; done

Create symlink for the data directory to point to the first tape
Code:

$ln -s slot1 data

Label the tapes

for ((i=1; $i<=9; i++)); do amlabel DailySet1 DailySet?1$i slot $i; done

for ((i=10; $i<=25; i++)); do amlabel DailySet1 DailySet1$i slot $i; done

 Output should look like (for each slot)

labeling tape in slot 1 (file:/amandabackup/DailySet1/slots)
rewinding, reading label, not an amanda tape
rewinding, writing label DailySet?1-01, checking label, done.

Reset the changer back to slot 1

amtape DailySet1 reset

Output should look like

amtape: changer is reset, slot 1 is loaded.

Create below directory for Amanda log files

#mkdir -p /usr/adm/amanda
#chown amandabackup:disk /usr/adm/amanda

Step 6

Edit .amandahosts “ backup.server.com” /var/lib/amanda/.amandahosts file to allow the backup clients to connect back to the server when doing restores. Specify fully qualified domain names

On the .amandahosts file is located as /var/lib/amanda/.amandahosts

Open the file

vim /var/lib/amanda/.amandahosts

The file looks like

backup.server.com root amindexd amidxtaped

backup.server.com amandabackup amindexd amidxtaped

backup.client.com  root amindexd amidxtaped
backup.server.com amandabackup admump

 Step 6

Create an /etc/amanda/DailySet1/disklist file in the Amanda configuration directory

The format for the disklist file is :

Dumptypes are deinfed in /etc/amanda/amanda.conf, but we using the GNUTAR dumptype comp-user-tar for this example

vim /etc/amanda/DailySet1/disklist

Add a line like so

Code:

backup.client.com /var/www/html comp-user-tar

backup.client.com /home / encrypt-simple

backup.server.com /etc comp-user-tar

Amanda Client Setup

 

Here We are using two clients one is backup.client.com and another one is the same amdanda server backup.server.com

Install AMANDA client

Install the AMANDA client app

Step 1

$sudo apt-get install amanda-client

Create necessary amanda directory ( It is not needed for the server ubuntulinux.co.in)

$sudo mkdir -p -m 770 /etc/amanda

Change owner

 $sudo chown -R amandabackup:amandabackup /etc/amanda

Step 2

Become the amandabackup user

$su amandabackup

Create an excludes file

touch /etc/amanda/exclude.gtar

Edit /etc/amandahosts to allow server to connect to client machine for backups

localhost amandabackup

backup.client.com amandabackup

backup.server.com amandabackup

 Step  3

Create xinetd amanda entry

sudo vim /etc/xinetd.d/amanda

Edit the file, mine looks like

# default: on

# description: Amanda services for Amanda client.

#

service amanda

{

bind               = backup.client.com

socket_type   = dgram

protocol         = udp

wait                 = yes

user                 = amandabackup

group              = amandabackup

groups            = yes

server              = /usr/lib/amanda/amandad

server_args      = -auth=bsd amdump

disable          = no

}

 

Restart xinetd

$sudo /etc/init.d/xinetd restart

Edit /etc/services to look like

# Amanda Services

amanda           10080/udp

amanda           10080/tcp

kamanda         10081/udp

kamanda         10081/tcp

amandaidx      10082/tcp

amidxtape       10083/tcp

Make sure your /etc/inetd.conf looks like

amanda dgram udp wait backup /usr/sbin/tcpd /usr/lib/amanda/amandad

 Step 4

Verify the Configuration, Run amcheck on Server to verify configuration files, connections, etc lgoin as amandabackup user

Code:

$amcheck DailySet1

Output looks like

$amcheck DailySet1
Amanda Tape Server Host Check
—————————–
found in slot 1: volume ‘DailySet1-01′
slot 1: volume ‘DailySet1-01′
Will write to volume ‘DailySet1-01′ in slot 1.
NOTE: skipping tape-writable test
NOTE: conf info dir /usr/adm/amanda/curinfo does not exist
NOTE: it will be created on the next run.
NOTE: index dir /usr/adm/amanda/index does not exist
NOTE: it will be created on the next run.
Server check took 0.972 seconds

Amanda Backup Client Hosts Check
——————————–
Client check: 1 host checked in 7.147 seconds.  0 problems found.

(brought to you by Amanda 3.3.0)

Amanda backup

$ amdump DailySet1 à Dump the give server files and alert mail will send to backupadmin@yourdomain.com

 $ amtape DailySet1 show
amtape: scanning all 15 slots in changer:
slot   1: date 20111002092634 label DailySet1-01 à last backup date
slot   2: date X              label DailySet1-02
slot   3: date X              label DailySet1-03
slot   4: date X              label DailySet1-04
slot   5: date X              label DailySet1-05
slot   6: date X              label DailySet1-06
slot   7: date X              label DailySet1-07
slot   8: date X              label DailySet1-08
slot   9: date X              label DailySet1-09
slot  10: date X              label DailySet1-010
slot  11: date X              label DailySet1-011
slot  12: date X              label DailySet1-012
slot  13: date X              label DailySet1-013
slot  14: date X              label DailySet1-014
slot  15: date X              label DailySet1-015Amrecover

 amrecover – Recover the files from backup

Amrecover browses the database of Amanda index files to determine which tapes contain files to recover. Furthermore, it is able to recover files.

In order to restore files in place, you must invoke amrecover from the root of the backed up filesystem, or use lcd to move into that directory, otherwise a directory tree that resembles the backed up filesystem will be created in the current directory. See the examples below for details.

Amrecover should be run as root user.

Amrecover will the read the amanda-client.conf file and the config/amanda-client.conf file. If no configuration name is supplied on the command line, Amrecover will try the compiled-in default configuration, usually DailySet 1.

Edit the following lines in amanda-client.conf

 conf  DailySet1 # your config name

index_server backup.server.com  # your amindexd server

tape_server backup.server.com # your amidxtaped server

tapedev file:/amandabackup/DailySet1/slots # your tape device

Example

amrecover> listhost

200- List hosts for config DailySet1

201- 10.132.100.56

200  List hosts for config DailySet1

amrecover> sethost 10.132.100.56

200 Dump host set to 10.132.100.56.

amrecover> list disk

Extract list written to file disk

amrecover> setdisk /home/user/Desktop/var /tmp

200 Disk set to /home/user/Desktop/var.

amrecover> ls

2011-09-21-19-18-44 test3

2011-09-21-19-18-44 test2

2011-09-21-19-18-44 test1

2011-09-21-19-18-44 .

amrecover> listdisk

200- List of disk for host 10.132.100.56

201- /home/user/Desktop/var

 

200 List of disk for host 10.132.100.56

amrecover> lpwd

/root/old

amrecover> add test2

Added file /test2

amrecover> extract

Extracting files using tape drive changer on host localhost.

The following tapes are needed: DailySet1-01

Extracting files using tape drive changer on host localhost.

Load tape DailySet1-01 now

Continue [?/Y/n/s/d]? y

Restoring files into directory /root/old

All existing files in /root/old can be deleted

Continue [?/Y/n]? y

./test2

amrecover> ls

2011-09-21-19-18-44 test3

2011-09-21-19-18-44 test2

2011-09-21-19-18-44 test1

2011-09-21-19-18-44 .

amrecover> exit

200 Good bye.

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!