Ubuntu Linux, ubuntu desktop, Linux operating system, ubuntu guide

Amanda Backup Using Virtual Tape on Ubuntu

by on May.28, 2010, under Amanda, Backup, Ubuntu, ubuntu 10.04, Ubuntu 9.10

Amanda Client

Here We are using two clients one is backup.ubuntulinux.co.in and another one is the same amdanda server ubuntulinux.co.in.

Install AMANDA client

Install the AMANDA client app

sudo apt-get install amanda-client

Create necessary amanda directory ( It is not needed for the server ubuntulinux.co.in)

sudo mkdir -p -m 770 /etc/amanda

Change owner

sudo chown -R backup.backup /etc/amanda

Become the backup user

su backup

Create an excludes file

touch /etc/amanda/exclude.gtar

Edit /etc/amandahosts to allow server to connect to client machine for backups

localhost backup
backup.ubuntulinux.co.in backup
ubuntulinux.co.in backup

Create xinetd amanda entry

sudo vim /etc/xinetd.d/amanda

Edit the file, mine looks like

# default: on
#
# description: Amanda services for Amanda client.
#
service amanda
{
bind               = backup.ubuntulinux.co.in
socket_type  = dgram
protocol         = udp
wait                 = yes
user                 = backup
group              = backup
groups            = yes
server              = /usr/lib/amanda/amandad
server_args      = -auth=bsd amdump
disable          = no
}

Each of these lines is very important. The “bind” line will probably not be necessary for most configurations – this is in place because I have 2 different IP addresses binding to the same device (eth0 aliases).

Restart xinetd

sudo /etc/init.d/xinetd restart

Edit /etc/services to look like

#
# Amanda Services
#
amanda          10080/udp
amanda          10080/tcp
kamanda         10081/udp
kamanda         10081/tcp
amandaidx       10082/tcp
amidxtape       10083/tcp

Make sure your /etc/inetd.conf looks like


amanda dgram udp wait backup /usr/sbin/tcpd /usr/lib/amanda/amandad

On the Server

Verify Configuration
Run amcheck on Server to verify configuration files, connections, etc lgoin as backup user
Code:

amcheck DailySet1
Output looks like
Cod

backup@ubuntulinux:~$ amcheck DailySet1
Amanda Tape Server Host Check
Holding disk /dumps/amanda: 4478364 KB disk space available, using 4375964 KB
slot 2: read label `DailySet1-02′, date `X’
NOTE: skipping tape-writable test
Tape DailySet?1-02 label ok
Server check took 0.112 seconds
Amanda Backup Client Hosts Check
Client check: 2 host checked in 0.017 seconds, 0 problems found
(brought to you by Amanda 2.5.1p3)

For taking the backup
amdump Dailyset1
Amrecover

amrecover — Amanda index database browser

Amrecover browses the database of Amanda index files to determine which tapes contain files to recover. Furthermore, it is able to recover files.

In order to restore files in place, you must invoke amrecover from the root of the backed up filesystem, or use lcd to move into that directory, otherwise a directory tree that resembles the backed up filesystem will be created in the current directory. See the examples below for details.

Amrecover should be run as root user.

Amrecover will the read the amanda-client.conf file and the config/amanda-client.conf file. If no configuration name is supplied on the command line, Amrecover will try the compiled-in default configuration, usually DailySet?1.

Edit the following lines in amanda-client.conf

conf “DailySet1″ # your config name

index_server “ubuntulinux.co.in” # your amindexd server
tape_server “ubuntulinux.co.in” # your amidxtaped server
tapedev “file:/amandabackup/DailySet?1/slots” # your tape device

Example
root@ubuntulinux:~# amrecover
AMRECOVER Version 2.5.1p3. Contacting server on localhost …
220 ubuntulinux AMANDA index server (2.5.1p3) ready.
Setting restore date to today (2008-04-22)
200 Working date set to 2008-04-22.
200 Config set to DailySet?1.
200 Dump host set to ubuntulinux.co.in.
Use the setdisk command to choose dump disk to recover
amrecover> ls
Must select a disk before listing files; use the setdisk command.
amrecover> help
valid commands are:

