2 Chapter 13. How to use the Amanda file-driver
3 Prev Part III. HOWTOs Next
5 -------------------------------------------------------------------------------
7 Chapter 13. How to use the Amanda file-driver
12 Original text;XML-conversion;Updates
30 This document covers the use of the file-driver in Amanda 2.4.3 and higher.
31 Examples given here have been taken from a SuSE-Linux-8.2-Pro-environment,
32 using Amanda 2.4.4p1 and the snapshot 2.4.4p1-20031202. Please adjust paths,
33 configuration names and other parameters to your system.
34 Stefan G. Weichinger, November - December, 2003 ; minor updates in April, 2005.
38 Since release 2.4.3 Amanda supports the usage of a output driver called "file".
39 See man amanda, section OUTPUT DRIVERS, for more information on its
40 implementation. As the name suggests, this driver uses files as virtual (or
41 file) tapes. Once created and labeled, these file tapes can be selected and
42 changed with the standard tape-changer-interface of the Amanda server.
48 You can easily explore the rich features of Amanda on systems without tape
51 Without buying a tape drive you can enjoy the benefits of Amanda and backup
52 to a bunch of harddisks. You can create CD/DVD-sized backups which you can
53 burn onto optical disks later.
54 * disk-based installations
55 You can use the file-driver to backup onto a set of file tapes hosted on a
56 bunch of hard-disks or a RAID-system. Combined with another Amanda-
57 configuration that dumps the file tapes to real tapes, you can provide
58 reliable backup with faster tapeless recovery. This is called "disk-to-disk-
59 to-tape"-backup by some people today.
67 This guide assumes you have setup the basic Amanda-services as described in
68 Amanda_Installation_Notes
69 The configuration in this HOWTO is called "daily". The file tapes are also
70 called vtapes in this document, which stands for "virtual tapes".
71 Please be sure to understand the differences between holding disks and file
72 tapes. The two serve different purposes; holding disks allow for parallelism of
73 multiple DLE's being backed up while file tapes are a replacement for physical
75 Before beginning you will need to decide on (a) dedicated part(s) of your hard
76 disk(s) for your file tape storage. While this space could be spread among
77 several file systems and hard disks, I recommend to dedicate at least a
78 specific partition, better a specific physical harddisk to the task of keeping
79 your vtapes. The use of a dedicated disk will speed things up definitely.
80 The disk space you dedicate for your vtapes should NOT be backed up by Amanda.
81 Also, for performance reasons there should be NO holding disks on the same
82 partition as the vtapes, preferably not even on the same physical drive.
83 If you only have one harddisk, it will work out, too, but you will suffer low
84 performance due to massive head-moving in your harddisk, resulting from copying
85 data between the filesystems.
88 1. Prepare the filesystem(s) used for the tapes.
89 Decide on where to put your files, create the appropriate partition(s) and
90 filesystem(s) and mount them.
91 In our example we have the dedicated partition hdc1, mounted on /
92 amandatapes for vtape storage.
96 /dev/hdc1 on /amandatapes type reiserfs (rw)
100 Make sure there is space left. Determine the amount of space you will use.
103 Filesystem Size Used Avail Use% Mounted on
104 /dev/hdc1 20G 0G 20G 0% /amandatapes
107 In our example we have 20GB diskspace left on /amandatapes.
108 2. Determine length and number of tapes
109 After deciding on the number of vtapes you want to create, evenly allocate
110 the available space among them.
111 Look at the following rule of thumb:
112 As many filesystems exhibit dramatically reduced performance when they are
113 nearly full I have chosen to allocate only 90% of the available space. So
115 (Available Space * 0.9) >= tapelength * tapecycle
116 This is a very conservative approach to make sure you don´t suffer any
117 performance drop due to a nearly-full-filesystem.
118 As it is uncommon for Amanda to fill, or almost fill an entire tape you
119 may also wish to use more space than that.
120 So you could determine possible combinations of tapelength/tapecycle with
121 the more general formula:
122 Available Space >= tapelength * tapecycle
123 In our example we take the conservative approach:
125 * 20 GB * 0.9 = 18 GB to use
126 and so we could create the following combinations:
133 * 18 GB = ......... you get the picture.
135 Using only one tape is generally considered a bad idea when it comes to
136 backup, so we should use at least 3 tapes (for testing purposes), better 6
140 so we get the value 3 GB for the tapelength if we want to use 6 tapes.
142 3. Create a tapetype definition.
143 Add a new tapetype definition similar to the following to your
144 amanda.conf. I named my definition "HARD-DISK". Choose whatever name you
145 consider appropriate.
147 define tapetype HARD-DISK {
148 comment "Dump onto hard disk"
149 length 3072 mbytes # specified in mbytes to get the exact size of 3GB
153 You don´t have to specify the parameter speed (as it is commonly listed in
154 tapetype definitions and reported by the program amtapetype). Amanda does
155 not use this parameter right now.
156 There is also an optional parameter filemark, which indicates the amount
157 of space "wasted" after each tape-listitem. Leave it blank and Amanda uses
159 4. Think about tapechangers.
160 As you will use a set of vtapes, you have to also use a kind of vtape-
161 changer. There are several tape-changer-scripts included in the Amanda-
162 tarball. Read more about tape-changer-scripts in Amanda_Tape_Changer
164 Right now there are two scripts that can be used with vtapes. These
165 scripts take different approaches to the handling of tapes.
166 The script chg-multi handles many drives with a tape in each drive. The
167 script chg-disk handles a library with one drive and multiple tapes.
168 So with vtapes you could look at it this way:
169 chg-multi simulates multiple tape drives with one tape in each drive. chg-
170 disk simulates one tape-library with multiple tapes in.
171 As chg-multi exists for a much longer time than chg-disk, it is still used
172 in many Amanda-vtape-installations.
173 chg-disk was introduced with the snapshot 20031202. Contrary to chg-multi,
174 which is a generic changer-script that must be somewhat adjusted to the
175 use of the file-driver, chg-disk offers exactly the behavior needed for
177 IMHO the approach is much more logical, so I recommend to use chg-disk in
178 new Amanda-vtape-installations.
182 To use chg-disk you need to have at least amanda-2.4.4p1-20031202.
183 Choose the one that fits your way of vtape-handling and -maintenance.
184 In this HOWTO I only cover the use of chg-disk. Usage of chg-multi is
185 pretty similar and will maybe covered in a later version of this document.
186 5. Set up your tape-config.
187 In the general section you have to set the parameters tapecycle , tapetype
188 , tpchanger , changerfile , tapedev , rawtapedev and changerdev.
191 $ vi /usr/local/etc/amanda/daily/amanda.conf
197 changerfile "/usr/local/etc/amanda/daily/changer"
198 tapedev "file:/amandatapes/daily"
201 This reflects the use of your defined tapetype.
202 The parameter tapecycle tells Amanda how much tapes can be used, Set this
203 value according to the number of tapes you want to use.
204 The parameter tapetype , points to the tapetype definition you have
206 The parameter tpchanger tells Amanda to use the generic tape-changer-
207 script to handle the vtapes. You can think of it as a virtual tape-
209 The parameter changerfile is used to give chg-disk the "prefix" for the
210 "%s-changer, %s-clean, %s-slot" files it needs. Use something like
211 "changer" in your config-dir. Please note that this file does NOT have to
212 exist, but it won't hurt anyway.
213 The parameter tapedev tells the chg-disk-script where the root-dir for
215 In our example the vtape-files go to /amandatapes.
216 To separate multiple configurations, we decided to use subdirectories
217 according to the configuration name "daily".
221 The parameter changerdev is NOT needed with chg-disk as it is not parsed
223 6. Create the virtual tapes.
227 Gene Heskett has committed a shell-script which creates and labels the
228 vtapes in one step. Stefan G. Weichinger will generalize this script and
229 contribute it, this script will just read your settings in amanda.conf and
230 create the appropriate vtape-directories.
231 Now you have to create the tape-directories. chg-disk needs a directory
243 where 'slot_root_dir' is the tapedev 'file:xxx' parameter and 'n' is the
245 So in our example we do:
247 $ mkdir /amandatapes/daily
250 for the 'slot_root_dir' and
252 $ mkdir /amandatapes/daily/slot1
253 $ mkdir /amandatapes/daily/slot2
257 for the virtual slots that will later contain the vtapes.
258 If you have many vtapes to create and their names follow a pattern you may
259 be able to do them all with a single loop such as:
261 $ for n in 1 2 3 4 5 6 7 8 9 10 11 12
263 > mkdir /amandatapes/daily/slot${n}
267 Create the info-file:
269 $ touch /amandatapes/daily/info
272 and link the first slot to the data-file (to "load" the vtape into the
275 $ ln -s /amandatapes/daily/slot1 /amandatapes/daily/data
278 Make sure the Amanda-user has write-permissions on these directories:
280 $ chown -R amanda_user /amandatapes
281 $ chgrp -R amanda_group /amandatapes
282 $ chmod -R 750 /amandatapes
285 7. Label the virtual tapes.
286 As the virtual tapes are handled just like physical tapes by the Amanda-
287 Server they have to be labeled before use.
289 Usage: amlabel [-f] <conf> <label> [slot <slot-number>]
294 $ amlabel daily daily1 slot 1
296 $ amlabel daily daily2 slot 2
300 If you have many vtapes to label and their names follow a pattern you may
301 be able to do them all with a single loop such as:
303 $ for n in 1 2 3 4 5 6 7 8 9 10 11 12
305 > amlabel daily daily${n} slot ${n}
309 Label all your created tapes according to the "labelstr"-parameter in your
310 amanda.conf. Consult the amlabel-man-page for details.
311 8. Test your setup with amcheck.
312 Run amcheck daily (or, more general, amcheck <config>) and look for
313 anything Amanda complains about.
314 A proper output looks like:
317 Amanda Tape Server Host Check
319 Holding disk /amhold: 6924940 KB disk space available,
321 amcheck-server: slot 2: date 20031115 label daily02
323 NOTE: skipping tape-writable test
324 Tape daily02 label ok
325 Server check took 0.377 seconds
328 Recheck your files if errors occur.
333 Recovering files from vtapes is very similar to recovering files from a "real"
335 Make sure you read the chapter Restore.
336 I will simply paste a amrecover-session here (provided by JC Simonetti, author
339 # /usr/local/amanda/sbin/amrecover woo
340 AMRECOVER Version 2.4.4p3. Contacting server on backupserver.local ...
341 220 backupserver Amanda index server (2.4.4p3) ready.
343 Setting restore date to today (2004-10-08)
344 200 Working date set to 2004-10-08.
345 Scanning /BACKUP2/holding...
346 Scanning /BACKUP/holding...
347 200 Config set to woo.
348 200 Dump host set to backupserver.local.
350 $CWD '/tmp/RECOVER' is on disk '/tmp' mounted at '/tmp'.
351 200 Disk set to /tmp.
352 Invalid directory - /tmp/RECOVER
353 amrecover> sethost backupserver.local
354 200 Dump host set to backupserver.local.
359 amrecover> add passwd
362 TAPE B3_14 LEVEL 0 DATE 2004-09-26
366 Extracting files using tape drive file:/BACKUP2/slots/ on host
367 backupserver.local. The following tapes are needed: B3_14
369 Restoring files into directory /tmp/RECOVER
372 Extracting files using tape drive file:/BACKUP2/slots/ on host
373 backupserver.local. Load tape B3_14 now
374 Continue [?/Y/n/s/t]? Y
379 Nothing spectacular? The trick is this:
382 Load tape B3_14 now Continue [?/Y/n/s/t]?
384 you have to run the following in a second terminal:
387 amtape: changed to slot 14 on file:/BACKUP2/slots/
389 This step is necessary to load the proper tape into your virtual changer.
390 Let me express this in a more general way:
391 When amrecover prompts for the tape it needs to restore the files you
392 requested, you have to "load" the tape it requests.
393 The recommended way to do this is to use amtape. The options that make sense in
397 Usage: amtape <conf> <command>
400 slot <slot #> load tape from slot <slot #>
402 label <label> find and load labeled tape
406 If you know which slot contains the requested tape (for example, if you have
407 tape daily01 in slot 1, tape daily02 in slot 2, and so on) you may use the
408 first option. If you just know the label of the tape you need, use the second
410 To continue the upper example:
412 amtape woo slot 14 # option 1 OR
413 amtape woo label B3_14 # option 2
415 amtape will return something like:
417 amtape: label B3_14 is now loaded.
419 After this you can return to your amrecover-session and continue restoring your
421 Please be aware of the fact reported by JC Simonetti: " I have never never used
422 the "settape" command of amrecover [with chg-disk] since there's some problems
423 with it (tape not loaded correctly, or impossible to change from tape to tape
424 when restoring data shared accross multiple tapes...) "
428 Refer to http://www.amanda.org/docs/howto-filedriver.html for the current
429 version of this document.
430 -------------------------------------------------------------------------------
433 Chapter 12. Amanda on Cygwin HOWTO Home Chapter 14. AFS HOWTO