Amanda

From DaqWiki
Jump to navigation Jump to search

Welcome

The AMANDA disk backup server is operated by the TRIUMF DAQ group as a backup and archiving service for data acquisition, detector facility and other computers systems in the ST department, Science division and other TRIUMF users.

Backups are stored on a 20TB disk array (RAID6/XFS). Backups are done on a 10 day schedule - full backup, level 1 incremental, level 2 incremental, etc, full backup, cycle repeats. Generally the system stores 2 full backups (the last full backup and the one before it) plus the incremental backups between them. Older full backups and older incrementals are stored space permitting.

Guaranteed data retention time is 10 days, typical data retention time is 1 month.

Periodically, amanda backups are archived to offline media (SDLT tapes, USB hard drives) stored in secure location and kept permanently.

AMANDA information

AMANDA status (automatically updated)

Use username: amanda, password: amanda

Adding backup clients

Note: currently only linux backup clients are documented. MacOS is known to work but amanda client package does not seem to be generally available.

      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
   # if local filewall is running (before RHEL/SL/CentOS7)
   # 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
   service iptables save
  • send a request to the DAQ group with following information: machine full hostname (i.e. titan00.triumf.ca), list of filesystems to backup (i.e. /home1, /etc) and a contact email address who will receive any error messages from failed backups.

Removing backup clients

Send a request to the DAQ group with the name of machine or filesystem to be removed, stop the amanda services on the client machine.

NOTE: once a client is removed from the amanda backup list, normal data recycling will eventually permanently delete the backup data from amanda. Backup data saved on amanda archive tapes is preserved forever.

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 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>