add path1 … – add to extraction list (shell wildcards)
addx path1 … – add to extraction list (regular expressions)
cd directory – change cwd on virtual file system (shell wildcards)
cdx directory – change cwd on virtual file system (regular expressions)
clear – clear extraction list
delete path1 … – delete from extraction list (shell wildcards)
deletex path1 … – delete from extraction list (regular expressions)
extract – extract selected files from tapes
exit
help
history – show dump history of disk
list [filename] – show extraction list, optionally writing to file
lcd directory – change cwd on local file system
ls – list directory on virtual file system
lpwd – show cwd on local file system
mode – show the method used to extract SMB shares
pwd – show cwd on virtual file system
quit
listhost – list hosts
listdisk [diskdevice] – list disks
setdate {YYYY-MM-DD|–MM-DD|—DD} – set date of look
{YYYY-MM-DD-HH-MM-SS} – set date of look
setdisk diskname [mountpoint] – select disk on dump host
sethost host – select dump host
settape [host:][device|default] – select tape server and/or device
setmode smb|tar – select the method used to extract SMB shares

amrecover> listhost
200- List hosts for config DailySet1
201- ubuntulinux.co.in
200 List hosts for config DailySet1
amrecover> listdisk
200- List of disk for host ubuntulinux.co.in
201- /Project
200 List of disk for host ubuntulinux.co.in
amrecover> setdisk /Project /Documents
200 Disk set to /Project.
amrecover> lpwd
/root
amrecover> ls
2008-04-22 ubunutlinux/
2008-04-22 new/
2008-04-22 myproject/
2008-04-22 lost+found/

amrecover> add myproject
Added dir /myproject/ at date 2008-04-22
amrecover> lpwd
/root
amrecover> extract

Extracting files using tape drive @DEFAULT_TAPE_DEVICE@ on host localhost.
The following tapes are needed: DailySet1-01

Restoring files into directory /root
Continue [?/Y/n]? y

Extracting files using tape drive @DEFAULT_TAPE_DEVICE@ on host localhost.
Load tape DailySet1-01 now
Continue [/Y/n/s/t]? y
Label mismatch, got DailySet?1-02 and expected DailySet?1-01
Looking for tape DailySet?1-01…
./myproject/
./myproject/.bzr/
./myproject/.bzr/branch/
./myproject/.bzr/branch-lock/
./myproject/.bzr/branch/lock/
./myproject/.bzr/repository/
./myproject/.bzr/repository/knits/
./myproject/.bzr/repository/lock/
./myproject/.bzr/repository/revision-store/
./myproject/.bzr/README
./myproject/.bzr/branch-format
./myproject/.bzr/branch/branch-name
./myproject/.bzr/branch/format
./myproject/.bzr/branch/revision-history
./myproject/.bzr/repository/format
./myproject/.bzr/repository/inventory.kndx
./myproject/.bzr/repository/inventory.knit
./myproject/.bzr/repository/revisions.kndx
./myproject/.bzr/repository/revisions.knit
./myproject/.bzr/repository/signatures.kndx
./myproject/.bzr/repository/signatures.knit
amrecover> quit
200 Good bye.

Page 1


5 Comments for this entry

  • Debian Lovers

    Very usefull info

  • Div

    amrecover> listhost
    200- List hosts for config Weekly
    200 No hosts for config Weekly
    amrecover> listdisk
    501 Must set host before listdisk
    amrecover>

    How can add hosts and get a list of hosts here?

  • sahab

    Did you added the amanda client installed machine and backup dirve in “disklist”

  • Div

    ubuntu@ubuntu-linux:~/divya_amanda$ sudo amrecover
    AMRECOVER Version 2.6.1p1. Contacting server on 192.168.0.11 …
    220 divya-linux AMANDA index server (2.6.1p1) ready.
    Setting restore date to today (2012-01-02)
    200 Working date set to 2012-01-02.
    200 Config set to weekly.
    501 Host ubuntu-linux is not in your disklist.
    Trying host ubuntu-linux …
    501 Host ubuntu-linux is not in your disklist.
    Trying host ubuntu-linux …
    501 Host ubuntu-linux is not in your disklist.
    Use the sethost command to choose a host to recover
    amrecover> sethost 192.168.0.11
    200 Dump host set to 192.168.0.11.
    amrecover> listdisk
    200- List of disk for host 192.168.0.11
    201- /backups/weekly/slots
    200 List of disk for host 192.168.0.11
    amrecover> setdisk /backups/weekly/slots
    200 Disk set to /backups/weekly/slots.
    No index records for disk for specified date
    If date correct, notify system administrator
    amrecover> ls
    amrecover>
    On server side
    /backups/weekly/slots$ ls
    data slot1 slot2 slot3 slot4 slot5

    This has data as well. From server I am able to restore data to any folder. But from ubuntu client machine I am unable to restore this data.

  • sahab

    Follow this example

    amrestore -p /dev/rmt/0cn katastrov ‘/home$’ | ssh -l root katastrov gtar -xpGvf – ./the/files

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!