Disk Backup With Amanda On Debian Lenny - Page 2

Want to support HowtoForge? Become a subscriber!
 
Submitted by ycardonguard (Contact Author) (Forums) on Tue, 2010-06-15 16:44. ::

3.2 Backup Client

3.2.1 Installation

As user root install the amanda-client package.

# apt-get update

# apt-get install amanda-client xinetd openssh-server

 Accept the additional packages required when prompted.

 

3.2.2 (If Applicable) Comment Amanda Entries In Inetd Configuration File

The packages configure both inetd and xinetd. In this howto we only use xinetd.

Edit /etc/inetd.conf and comment amanda related lines:

#:OTHER: Other services
#amanda dgram udp wait backup /usr/sbin/tcpd /usr/lib/amanda/amandad -auth=bsd amdump amindexd amidxtaped

 

3.2.3 Modify Amanda Daemons To Use auth bsdtcp

For details check the wiki.

Edit amanda, amidxtape and amandaidx files in /etc/xinetd.d/ to match the following:

# cat /etc/xinetd.d/amanda| grep -v "^#"

service amanda
{
socket_type = stream
protocol = tcp
wait = no

user = backup
group = backup
groups = yes
server = /usr/lib/amanda/amandad
server_args = -auth=bsdtcp amdump amindexd amidxtaped
disable = no
}

Enable changes:

# /etc/init.d/xinetd restart

 

3.2.4 Client Configuration: amanda-client.conf

# vi /etc/amanda/amanda-client.conf

conf "DailySet1" # your config name
index_server "bckserver.mydomain.com" # your amindexd server
tape_server "bckserver.mdomain.com" # your amidxtaped server


auth "bsdtcp"

 

3.2.5 Authorizations: amandahosts

Edit the amandahosts file to allow backups from bckserver:

# vi /etc/amanda/amandahosts

bckserver.mydomain.com backup amdump

The line "bckserver.mydomain.com backup amdump" allows user backup from bckserver to run backups on bckclient.

Details on file syntax and authentification  here.

Note: Since we use fully qualified domain names, your name resolution (/etc/hosts or DNS and reverse DNS) must be correctly set up and tested. If you are unsure use IP addresses.

# ls -la /var/backups/.amandahosts

lrwxrwxrwx 1 root root 23 mai 25 11:19 /var/backups/.amandahosts -> /etc/amanda/amandahosts


# ls -l /etc/amanda/amandahosts

-rw------- 1 backup backup 42 mai 26 23:21 /etc/amanda/amandahosts



3.2.6 Exclude List

As user backup create an exclude list. Bare in mind paths are relative. More details here.

$ vi /etc/amanda/DailySet1/global-debian-exclude.list

./proc
./media
./mnt
./dev

chmod 644 /etc/amanda/DailySet1/global-debian-exclude.list

Note: in my example the exclude list applies to the 3 filesystems. If you want to avoid this, define different exclude lists related to differents dumptypes and modify disklist file accordingly.


3.3 Tests

3.3.1 Config Test

Log on as user backup on bckserver and issue the following command:

$ amcheck DailySet1

Amanda Tape Server Host Check
-----------------------------
Holding disk /dumps/: 48800396 kB disk space available, using 48800396 kB
slot 2: read label `DailySet1-02', date `20100607'
cannot overwrite active tape DailySet1-02
slot 3: read label `DailySet1-03', date `X'
NOTE: skipping tape-writable test
Tape DailySet1-03 label ok
NOTE: host info dir /etc/amanda/DailySet1/curinfo/bckclient.mydomain.com does not exist
NOTE: it will be created on the next run.
NOTE: index dir /etc/amanda/DailySet1/index/bckclient.mydomainman .com does not exist
NOTE: it will be created on the next run.
Server check took 0.115 seconds

Amanda Backup Client Hosts Check

--------------------------------
Client check: 1 host checked in 0.132 seconds, 0 problems found

(brought to you by Amanda 2.5.2p1)

 

3.3.2 Backup Test

Log on as user backup on bckserver and issue the following command:

$ amdump DailySet1

Note: to force a full backup issue the follwing command before the amdump:

$ amadmin DailySet1 force bckclient.mydomain.com

On completion check backup_admin@mydomain.com mails for a backup notification.

 Hostname: bckserver
Org     : DailySet1
Config  : DailySet1
Date : June 7, 2010

These dumps were to tape DailySet1-03.
The next tape Amanda expects to use is: a new tape.
The next new tape already labelled is: DailySet1-04.


