Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: OpenAFS backup with Amanda and Amanda-AFS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
fnjordy
n00b
n00b


Joined: 17 Feb 2005
Posts: 13

PostPosted: Sat Oct 15, 2005 9:11 am    Post subject: HOWTO: OpenAFS backup with Amanda and Amanda-AFS Reply with quote

HOWTO: OpenAFS backup with Amanda and Amanda-AFS

Introduction
OpenAFS is a distributed file system, Amanda is a backup system, Amanda-AFS is a set
of tools for Amanda to directly backup AFS volumes.

There is not much documentation available on Amanda-AFS, so here's a start, its a big
topic so hopefully it can be fleshed out with some more details later, including no doubt
numerous corrections.

amanda ebuild with afs support: https://bugs.gentoo.org/65711
amanda-afs ebuild: https://bugs.gentoo.org/65922
virtual tapes: http://www.amanda.org/docs/howto-filedriver.html

Amanda server:

install amanda
Code:
# emerge amanda

install xined
Code:
# emerge xinetd

edit amanda service /etc/xinetd.d/amanda enable all services and set restrictions as appropriate:
Code:
   service amanda {
   ...
      only_from   = amanda.example.com
      disable      = no
   }

allow amrestore from other hosts:
Code:
   service amandaidx {
   ...
      only_from   = .example.com
      disable      = no
   }

   service amidxtape {
   ...
      only_from   = amanda.example.com
      disable      = no
   }

and start and install as a default service
Code:
# /etc/init.d/xinetd start
# rc-update xinetd default

update amanda user
Code:
# vi /etc/passwd

change shell from /bin/false to /bin/sh in order for su to work.

setup profile
Code:
# mkdir /etc/amanda/daily
# gzcat /usr/share/doc/amanda-2.4.5/example/amanda.conf.gz > /etc/amanda/daily/amanda.conf
# vi /etc/amanda/daily/amanda.conf

update the following:
Code:
   org      "daily"
   mailto      "amanda@example.com"

choose a dump cycle, e.g. once every day mon-sat for 2 weeks:
Code:
   dumpcycle   2 weeks
   runspercycle   12

choose a few spare tapes for mistakes
Code:
   tapecycle   15

set a virtual tape changer
Code:
   tpchanger   "chg-disk"
   tapedev      "file://amandavtapes/daily"
   changerfile   "/etc/amanda/daily/changer"

specifiy holding directory
Code:
   directory   "/amandaholding"

specify directories amanda uses for various things, the default uses the same
directory for logs but this becomes a bit messy to view with ls.
Code:
   infofile   "/etc/amanda/daily/curinfo"
   logdir      "/etc/amanda/daily/log"
   indexdir   "/etc/amanda/daily/index"

define a virtual tape device, choose the tape size based on 90% of available space divided by
the tapecyle, e.g. 200GB * 0.90 / 15 = 12,288MB, I'm rounding down for a clear base 16 number
of 10GB:
Code:
   define tapetype HARD-DISK {
      comment "Dump onto hard disk (vtape)"
      length 10240 mbytes
   }

update location of exclude list file
Code:
   exclude list   "/etc/amanda/exclude.gtar"

create holding directory
Code:
# mkdir /amandaholding
# chown amanda:amanda /amandaholding

create space for virtual tapes
Code:
# mkdir -p /amandavtapes/daily
# chown -R amanda:amanda /amandavtapes

create each tape and label it
Code:
# for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> do
>    mkdir /amandavtapes/daily/slot${i}
>   amlabel daily daily`echo ${i}|awk '{ printf "%2.2d", $1 }'` slot ${i}
> done

set the default tape
Code:
# ln -s /amandavtapes/daily/slot1 /amandavtapes/daily/data

setup permissions
Code:
echo "amanda.example.com root" > /var/spool/amanda/.amandahosts


AFS server, Amanda client

install amanda & amanda-afs
Code:
# emerge amanda

install xinetd
Code:
# emerge xinetd

