Amanda

From DaqWiki
Revision as of 18:01, 2 March 2016 by Olchansk (talk | contribs) (New page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>TRIUMF AMANDA Backup System</title> </head> <body> <h1>TRIUMF AMANDA Backup System</h1> ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>

 <head>
   <title>TRIUMF AMANDA Backup System</title>
 </head>
 <body>

TRIUMF AMANDA Backup System

AMANDA information

AMANDA status (automatically updated)

  • <a href="recycle.txt">summary of virtual tape usage</a>
  • latest backup reports: <a href="summary.txt">summary</a>, <a href="reports/activity_last.txt">last run</a>, <a href="report s/log.txt">last amreport</a>, <a href="errors.txt">errors</a>, <a href="errorssummary.txt">summary of errors</a>
  • reports: <a href="index_perhost.html">per host</a>, <a href="index_perdate.html">per day</a>, <a href="index_peramreport.ht ml">amreport per day</a></a>
  • all backup files: <a href="all_files.txt">all files</a>
  • top users: <a href="top_files.txt">files</a>, <a href="top_fs.txt">file systems</a>, <a href="top_hosts.txt">hosts</a></a>
  • <a href="erase.txt">erased virtual tapes</a>
  • <a href="amcheck.txt">amcheck</a>
  • <a href="amstatus.txt">amstatus</a>
  • <a href="amoverview.txt">amoverview</a>
  • <a href="amdump.txt">last amdump</a>
  • <a href="amflush.txt">last amflush</a>
  • <a href="vtapes.txt">virtual tape slots</a>
  • <a href="amadmin_balance.txt">amadmin balance</a>
  • <a href="amadmin_disklist.txt">amadmin disklist</a>
  • <a href="amadmin_find.txt">amadmin find</a>
  • <a href="amadmin_info.txt">amadmin info</a>

Amanda administrators

The Amanda server is managed by <a href="http://it-services.triumf.ca/main-page">TRIUMF Computing & Network Services</a>. Please make requests via the <a href="https://helpdesk.triumf.ca"> TRIUMF help-desk</a>.

Instructions for clients

  • Adding a new Linux client:

               If your system was installed with a TRIUMF kickstart for
               SL-4.5 or later, then it already has the rpm
               "triumf-amanda".  In this case, you can skip the next step.
    

    • Prepare the client:
            ssh root@client
            edit ~amanda/.amandahosts, add line "amanda.triumf.ca amanda"
            edit /etc/hosts.allow, add line "amandad: amanda.triumf.ca"
            chkconfig xinetd on
            chkconfig amanda on
            service xinetd reload
      	    
    • Update contact information in the TRIUMF host database at http://trweb.triumf.ca/hostmonitor. When backup errors occur, amanda scripts will send an email to the user and the manager listed in the database.
    • Adjust firewall rules (if firewall is enabled):
         # Allow input from the backup server over UDP to the amanda port
         # and on any unprivileged TCP port
      
         iptables -I INPUT 1 -m state  --state NEW   -s 142.90.100.196 \
                             -p udp    --dport amanda        -j ACCEPT
         iptables -I INPUT 1 -m state  --state NEW   -s 142.90.100.196 \
                             -p tcp    --dport 1024:65535    -j ACCEPT
      
         # Make these changes permanent.  This assumes that you do not have
         # some other custom firewall-script.  In that case, you know what to do.
      
         service iptables save
      	    
    • Send a request via the <a href="https://helpdesk.triumf.ca"> TRIUMF help-desk</a> with "Please add filesystems /BAR and /BAZ on COMPUTERNAME to the AMANDA backup list, the contact person for this computer is SOMEBODY@triumf.ca". For typical desktop mac hines, one would backup only the directories containing user files, for server-type machines, one would also backup /etc, /var and /r oot.
  • Removing clients

    • Send an email to the amanda administrators requesting that the machine be removed from the amanda backup list.
    • (NOTE: once a client is removed from the backup list, normal data recycling will eventually delete the backup data from amanda. Backup data saved on amanda archive tapes is preserved forever)
    • ssh root@client; chkconfig amanda off
  • Restoring data from amanda

    • the AMANDA system does not support direct file recovery by individual users (sorry!)
    • the AMANDA system has many options for recovering data, but the simplest operations are recovery of a single file and r ecovery of a complete filesystem.
    • start by looking at the amanda index files (see links above) to see when the last backups are available for your machin e.
    • send an email to the amanda administrators asking them to do the data recovery. Ask for recovery of either a specific f ile or of a whole filesystem.

Instructions for troubleshooting failing clients

If an amanda client is failing backups, login to the client as root and try this:

  • Run "df", it should not hang
  • The system disk should have some free space
  • There should be no stuck amanda processes: "ps -efw | grep amanda" should return nothing. If you see any running amanda pro cesses, kill them.
  • xinetd should be running, do "service xinetd restart" if unsure
  • (on Solaris) inetd should be running, do "inetd -s" if unsure
  • Examine the log files in /var/log/amanda. Do "ls -ltr" to see the latest files. If any log files have size zero, the system disk may have been 100% full at that time, preventing amanda from working.
  • On the amanda server, as amada, run "amcheck -c daily host"

Instructions for adding a new client on the amanda server

      ssh root@amanda
      edit ~amanda/daily/disklist,
      add entry "client /home1 comp-user-tar # clientusername@triumf.ca"
      su - amanda
      run "amcheck -c daily"
    

Instructions for using bsdtcp authentication

   The default "bsd" authentication uses the UDP transport and sometimes has problems
   in the presence of packet loss on the network. In this case, try the "bsdtcp"
   authentication that uses the TCP transport.
  • On the client:
  • create file /etc/xinetd.d/amanda-bsdtcp:
    # default: off 
    # description:  The client for the Amanda backup system.\ 
    #               This must be on for systems being backed up\ 
    #               by Amanda. 
    service amanda 
    { 
            disable = no 
            socket_type             = stream 
            protocol                = tcp 
            wait                    = no 
            user                    = amandabackup 
            group                   = disk 
            server                  = /usr/sbin/amandad 
    # Configure server_args for the authentication type you will be using, 
    # and the services you wish to allow the amanda server and/or recovery 
    # clients to use. 
    # 
    # Change the -auth= entry to reflect the authentication type you use. 
    # Add amindexd to allow recovery clients to access the index database. 
    # Add amidxtaped to allow recovery clients to access the tape device. 
            server_args             = -auth=bsdtcp amdump 
    } 
        
  • chkconfig amanda off
  • chkconfig amanda-bsdtcp on
  • service xinetd reload
  • On the server:
  • in the disklist, replace dump type "comp-user-tar" with "bsdtcp-comp-user-tar"
  • su - amanda
  • amcheck -c daily ladd03

Instructions for data recovery (whole disk)

ssh root@amanda
mkdir /home1/amanda_recover
chown amanda.root /home1/amanda_recover/
su - amanda
cd /home1/amanda_recover

---> we will recover neut04:/etc

amadmin daily info neut04 /etc
---> prints:
Current info for neut04 /etc:
  Stats: dump rates (kps), Full:  475.0,  -1.0,  -1.0
                    Incremental:    2.0,  -1.0,  -1.0
          compressed size, Full:  20.8%,-100.0%,-100.0%
                    Incremental:   6.3%,  6.4%,  5.2%
  Dumps: lev datestmp  tape             file   origK   compK secs
          0  20041123  daily0001           5   18320    3802    8
          1  20041130  daily0007          10     650      41    0
---> note the backup levels, the tape numbers and file numbers:
---> level 0: tape daily0001, slot 1, file  5
---> level 1: tape daily0007, slot 7, file 10

ALTERNATIVE1 (extract tarballs on amanda, copy them to client, untar)
amrestore -f5 file:/home1/amanda/daily/vtapes/1 neut04 /etc   <--- level0 backup
amrestore -f10 file:/home1/amanda/daily/vtapes/7 neut04 /etc   <--- level1 backup
---> creates files neut04._etc.20041123.0, neut04._etc.20041130.1
scp neut04* neut04:
ssh root@neut04
mkdir etc
cd etc
tar xvBf - ~/neut04._etc.*.0
tar xvBf - ~/neut04._etc.*.1

ALTERNATIVE2 (extract data directly to the client, using ttcp)

(NOTE: If ttcp is not available, use the copy in amanda:~root
or in /triumfcs/trshare/olchansk/bin).

ssh root@neut04
mkdir etc
cd etc
ttcp -r | tar xzvBf -
(in another window)
(we are amanda@amanda)
amrestore -C -p -f5 file:/home1/amanda/daily/vtapes/1 neut04 /etc | ttcp -t neut04
(observe neut04 receiving and untaring the data)
(repeat with the level1 backup:)
(restart "ttcp | tar" on neut04)
amrestore -C -p -f10 file:/home1/amanda/daily/vtapes/7 neut04 /etc | ttcp -t neut04

ALTERNATIVE2a (extract data directly to the client, using netcat - standard in SL)
(pick any unused port allowed by iptables; amanda should be allowed between 1024:65535)

root@neut04: nc -l 12345 | tar -xvB
amanda@amanda: amrestore  -p -f5 file:/home1/amanda/daily/vtapes/1 neut04 /etc | nc neut04 12345
etc.

ALTERNATIVE3 (extract data without amanda tools)

Find out which amanda backup we will extract using "amadmin info" as above or
from the amanda listing at http://amanda.triumf.ca/~amanda/all_files.txt

Then run the "tar" command below ("dd" is needed to strip the amanda header),
substituting your vtape number for "38" and your file number amnd filename for "00383...".

dd if=/home1/amanda/daily/vtapes/38/data/00383.dork._home1.0 bs=32k skip=1 | tar xzvf -
    

(***THIS DOES NOT WORK***) Instructions for data recovery (individual files)

ssh root@amanda
run amrecover
amrecover> sethost tw04
amrecover> listdisk <----- get list of available disks
amrecover> setdisk /etc
amrecover> ls <---- look at the files
amrecover> add hosts  <---- add "hosts" to recovery list
amrecover> extract
...
The following tapes are needed: daily0020  <---- note tape number "20"
...
Restoring files into directory /root
Continue [?/Y/n]?   <---- YES
Load tape daily0020 now
Continue [?/Y/n/t]? t   <----- answer "t"
New tape device [?]: amanda.triumf.ca:file:/home1/amanda/daily/vtapes/20 <---- use tape number from above
./hosts
amrecover>
    

Instructions for data recovery (archived AMANDA backup tapes)

  • AMANDA backup tapes are made using "tar -M" from amanda:~root/backup.sh.
  • The catalog of these tapes, the output of "tar tvf", is created by running "verify.sh" and manually renaming it to amanda-backup- yyyy-mm-dd.txt.
  • To restore any file, look in the catalog to find out which tape(s) contains it.
  • a) If the file is contained on a single tape, restore it using "tar -b 2048 -xvf /dev/nst0 file1..." as usual.
  • b) If the file is split between several tapes, load both tapes into the tape robot into consecutive slots, then follow the exampl e in ~root/example-restore.sh (run "tar -C /home1/restore -M -b 2048 --new-volume-script="/root/loadNextTape.perl" --checkpoint -xvf /dev/nst0 amanda/daily/vtapes/79/data/00257.dork._home1.0")
  • This restores the amanda compressed backup file. Unpack it by running "dd if=00257.dork._home1.0 bs=32k skip=1 | tar xzvf -"

Last modified: Mon Jul 1 19:53:28 PDT 2013

 </body>

</html>