STATISTICS:
                          Total       Full      Incr.
     -------- --------   --------
Estimate Time (hrs:min)    0:00
Run Time (hrs:min)    0:06
Dump Time (hrs:min)        0:05       0:05       0:00
Output Size (meg)         766.7      766.7        0.0
Original Size (meg)      1363.0     1363.0        0.0
Avg Compressed Size  56.3       56.3        --
Filesystems Dumped            1          1          0
Avg Dump Rate (k/s)      2730.3     2730.3        --
Tape Time (hrs:min)        0:01       0:01       0:00
Tape Size (meg)           766.8      766.8        0.0
Tape Used              15.0       15.0        0.0
Filesystems Taped             1          1          0
Chunks Taped                  0          0          0
Avg Tp Write Rate (k/s)  9490.5     9490.5        --

USAGE BY TAPE:
  Label              Time      Size      %    Nb    Nc
  DailySet1-03       0:01   785152k   15.0     1     0


NOTES:
  planner: tapecycle (9) <= runspercycle (10)
  planner: Adding new disk bckclient.mydomain.com:/.
  driver: WARNING: This is not the first amdump run today. Enable the usetimestamps option in the configuration file if you want to run amdump more than once per calendar day.
  taper: tape DailySet1-03 kb 785184 fm 1 [OK]
  small estimate: bckclient.mydomain.com / 0
                  est: 697920k    out 785152k


DUMP SUMMARY:
                                       DUMPER STATS               TAPER STATS
HOSTNAME     DISK        L ORIG-kB  OUT-kB  COMP%  MMM:SS   KB/s MMM:SS   KB/s
-------------------------- ------------------------------------- -------------
bckclient /       0 1395720  785152   56.3    4:48 2730.3   1:23 9490.4
bckclient /boot       0   16320   15520   95.1    0:04 4324.4   0:00 98858.5
bckclient -mysite.com 0   34750   11488   33.1    0:09 1228.3   0:01 16425.6

(brought to you by Amanda version 2.5.2p1)

$ amadmin DailySet1 find

date       host                           disk                    lv tape or file file part status
2010-06-07 bckclient.mydomain.com         /                        1 DailySet1-04    1   -- OK
2010-06-07 bckclient.mydomain.com / 1 DailySet1-05 1 -- OK
2010-06-07 bckclient.mydomain.com / 1 DailySet1-06 1 -- OK
2010-06-07 bckclient.mydomain.com / 0 DailySet1-01 0 -- FAILED (dumper) [port open: Connection timed out]
2010-06-07 bckclient.mydomain.com / 0 DailySet1-01 0 -- FAILED (dumper) [port open: Connection timed out]
2010-06-07 bckclient.mydomain.com / 0 DailySet1-02 0 -- FAILED (dumper) [port open: Connection timed out]
2010-06-07 bckclient.mydomain.com / 0 DailySet1-02 0 -- FAILED (dumper) [port open: Connection timed out]
2010-06-07 bckclient.mydomain.com / 0 DailySet1-03 1 -- OK
2010-06-07 bckclient.mydomain.com / 0 DailySet1-07 1 -- OK
2010-06-07 bckclient.mydomain.com / 0 DailySet1-08 3 -- OK
2010-06-07 bckclient.mydomain.com /boot 0 DailySet1-08 1 -- OK
2010-06-07 bckclient.mydomain.com /var/www/www.mysite.com 0 DailySet1-08 2 -- OK
 

 

3.4 Backup Scheduling 

Daily backup every day at 1:00AM:

# su  backup -c "crontab -e"

0 1 * * 1-7 /usr/sbin/amdump DailySet1

 

3.5 Restore

3.5.1 Backup Client Configuration

Log on as user root on the bckclient.

Create an amanda-client.conf file:

# su backup -c "mkdir /etc/amanda"

# vi /etc/amanda/amanda-client.conf

conf "DailySet1" # your config name (used for restore)
index_server "bckserver.mydomain.com" # your amindexd server
tape_server "bckserver.mydomain.com" # your amidxtaped server
auth "bsdtcp"

# ls -ltr /etc/amanda/DailySet1/amanda-client.conf

lrwxrwxrwx 1 root root 30 mai 25 17:50 /etc/amanda/DailySet1/amanda-client.conf -> /etc/amanda/amanda-client.conf