edit amanda service /etc/xinetd.d/amanda enable all services and set restrictions as appropriate:
Code:
   service amanda {
   ...
      only_from   = amanda.example.com
      disable      = no
   }

   service amandaidx {
   ...
      only_from   = amanda.example.com
      disable      = no
   }

   service amidxtape {
   ...
      only_from   = amanda.example.com
      disable      = no
   }

and start and install as a default service
Code:
# /etc/init.d/xinetd start
# rc-update xinetd default

update amanda user
Code:
# vi /etc/passwd

change shell from /bin/false to /bin/sh

create empty exclude file
Code:
# touch /etc/amanda/exclude.gtar


set amandahosts
Code:
# echo amanda.example.com > /var/spool/amanda/.amandahosts


On the AMANDA server create a disklist for backup, e.g.
Code:
# echo "afs.example.com      afs:afs.example.com/vicepa/.*.backup   comp-user-tar" > /etc/amanda/daily/disklist


It is easier to manage if you actually expand the regular expression, you could write a shell script around "vos listvol" if necessary. The benefit is seeing when each volume is updated with amrecover, and faster to restore from vtape because you don't have to pipe the entire volume set over the network.

Testing

test with amcheck:
Code:
# su - amanda -c "/usr/sbin/amcheck daily"

Amanda Tape Server Host Check
-----------------------------
Holding disk /amandaholding: 7312200 KB disk space available, that's plenty
amcheck-server: slot 1: date X        label daily1 (new tape)
NOTE: skipping tape-writable test
Tape daily1 label ok
Server check took 0.302 seconds

Amanda Backup Client Hosts Check
--------------------------------
Client check: 6 hosts checked in 9.315 seconds, 0 problems found

(brought to you by Amanda 2.4.5)

perform a manual backup
Code:
# su - amanda -c "/usr/sbin/amdump daily"


test a restore, the "-p" indicates we are piping out of amrestore, otherwise it will end up in /var/spool/amanda:
Code:
# ssh root@amanda.example.com "su - amanda -c \"/usr/sbin/amrestore \
                -p file://amandavtapes/daily afs.example.com 'afs:afs.example.com/vicepa/.*.backup' \" "
              | volset restore - user.debby.backup afs:afs.example.com/vicepa
amrestore:  1: skipping afs.example.com.afs:afs.example.com_vicepa_user.connie.backup.20051018.0
amrestore:  2: skipping afs.example.com.afs:afs.example.com_vicepa_user.betta.backup.20051018.0
amrestore:  3: restoring afs.example.com.afs:afs.example.com_vicepa_user.debby.backup.20051018.0
Restoring: user.debby.backup
Restoring volume user.debby.backup.r Id 536870958 on server afs.example.com partition /vicepa ..amrestore:  4: reached end of information
Done with user.debby.backup
 done
Restored volume user.debby.backup.r on afs /vicepa

this should appear as a new volume user.debby.backup.r
Code:
# vos listvol afs
user.debby                        536870936 RW       1384 K On-line
user.debby.backup                 536870938 BK       1384 K On-line
user.debby.backup.r               536870958 RW       1384 K On-line


install a crontab, edit the existing example in /etc/cron.daily/amanda on the amanda server:
Code:
#!/bin/sh

# check tapes, error is mailed to admin, then backup

export GNUTAR=/usr/sbin/gtar-wrapper.pl

su - amanda -c "/usr/sbin/amcheck -t -m daily && \
        ( /usr/sbin/amdump daily )"

The vtape changer cannot rewind tapes so you will have to manually reset the tape header when restoring, a starter script could be:
Code:
#!/bin/sh

cmd=${1:-current}
ssh root@amanda.example.com "su - amanda -c \"/usr/sbin/amtape daily slot $cmd\""

to rewind you can call
Code:
# set-tape current
amtape: changed to slot 13 on file://amandavtapes/daily
# set-tape 13
amtape: changed to slot 13 on file://amandavtapes/daily


good luck! :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum