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