Setting Up Amanda Test Environment
Amanda Server (includes client): CentOS 5.2 Amanda Client: CentOS 4.4 Prerequisite: tar 1.15
Amanda is an open source backup and archiving software. It uses tar format for the backup data storage.
Below are the configuration notes adopted from the Amanda wiki.
Installing Amanda server
- Download the Amanada from this website. Select Redhat Enterprise version for the CentOS platform.
- Amanda packages create "amandabackup" user as the Amanda user. All the installed binaries have "amandabackup" as the owner and "disk" as the group name. The home directory for the user "amandabackup" will be /var/lib/amanda.
Getting configuration information
We need to know the configuration parameters in order to configure the Amanda. Run the following commands as a root user. Client Login
/usr/sbin/amadmin xx version | grep CLIENT_LOGIN
Configuration directory:
/usr/sbin/amadmin xx version | grep CONFIG_DIR
Debug output
/usr/sbin/amadmin xx version | grep AMANDA_DBGDIR
Binary installation directory:
/usr/sbin/amadmin xx version | grep libexecdir
tar - incremental backup listing dir
/usr/sbin/amadmin xx version | grep listed_incr_dir
Configuring Amanda Server
- Amanda runs as a normal (non-root) user and the user should be in the disk group. The rpm package automatically creates amanda user. If for some reason it is not created then use following command to create a new Amanda user:
useradd -u amandabackup -g disk -d /var/lib/amanda -s /bin/bash -c ...
- Change the password to unlock amanda user account:
usermod -p "<new-password>" <account-name>
- Following is a script from the Amanda quick start guide to update PATH variable if needed:
# Prepend these directories to PATH if needed for d in /usr/local/bin /usr/local/sbin do case :$PATH: in *:$d:*) : ;; *) PATH=$d:$PATH ;; esac done
- We will be creating a new backup profile for every specific backup. To run a specific backup we will use this backup profile which defines source and destination paths. Let us create a new backup profile named test. Before that, We need to change ownership of /etc/amanda directory to the amanada user.
chown -R amandabackup:disk /etc/amanda su - amandabackup mkdir -p /etc/amanda/test
- Copy example amanda configuration file(/var/lib/examples/amanda.conf) into your test profile (/etc/amanda/test) and make sure following configuration is defined. The directories curinfo and index are created automatically after the first run (amdump) if amanda user (amandabackup) has write permission in the /etc/amanda directory.
logdir "/etc/amanda/test" # log directory infofile "/etc/amanda/test/curinfo" # database filename indexdir "/etc/amanda/test/index" # index directory tapelist "/etc/amanda/test/tapelist" # list of used tapes
- Create tapelist file with appropriate permission as follows.
touch /etc/amanda/test/tapelist
- Specify holding disk in the configuration file. We will create it at a later stage.
holdingdisk hd1 { comment "test - main holding disk" directory "/space/amandahold/test" # where the holding disk is use -100 Mb # how much space can we use on it # a non-positive value means: # use all space but that value chunksize 1Gb # size of chunk if you want big dump to be # dumped on multiple files on holding disks # N Kb/Mb/Gb split images in chunks of size N # The maximum value should be # (MAX_FILE_SIZE - 1Mb) # 0 same as INT_MAX bytes } }
- Create holding disk as follows (you may need to be logged in as a root user):
mkdir -p /space/amandahold/test chown -R amandabackup:disk /space/amandahold chmod 750 /space/amandahold
- Create virtual tapes as follows (you may need to be logged in as a root user):
mkdir -p /space/vtapes chown amandabackup:disk /space/vtapes chmod 750 /space/vtapes
- Switch to amandabackup user:
su - amandabackup
- Create slots on vtapes:
touch /etc/amanda/test/tapelist mkdir -p /space/vtapes/test/slots cd /space/vtapes/test/slots for ((i=1; $i<=25; i++)); do mkdir slot$i;done ln -s slot1 data
- Test whether virtual tape status is online:
ammt -f file:/space/vtapes/test/slots status
- The default values in amanda.conf are for the DailySet?1 profile. Make appropriate changes at the following lines
labelstr "^DailySet1-[0-9][0-9]*$" # label constraint regex: all tapes must match''' to match your conf name. tapedev "file://space/vtapes/test/slots" # the no-rewind tape device to be used changerfile "/etc/amanda/test/changer.conf tpchanger "chg-disk" # the tape-changer glue script tapetype HARDDISK
- Define tapetype HARDDISK
define tapetype HARDDISK { length 100000 mbytes }
- Label virtual tapes:
for ((i=1; $i<=9;i++)); do amlabel test test-0$i slot $i; done for ((i=10; $i<=25;i++)); do amlabel test test-$i slot $i; done
- Reset virtual tape back to the first slot:
amtape test reset
- Check for amanda entries in the /etc/services file. Add them if necessary:
amanda 10080/udp amandaidx 10082/tcp amidxtape 10083/tcp
- Create a disklist file in the same directory where amanda.conf resides. This file contains client address, files to be backed up, dump type information
bob.lab.ac.uab.edu /backup/disk3/pavgi/Desktop/MyStuff comp-user-tar
- Add auth type to the definition of global dumptype
auth "bsdtcp"
- Amanda services are started automatically by the network services. For xinetd service create a file called amandaserver and add following lines to it:
# default: on # # description: Amanda services for Amanda server and client. # service amanda { disable = no flags = IPv4 flags = IPv6 socket_type = stream protocol = tcp wait = no user = amandabackup group = disk groups = yes server = /usr/libexec/amanda/amandad server_args = -auth=bsdtcp amdump amindexd amidxtaped } - Restart xinetd service:
service xinetd reload
- For adding amcheck and amdump commands to the crontab, log in as a amanda user and then give following commands:
crontab -e
Installing Amanda Client
- Download the Amanada from this website. Select Redhat Enterprise version for the CentOS platform.
- Amanda packages create "amandabackup" user as the Amanda user. All the installed binaries have "amandabackup" as the owner and "disk" as the group name. The home directory for the user "amandabackup" will be /var/lib/amanda. Create this user account manually if necessary.
useradd -u amandabackup -g disk -d /var/lib/amanda -s /bin/bash -c ...
Configuring Amanda Client
- Create .amandahosts file in the home directory (/var/lib/amanda/) of the Amanda user. The format is the hostname of the server and the amanda user on the server,
bob.lab.ac.uab.edu amandabackup amdump 10.0.0.25 amandabackup amdump
- Edit ownership and permission of amandahosts file.
chown amandabackup ~amandabackup ~/.amandahosts chmod 755 ~amandabackup chmod 600 ~amandabackup/.amandahosts
- Create a network service startup file (xinetd on CentOS), /etc/xinetd.d/amandaclient as
# default: on # # description: Amanda services for Amanda 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 }
- Restart xinetd as
service xinetd reload
- The configuration file amanda-client.conf is covered in the recovery section, as it will be used during recovery process by client.
Verifying configuration
- Verify configuration using amcheck command
amcheck test
Run a backup
- To tun a backup:
amdump test
- To get a summary of a backup
amadmin test find
Recover data
- For rpm installations, you should see the file amanda-client.conf file in the /etc/amanda directory. You may copy example file from /var/lib/amanda/examples/amanda-client.conf to /etc/amanda directory.
- Change following lines to add server hostname
index_server "backupserver...lab.ac.uab.edu" # your amindexd server tape_server "backupserver...lab.ac.uab.edu" # your amidxtaped server
- Add/Change auth type to bsdtcp
auth "bsdtcp"
- Run amrecover on client machine
amrecover
- From the client machine give command listdisk to get list of disks on which data is backed up.
listdisk
- Select disk by specifying its path
setdisk /var/log/mysql
- Get directory and file list
ls
- Change directory if necessary using cd command. Add data using add command and specify directory/file name.
add mysql.log
- Specify location to store recovered files and then extract the data. Type in quit when done.
lcd /tmp extract
References:
Attachments
- amanda.conf (6.0 kB) -
amanda server configuration file
, added by pavgi@uab.edu on 10/30/08 14:14:27.
