Backing up to hard disk instead of tape

I got this article from http://amanda.sourceforge.net/fom-serve/cache/191.html.

Hope share this information to more people who want it.

Backing up to hard disk instead of tape
---------------------------------------
Assumes that:
Config files are in /etc/amanda
Configuration named "DailySet1"
Local state directory is /var/lib/amanda
Amanda is configured --with-user=amanda --with-group=disk
14 day dump cycle with an unattended "rotation" of the "tapes"
For the backup device I use a separate 4 gig hard drive mounted at /var2

Installation
————
1. Obtain the tapeio source from sourceforge:

$cvs -d:pserver:anonymous@cvs.amanda.sourceforge.net:/cvsroot/amanda login
$cvs -z3 -d:pserver:anonymous@cvs.amanda.sourceforge.net:/cvsroot/amanda
checkout -r amanda-242-tapeio amanda
$cd amanda
$./autogen

2. Install Amanda as usual.

3. Edit the following config files (all mode 644, owner amanda, group disk):

———————————
/etc/amanda/DailySet1/amanda.conf
———————————
# These are the options that differ from examples/amanda.conf

dumpcycle 14 days
tapecycle 14
#runspercycle # defaults to 1 per day

runtapes 1
tpchanger “chg-multi”
changerfile “/etc/amanda/DailySet1/changer.conf”
# Comment out tapedev and changerdev

tapetype HARD-DISK
labelstr “^DailySet1[0-9][0-9]*$”

define tapetype HARD-DISK {
comment “Hard disk instead of tape”
length 4000 mbytes # Simulates end of tape on hard disk (a 4 GB disk here)
}

define dumptype hard-disk-dump {
global
comment “Back up to hard disk instead of tape – using dump”
holdingdisk no
index yes
priority high
}

define dumptype hard-disk-tar {
hard-disk-dump
comment “Back up to hard disk instead of tape – using tar”
program “GNUTAR”
}

———————————-
/etc/amanda/DailySet1/changer.conf
———————————-
multieject 0
gravity 0
needeject 0
ejectdelay 0

statefile /var/lib/amanda/DailySet1/changer-status

firstslot 1
lastslot 14

slot 1 file:/var2/amandadumps/tape01
slot 2 file:/var2/amandadumps/tape02
slot 3 file:/var2/amandadumps/tape03
slot 4 file:/var2/amandadumps/tape04
slot 5 file:/var2/amandadumps/tape05
slot 6 file:/var2/amandadumps/tape06
slot 7 file:/var2/amandadumps/tape07
slot 8 file:/var2/amandadumps/tape08
slot 9 file:/var2/amandadumps/tape09
slot 10 file:/var2/amandadumps/tape10
slot 11 file:/var2/amandadumps/tape11
slot 12 file:/var2/amandadumps/tape12
slot 13 file:/var2/amandadumps/tape13
slot 14 file:/var2/amandadumps/tape14

——————————
/etc/amanda/DailySet1/disklist
——————————
# hostname diskdev dumptype
# Replace “dumptype” with either “hard-disk-dump” or “hard-disk-tar”
# localhost /home hard-disk-dump
# localhost /etc hard-disk-tar

——————————

4. Create the “tapes” on the tape server hard drive with the associated
data directories:

$mkdir /var2/amandadumps
$mkdir /var2/amandadumps/tape01
$mkdir /var2/amandadumps/tape01/data

$mkdir /var2/amandadumps/tape14
$mkdir /var2/amandadumps/tape14/data

$chown -R amanda.disk /var2/amandadumps
$chmod -R 770 /var2/amandadumps

5. Use amlabel to label the tapes:

$amlabel DailySet1 DailySet101 slot 1

$amlabel DailySet1 DailySet114 slot 14

Recovery with amrecover
———————–
As root on the tape server:

$mkdir /tmp/restore
$cd /tmp/restore
$amrecover DailySet1
$setdate (Optional)
$sethost foo
$setdisk bar
$cd dir/which/contains/filetorecover
$add filetorecover
$list (note which “tape” the file is on)
$settape host:file:/var2/amandadumps/tapeXX

In this step, replace the appropriate host and tape values. For example to
extract a file from host “rustler” that’s on tape 12:

$settape rustler:file:/var2/amandadumps/tape12

$extract
$quit

The only gotcha with amrecover is that if the files you want to extract are
on different tapes, you need to add only the files that are on tape01,
settape for tape01, extract, add files for tape02, settape tape02, extract,
etc. As a work-around, you can give amrecover a “fake” name (/tmp/whatever)
with the “-d” option and then symlink that to the appropriate “tape” as it
asks for it.

Leave a comment

Please leave your comment on the topic

This site uses Akismet to reduce spam. Learn how your comment data is processed.