December 2012
Abstract
Failed attempt to use a LinkSys NSLU2 as a backup server with Amanda and Debian Wheezy
Procedure 9. Installing Amanda
Install both server and client
apprentice@slug:~$ apt-get install amanda-server amanda-client
apt-get autoremove
Procedure 10. Backing up a local directory
Creating some dirs
Create directories /home/amanda/slug and deeper, to this effect:
apprentice@host:~$ root@slug:# tree /home/amanda/slug/
/home/amanda/slug/
|-- holding
|-- state
|-- log
-- vtapes
|-- data -> slot0
|-- slot0
|-- slot1
|-- slot10
|-- slot2
|-- slot3
|-- slot4
|-- slot5
|-- slot6
|-- slot7
|-- slot8
|-- slot9
-- state
16 directories, 1 file
All these should be owned by the amanda user(, backup
in my case).
Create configuration files
Create /etc/amanda/slug-itself/amanda.conf
:
org "slug" infofile "/home/amanda/slug/state/curinfo" logdir "/home/amanda/slug/state/log" indexdir "/home/amanda/slug/state/index" dumpuser "root" tpchanger "chg-disk:/home/amanda/slug/vtapes" property "num-slot" "10" property "auto-create-slot" "yes" property "removable" "no" property "mount" "no" property "umount" "no" labelstr "slug[0-9][0-9]" autolabel "slug%%" EMPTY VOLUME_ERROR tapetype "TEST-TAPE" define tapetype TEST-TAPE { length 100 mbytes filemark 4 kbytes } define dumptype simple-gnutar-local { auth "local" compress none program "GNUTAR" } holdingdisk hd1 { directory "/home/amanda/slug/holding" use 50 mbytes chunksize 1 mbyte }
... and /etc/amanda/slug-itself/disklist
:
localhost /etc simple-gnutar-local
Test the configuration
root@slug:# amcheck slug-itself
Amanda Tape Server Host Check
-----------------------------
Holding disk /home/amanda/slug/holding: 820539392 kB disk space available, using 51200 kB as requested
found in slot 0: volume 'slug01'
slot 0: volume 'slug01' is still active and cannot be overwritten
found in slot 1: contains an empty volume
slot 1: contains an empty volume
Will write label 'slug02' to new volume in slot 1.
NOTE: skipping tape-writable test
Server check took 15.310 seconds
Amanda Backup Client Hosts Check
--------------------------------
Client check: 1 host checked in 6.227 seconds. 0 problems found.
(brought to you by Amanda 3.3.1)
Actually run the backup
Now we should be able to back up /etc:
root@slug:# amdump slug-itself && echo success
success
But when there is no 'tape', the exit status will still be zero, but nothing will have been backed up, so be sure to check:
root@slug:# amreport slug-itself
Hostname: slug
Org : slug
Config : slug-itself
Date : December 30, 2012
These dumps were to tape slug01.
The next tape Amanda expects to use is: 1 new tape.
STATISTICS:
Total Full Incr. Level:#
-------- -------- -------- --------
Estimate Time (hrs:min) 0:00
Run Time (hrs:min) 0:01
Dump Time (hrs:min) 0:00 0:00 0:00
Output Size (meg) 2.4 2.4 0.0
Original Size (meg) 2.4 2.4 0.0
Avg Compressed Size (%) 100.0 100.0 --
DLEs Dumped 1 1 0
Avg Dump Rate (k/s) 224.2 224.2 --
Tape Time (hrs:min) 0:00 0:00 0:00
Tape Size (meg) 2.4 2.4 0.0
Tape Used (%) 2.4 2.4 0.0
DLEs Taped 1 1 0
Parts Taped 1 1 0
Avg Tp Write Rate (k/s) 1230.0 1230.0 --
USAGE BY TAPE:
Label Time Size % DLEs Parts
slug01 0:00 2460k 2.4 1 1
NOTES:
planner: Adding new disk localhost:/etc.
taper: Slot 0 without label can be labeled
taper: tape slug01 kb 2460 fm 1 [OK]
DUMP SUMMARY:
DUMPER STATS TAPER STATS
HOSTNAME DISK L ORIG-kB OUT-kB COMP% MMM:SS KB/s MMM:SS KB/s
-------------------------- ------------------------------------- -------------
localhost /etc 0 2460 2460 -- 0:11 224.2 0:02 1230.0
(brought to you by Amanda version 3.3.1)
Procedure 11. Backing up a remote PC
Create Amanda's working dirs
root@slug:# mkdir -p /home/amanda/remotepc/holding /home/amanda/remotepc/state/{curinfo,index,log} ; for (( i = 0; i <= 10 ; i++)) ; do mkdir -p /home/amanda/remotepc/vtapes/slot$i ; done
root@slug:# chown -R backup:backup /home/amanda/remotepc/
Create Amanda config
/etc/amanda/remotepc/amanda.conf
org "remotepc" infofile "/home/amanda/remotepc/state/curinfo" logdir "/home/amanda/remotepc/state/log" indexdir "/home/amanda/remotepc/state/index" dumpuser "root" tpchanger "chg-disk:/home/amanda/remotepc/vtapes" property "num-slot" "10" property "auto-create-slot" "yes" property "removable" "no" property "mount" "no" property "umount" "no" labelstr "remotepc[0-9][0-9]" autolabel "remotepc%%" EMPTY VOLUME_ERROR tapetype "STD-TAPE" define tapetype STD-TAPE { length 2 gbytes filemark 4 kbytes } define dumptype simple-gnutar-remote { auth "ssh" ssh_keys "/home/amanda/remotepc/.ssh/id_rsa" compress none program "GNUTAR" } holdingdisk hd1 { directory "/home/amanda/remotepc/holding" use 50 mbytes chunksize 1 mbyte }
/etc/amanda/remotepc/disklist
192.168.113.222 /etc simple-gnutar-remote
Set up SSH for communication from Amanda server on Slug to Client PC
root@slug:# install -g backup -o backup -m 700 -d /home/amanda/remotepc/.ssh
root@slug:# su backup -c 'ssh-keygen -t rsa -C "Amanda Server Key" -f /home/amanda/remotepc/.ssh/id_rsa'
root@pc2bBackedUp:~# install -g backup -o backup -m 700 -d ~backup/.ssh
And append the contents of /home/amanda/remotepc/.ssh/id_rsa.pub
on the server to ~backup/.ssh/authorized_keys
on the client.
Test
Both amcheck remotepc and amdump remotepc should now work. And amreport remotepc should give satisfying output.
Procedure 12. Restoring a remote client
SSH keys from client to server
root@pc2bBackedUp:# su backup -c 'ssh-keygen -t rsa -C "Amanda client key" -f ~backup/.ssh/id_rsa'
... and configure authorized_keys on server. Ssh from client to server succeeds.
Segfault
The command amrecover (on the client) fails with a segfault and no error message. Even with
index_server 192.168.117.222 tape_server 192.168.117.222 auth ssh ssh_keys "/var/backups/.ssh/id_rsa"
in /etc/amanda/amanda-client.conf
For now, this is a show stopper. I'll use rsync for the time being.