Note: If you mix weekly (long retention) and daily backups (short retention) for the same backup client you will have to specify the right conf (WeeklySet1 or DailySet1) for restore.

 

3.5.2 Recover

As user root on bckclient cd to a suitable place for restore (/tmp for example) and issue the following command:

# amrecover

AMRECOVER Version 2.5.2p1. Contacting server on bckserver.mydomain.com ...
220 bckserver AMANDA index server (2.5.2p1) ready.
Setting restore date to today (2010-06-07)
200 Working date set to 2010-06-07.
200 Config set to DailySet1.
501 Host bckclient is not in your disklist.
Trying host bckclient.mydomain.com ...
200 Dump host set to bckclient.mydomain.com.
Use the setdisk command to choose dump disk to recover

amrecover> listdisk

200- List of disk for host bckclient.mydomain.com
201- /

201- /var/www/www.mysite.com
201- /boot

amrecover> setdisk /var/www/www.mysite.com

200 Disk set to /var/www/www.mysite.com.

amrecover> ls

2010-06-07 xmlrpc/
2010-06-07 tmp/
2010-06-07 templates/
2010-06-07 robots.txt
2010-06-07 plugins/
2010-06-07 modules/
2010-06-07 logs/
2010-06-07 libraries/
2010-06-07 language/
2010-06-07 index2.php
2010-06-07 index.php
2010-06-07 includes/
2010-06-07 images/
2010-06-07 htaccess.txt
2010-06-07 configuration.php-dist
2010-06-07 configuration.php
2010-06-07 components/
2010-06-07 cache/
2010-06-07 aicontactsafe/
2010-06-07 administrator/
2010-06-07 LICENSES.php
2010-06-07 LICENSE.php
2010-06-07 INSTALL.php
2010-06-07 CREDITS.php
2010-06-07 COPYRIGHT.php
2010-06-07 CHANGELOG.php
2010-06-07 .htaccess
2010-06-07 .

amrecover> add *

Added dir /xmlrpc/ at date 2010-06-07
Added dir /tmp/ at date 2010-06-07
Added dir /templates/ at date 2010-06-07
Added file /robots.txt
Added dir /plugins/ at date 2010-06-07
Added dir /modules/ at date 2010-06-07
Added dir /logs/ at date 2010-06-07
Added dir /libraries/ at date 2010-06-07
Added dir /language/ at date 2010-06-07
Added file /index2.php
Added file /index.php
Added dir /includes/ at date 2010-06-07
Added dir /images/ at date 2010-06-07
Added file /htaccess.txt
Added file /configuration.php-dist
Added file /configuration.php
Added dir /components/ at date 2010-06-07
Added dir /cache/ at date 2010-06-07
Added dir /aicontactsafe/ at date 2010-06-07
Added dir /administrator/ at date 2010-06-07
Added file /LICENSES.php
Added file /LICENSE.php
Added file /INSTALL.php
Added file /CREDITS.php
Added file /COPYRIGHT.php
Added file /CHANGELOG.php
Added file /.htaccess

amrecover> extract

Extracting files using tape drive chg-disk on host bckserver.mydomain.com.
The following tapes are needed: DailySet1-08

Restoring files into directory /tmp

Continue [?/Y/n]? y

Extracting files using tape drive chg-disk on host bckserver.mydomain.com.
Load tape DailySet1-08 now

Continue [?/Y/n/s/t]? y

./administrator/
./administrator/backups/

Note:

tree navigation with cd

time navigation with setdate.

restore to another host with sethost

4. References Used To Build This Howto:

The 15-Minute Backup Solution

Quick start

Disk Based Backups With Amanda On Debian Etch


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Rick Stanley (not registered) on Thu, 2010-06-17 17:32.

Why would you install xinetd just for the daemon?  My servers usually use daemontools. <a href="http://cr.yp.to/daemontools.html">Daemontools</a>  I also install djbdns <a href="http://cr.yp.to/djbdns.html">DNS Name/Resolver Server</a> on at least two servers, so I would not then install xinetd just for Amanda.

Have you ever used daemontools or at least looked at it?

Thanks for the article!

Submitted by ycardonguard (not registered) on Fri, 2010-06-18 16:05.

Hi,

sounds like you are one of Bernstein's ayatollah =)

 inetd, xinetd, daemontools ... it is up to you. I chose xinetd because if fits my needs and it is simple to get it to works. For daemontools replace the xinetd section with this.

By the way I am surprised you did not also promote qmail or ucspi-tcp in your comment ;).

 cheers