Amanda: Difference between revisions

From DaqWiki
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 16: Line 16:
* http://www.zmanda.com - Amanda on zmanda.com
* http://www.zmanda.com - Amanda on zmanda.com
* http://wiki.zmanda.com - Amanda wiki
* http://wiki.zmanda.com - Amanda wiki
* https://github.com/zmanda/amanda - Amanda git repository on github


== AMANDA status (automatically updated) ==
== AMANDA status (automatically updated) ==
Line 43: Line 44:


* prepare backup client machine:
* prepare backup client machine:
* RHEL7/SL7/CentOS7: https://www.triumf.info/wiki/DAQwiki/index.php/SLinstall#Enable_AMANDA_backups_.28CentOS7.29
* Ubuntu LTS 20.04 - [[Ubuntu#Install_amanda_client]]
* RHEL7/SL7/CentOS7 - [[SLinstall#Enable_AMANDA_backups_.28CentOS7.29]]
* RHEL/SL/4/5/6:
* RHEL/SL/4/5/6:
<pre>
<pre>
Line 84: Line 86:


== Restoring data from amanda ==
== Restoring data from amanda ==
<ul>
  <li>the AMANDA system does not support direct file recovery by individual users (sorry!)
  <li>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.
  <li>start by looking at the amanda index files (see links above) to see when the last backups are available for your machin
e.
  <li>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.
</ul>
    </ul>


To recover files from amanda:
* examine the list of all available backup files: https://daq.triumf.ca/~daqweb/amanda/all_files.txt
* identify the backup files to be restored. For restoration of deleted files, this would be the latest full backup (level 0), the latest level 1 backup, the latest level 2 backup, etc.
* if this is an emergency (you need the files right away, or you need files from a backup older than the latest full backup), contact [http://www.triumf.ca/profiles/3103 Konstantin Olchanski] by email or SMS to the listed cell phone number.
* send a request to the DAQ group asking to retrieve the amanda backup files. Typically with rsync or scp these files from amanda to disk storage on some client machine.
* unpack the amanda backup files: (for full restoration, untar the amanda incremental backups files consecutively)
<pre>
dd if=00004.titan00._home1.0 bs=32k skip=1 | tar xzvf -
dd if=00055.titan00._home1.1 bs=32k skip=1 | tar xzvf -
dd if=00114.titan00._home1.2 bs=32k skip=1 | tar xzvf -
etc...
</pre>


== Adding a new client on the amanda server ==


<h2>Instructions for adding a new client on the amanda server</h2>
* ssh root@amanda
* edit ~amanda/daily/disklist,
* add entry "clienthostname /home1 comp-user-tar # clientusername@triumf.ca"
* su - amanda
* run "amcheck -c daily"
* if amcheck is not happy, follow instructions for troubleshooting failing client


    <pre>
== Instructions for using bsdtcp authentication (Obsolete) ==
      ssh root@amanda
      edit ~amanda/daily/disklist,
      add entry "client /home1 comp-user-tar # clientusername@triumf.ca"
      su - amanda
      run "amcheck -c daily"
    </pre>


    <h2>Instructions for using bsdtcp authentication</h2>
NOTE: Information in this section is obsolete


     The default "bsd" authentication uses the UDP transport and sometimes has problems
     The default "bsd" authentication uses the UDP transport and sometimes has problems
Line 149: Line 153:
     </ul>
     </ul>


    <h2>Instructions for data recovery (whole disk)</h2>
== Restoring data from archive USB HDDs ==
 
    <pre>
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 -
    </pre>
 
    <h2>(***THIS DOES NOT WORK***) Instructions for data recovery (individual files)</h2>


    <pre>
Archive USB HDDs contain an rsync copy of amanda system files and of the latest full backups. Incremental backups are not archived.
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>
    </pre>


    <h2>Instructions for data recovery (archived AMANDA backup tapes)</h2>
To restore the data, mount the USB disk *read only*, identify the backups file (use find . | grep clienthostname), copy the backup file to local storage, unmount, disconnect the archive disk, recover individual files per instructions above (dd if=00004.titan00._home1.0 bs=32k skip=1 | tar xzvf -).


== Restoring data from archive SDLT tapes ==
     <ul>
     <ul>
<li>AMANDA backup tapes are made using "tar -M" from amanda:~root/backup.sh.
<li>AMANDA backup tapes are made using "tar -M" from amanda:~root/backup.sh.
Line 256: Line 171:
<li>This restores the amanda compressed backup file. Unpack it by running "dd if=00257.dork._home1.0 bs=32k skip=1 | tar xzvf -"
<li>This restores the amanda compressed backup file. Unpack it by running "dd if=00257.dork._home1.0 bs=32k skip=1 | tar xzvf -"
     </ul>
     </ul>
    <hr>
<!-- Created: Tue Oct 19 22:55:05 PDT 2004 -->
<!-- hhmts start -->
Last modified: Mon Jul  1 19:53:28 PDT 2013
<!-- hhmts end -->
  </body>
</html>

Latest revision as of 18:19, 27 January 2021

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.

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"

Restoring data from amanda

To recover files from amanda:

  • examine the list of all available backup files: https://daq.triumf.ca/~daqweb/amanda/all_files.txt
  • identify the backup files to be restored. For restoration of deleted files, this would be the latest full backup (level 0), the latest level 1 backup, the latest level 2 backup, etc.
  • if this is an emergency (you need the files right away, or you need files from a backup older than the latest full backup), contact Konstantin Olchanski by email or SMS to the listed cell phone number.
  • send a request to the DAQ group asking to retrieve the amanda backup files. Typically with rsync or scp these files from amanda to disk storage on some client machine.
  • unpack the amanda backup files: (for full restoration, untar the amanda incremental backups files consecutively)
dd if=00004.titan00._home1.0 bs=32k skip=1 | tar xzvf -
dd if=00055.titan00._home1.1 bs=32k skip=1 | tar xzvf -
dd if=00114.titan00._home1.2 bs=32k skip=1 | tar xzvf -
etc...

Adding a new client on the amanda server

  • ssh root@amanda
  • edit ~amanda/daily/disklist,
  • add entry "clienthostname /home1 comp-user-tar # clientusername@triumf.ca"
  • su - amanda
  • run "amcheck -c daily"
  • if amcheck is not happy, follow instructions for troubleshooting failing client

Instructions for using bsdtcp authentication (Obsolete)

NOTE: Information in this section is obsolete

   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

Restoring data from archive USB HDDs

Archive USB HDDs contain an rsync copy of amanda system files and of the latest full backups. Incremental backups are not archived.

To restore the data, mount the USB disk *read only*, identify the backups file (use find . | grep clienthostname), copy the backup file to local storage, unmount, disconnect the archive disk, recover individual files per instructions above (dd if=00004.titan00._home1.0 bs=32k skip=1 | tar xzvf -).

Restoring data from archive SDLT 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 -"