Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / doc / man-pages / pod5 / butc.pod
CommitLineData
805e021f
CE
1=head1 NAME
2
3butc - Defines Tape Coordinator instructions for automated tape devices
4
5=head1 DESCRIPTION
6
7The F<CFG_I<device_name>> file includes instructions that configure a Tape
8Coordinator (B<butc>) for use with automated backup devices such as tape
9stackers and jukeboxes, enable the Tape Coordinator to dump and restore
10data to a I<backup data file> on a local disk device, and enable greater
11automation of other aspects of the backup process.
12
13There is a separate configuration file for each tape device or backup data
14file. Creating the file is optional, and unnecessary if none of the
15instructions it can include pertain to a given tape device. The
16ASCII-format file must reside in the F</usr/afs/backup> directory on the
17Tape Coordinator machine if it exists.
18
19The F<CFG_I<device_name>> file does not replace the
20F</usr/afs/backup/tapeconfig> file, a single copy of which still must
21exist on every Tape Coordinator machine.
22
23To enable the Tape Coordinator to locate the configuration file, construct
24the variable part of the filename, I<device_name>, as follows:
25
26=over 4
27
28=item *
29
30For a tape device, strip off the initial C</dev/> string from the device
31name, and replace any other slashes in the name with underscores. For
32example, F<CFG_rmt_4m> is the appropriate filename for a device called
33F</dev/rmt/4m>.
34
35=item *
36
37For a backup data file, strip off the initial slash (C</>) and replace any
38other slashes in the name with underscores. For example,
39F<CFG_var_tmp_FILE> is the appropriate filename for a backup data file
40called F</var/tmp/FILE>.
41
42=back
43
44The F<CFG_I<device_name>> file lists one or more of the following
45instructions, each on its own line. All are optional, and they can appear
46in any order. A more detailed description of each instruction follows the
47list:
48
49=over 4
50
51=item ASK
52
53Controls whether the Tape Coordinator prompts for guidance when it
54encounters error conditions.
55
56=item AUTOQUERY
57
58Controls whether the Tape Coordinator prompts for the first tape.
59
60=item BUFFERSIZE
61
62Sets the size of the memory buffer the Tape Coordinator uses when
63transferring data.
64
65=item FILE
66
67Controls whether the dump is written to a tape device or a file.
68
69=item MOUNT
70
71Identifies the file that contains routines for inserting tapes into the
72device's drive.
73
74=item NAME_CHECK
75
76Controls whether the Tape Coordinator verifies that a tape's AFS tape
77name matches the dump being written.
78
79=item UNMOUNT
80
81Identifies the file that contains routines for removing tapes from the
82device's drive.
83
84=back
85
86=head2 The ASK Instruction
87
88The C<ASK> instruction takes a boolean value as its argument, in the
89following format:
90
91 ASK (YES | NO)
92
93When the value is C<YES>, the Tape Coordinator generates a prompt in its
94window, requesting a response to the error cases described in the
95following list. This is the default behavior if the C<ASK> instruction
96does not appear in the F<CFG_I<device_name>> file.
97
98When the value is C<NO>, the Tape Coordinator does not prompt in error
99cases, but instead uses the automatic default responses described in the
100following list. The Tape Coordinator also logs the error in the
101F<TE_I<device_name>> file. Suppressing the prompts enables the Tape
102Coordinator to run unattended, though it still prompts for insertion of
103tapes unless the C<MOUNT> instruction is used.
104
105The error cases controlled by this instruction are the following:
106
107=over 4
108
109=item *
110
111The Backup System is unable to dump a volume while running the backup dump
112command. With a C<YES> value, the Tape Coordinator prompts to offer three
113choices: try to dump the volume again immediately, omit the volume from
114the dump but continue the operation, or terminate the operation. With a
115C<NO> value, the Tape Coordinator omits the volume from the dump and
116continues the operation.
117
118=item *
119
120The Backup System is unable to restore a volume while running the B<backup
121diskrestore>, B<backup volrestore>, or B<backup volsetrestore>
122command. With a C<YES> value, the Tape Coordinator prompts to offer two
123choices: omit the volume and continue restoring the other volumes, or
124terminate the operation. With a C<NO> value, it continues the operation
125without prompting, omitting the problematic volume but restoring the
126remaining ones.
127
128=item *
129
130The Backup System cannot determine if the dump set includes any more
131tapes, while running the B<backup scantape> command (the reference page
132for that command discusses possible reasons for this problem). With a
133C<YES> value, the Tape Coordinator prompts to ask if there are more tapes
134to scan. With a C<NO> value, it proceeds as though there are more tapes
135and invokes the routine named by the C<MOUNT> instruction in the
136configuration file, or prompts the operator to insert the next tape.
137
138=item *
139
140The Backup System determines that the tape contains an unexpired dump
141while running the B<backup labeltape> command. With a C<YES> value, the
142Tape Coordinator prompts to offer two choices: continue or terminate the
143labeling operation. With a C<NO> value, it terminates the operation
144without relabeling the tape.
145
146=back
147
148=head2 The AUTOQUERY Instruction
149
150The C<AUTOQUERY> instruction takes a boolean value as its argument,
151in the following format:
152
153 AUTOQUERY (YES | NO)
154
155When the value is C<YES>, the Tape Coordinator checks for the C<MOUNT>
156instruction in the configuration file when it needs to read the first tape
157involved in an operation. As described for that instruction, it then
158either prompts for the tape or invokes the specified routine to mount the
159tape. This is the default behavior if the C<AUTOQUERY> instruction does
160not appear in the configuration file.
161
162When the value is C<NO>, the Tape Coordinator assumes that the first tape
163required for an operation is already in the drive. It does not prompt the
164operator or invoke the C<MOUNT> routine unless there is an error in
165accessing the first tape. This setting is equivalent in effect to
166including the B<-noautoquery> flag to the B<butc> command.
167
168Note that the setting of the C<AUTOQUERY> instruction controls the Tape
169Coordinator's behavior only with respect to the first tape required for an
170operation. For subsequent tapes, the Tape Coordinator always checks for
171the C<MOUNT> instruction. It also refers to the C<MOUNT> instruction if it
172encounters an error while attempting to access the first tape.
173
174=head2 The BUFFERSIZE Instruction
175
176The C<BUFFERSIZE> instruction takes an integer value, and optionally
177units, in the following format:
178
179 BUFFERSIZE <size>[(k | K | m | M | g | G)]
180
181where <size> specifies the amount of memory the Tape Coordinator allocates
182to use as a buffer during both dump and restore operations. The default
183unit is bytes, but use C<k> or C<K> to specify kilobytes, C<m> or C<M> for
184megabytes, and C<g> or C<G> for gigabytes. There is no space between the
185<size> value and the units letter.
186
187By default, the Tape Coordinator uses a 16 KB buffer during dump
188operations. As it receives volume data from the Volume Server, the Tape
189Coordinator gathers 16 KB of data in the buffer before transferring the
190entire 16 KB to the tape device or backup data file. Similarly, during a
191restore operation the Tape Coordinator by default buffers 32 KB of data
192from the tape device or backup data file before transferring the entire 32
193KB to the Volume Server for restoration into the file system. Buffering
194makes the volume of data flowing to and from a tape device more even and
195so promotes tape streaming, which is the most efficient way for a tape
196device to operate.
197
198In a normal network configuration, the default buffer sizes are usually
199large enough to promote tape streaming. If the network between the Tape
200Coordinator machine and file server machines is slow, it can help to
201increase the buffer size.
202
203=head2 The FILE Instruction
204
205The C<FILE> instruction takes a boolean value as its argument, in the
206following format:
207
208 FILE (NO | YES)
209
210When the value is C<NO>, the Tape Coordinator writes to a tape device
211during a dump operation and reads from one during a restore
212operation. This is the default behavior if the C<FILE> instruction does
213not appear in the configuration file.
214
215When the value is C<YES>, the Tape Coordinator writes volume data to a
216backup data file on the local disk during a dump operation and reads
217volume data from a file during a restore operation. If the file does not
218exist when the Tape Coordinator attempts to access it to write a dump, the
219Tape Coordinator creates it. For a restore operation to succeed, the file
220must exist and contain volume data previously written to it by a B<backup
221dump> operation.
222
223When the value is C<YES>, the backup data file's complete pathname must
224appear (instead of a tape drive device name) in the third field of the
225corresponding port offset entry in the local F</usr/afs/backup/tapeconfig>
226file. If the field instead refers to a tape device, dump operations appear
227to succeed but are inoperative. It is not possible to restore data that
228was accidently dumped to a tape device while the C<FILE> instruction was
229set to C<YES>. (In the same way, if the C<FILE> instruction is set to
230C<NO>, the F<tapeconfig> entry must refer to an actual tape device.)
231
232Rather than put an actual file pathname in the third field of the
233F<tapeconfig> file, however, the recommended configuration is to create a
234symbolic link in the F</dev> directory that points to the actual file
235pathname, and record the symbolic link in this field. This configuration
236has a couple of advantages:
237
238=over 4
239
240=item *
241
242It makes the I<device_name> portion of the F<CFG_I<device_name>>,
243F<TE_I<device_name>>, and F<TL_I<device_name>> names as short as
244possible. Because the symbolic link is in the F</dev> directory as though
245it were a tape device, the device configuration file's name is constructed
246by stripping off the entire F</dev/> prefix, instead of just the initial
247slash. If, for example, the symbolic link is called F</dev/FILE>, the
248device configuration file name is F<CFG_FILE>, whereas if the actual
249pathname F</var/tmp/FILE> appears in the B<tapeconfig> file, the file's
250name must be F<CFG_var_tmp_FILE>.
251
252=item *
253
254It provides for a more graceful, and potentially automated, recovery if
255the Tape Coordinator cannot write a complete dump into the backup data
256file (because the partition housing the backup data file becomes full, for
257example). The Tape Coordinator's reaction to this problem is to invoke the
258C<MOUNT> script, or to prompt the operator if the C<MOUNT> instruction
259does not appear in the configuration file.
260
261=over 4
262
263=item *
264
265If there is a C<MOUNT> routine, the operator can prepare for this
266situation by adding a subroutine that changes the symbolic link to point
267to another backup data file on a partition where there is space available.
268
269=item *
270
271If there is no C<MOUNT> instruction, the prompt enables the operator
272manually to change the symbolic link to point to another backup data file,
273then press Return to signal that the Tape Coordinator can continue the
274operation.
275
276=back
277
278=back
279
280If the third field in the F<tapeconfig> file names the actual file, there
281is no way to recover from exhausting the space on the partition that
282houses the backup data file. It is not possible to change the
283F<tapeconfig> file in the middle of an operation.
284
285When writing to a backup data file, the Tape Coordinator writes data at 16
286KB offsets. If a given block of data (such as the marker that signals the
287beginning or end of a volume) does not fill the entire 16 KB, the Tape
288Coordinator still skips to the next offset before writing the next
289block. In the output of a B<backup dumpinfo> command issued with the
290B<-id> option, the value in the C<Pos> column is the ordinal of the 16-KB
291offset at which the volume data begins, and so is not generally only one
292higher than the position number on the previous line, as it is for dumps
293to tape.
294
295=head2 The MOUNT Instruction
296
297The C<MOUNT> instruction takes a pathname as its argument, in the
298following format:
299
300 MOUNT <filename>
301
302The referenced executable file must reside on the local disk and contain a
303shell script or program that directs an automated tape device, such as a
304jukebox or stacker, to mount a tape (insert it into the tape reader). The
305operator must write the routine to invoke the mount command specified by
306the device's manufacturer; AFS does not include any scripts, although an
307example appears in L</EXAMPLES>. The script or program inherits the Tape
308Coordinator's AFS authentication status.
309
310When the Tape Coordinator needs to mount a tape, it checks the
311configuration file for a C<MOUNT> instruction. If there is no C<MOUNT>
312instruction, the Tape Coordinator prompts the operator to insert a tape
313before it attempts to open the tape device. If there is a C<MOUNT>
314instruction, the Tape Coordinator executes the routine in the referenced
315file. The routine invoked by the C<MOUNT> instruction inherits the local
316identity (UNIX UID) and AFS tokens of the B<butc> command's issuer.
317
318There is an exception to this sequence: if the C<AUTOQUERY NO> instruction
319appears in the configuration file, or the B<-noautoquery> flag was
320included on the B<butc> command, then the Tape Coordinator assumes that
321the operator has already inserted the first tape needed for a given
322operation. It attempts to read the tape immediately, and only checks for
323the C<MOUNT> instruction or prompts the operator if the tape is missing or
324is not the required one.
325
326When the Tape Coordinator invokes the routine indicated by the C<MOUNT>
327instruction, it passes the following parameters to the routine in the
328indicated order:
329
330=over 4
331
332=item *
333
334The tape device or backup data file's pathname, as recorded in the
335F</usr/afs/backup/tapeconfig> file.
336
337=item *
338
339The tape operation, which (except for the exceptions noted in the
340following list) matches the B<backup> command operation code used to
341initiate the operation:
342
343=over 4
344
345=item *
346
347C<appenddump> (when a backup dump command includes the B<-append> flag).
348
349=item *
350
351C<dump> (when a backup dump command does not include the B<-append> flag).
352
353=item *
354
355C<labeltape>
356
357=item *
358
359C<readlabel>
360
361=item *
362
363C<restore> (for a B<backup diskrestore>, backup volrestore, or B<backup
364volsetrestore> command).
365
366=item *
367
368C<restoredb>
369
370=item *
371
372C<savedb>
373
374=item *
375
376C<scantape>
377
378=back
379
380=item *
381
382The number of times the Tape Coordinator has attempted to open the tape
383device or backup data file. If the open attempt returns an error, the Tape
384Coordinator increments this value by one and again invokes the C<MOUNT>
385instruction.
386
387=item *
388
389The tape name. For some operations, the Tape Coordinator passes the string
390C<none>, because it does not know the tape name (when running the B<backup
391scantape> or B<backup readlabel>, for example), or because the tape does
392not necessarily have a name (when running the B<backup labeltape> command,
393for example).
394
395=item *
396
397The tape ID recorded in the Backup Database. As with the tape name, the
398Backup System passes the string C<none> for operations where it does not
399know the tape ID or the tape does not necessarily have an ID.
400
401=back
402
403The routine invoked by the C<MOUNT> instruction must return an exit code
404to the Tape Coordinator:
405
406=over 4
407
408=item *
409
410Code 0 (zero) indicates that the routine successfully mounted the
411tape. The Tape Coordinator continues the backup operation. If the routine
412invoked by the C<MOUNT> instruction does not return this exit code, the
413Tape Coordinator never calls the C<UNMOUNT> instruction.
414
415=item *
416
417Code 1 (one) indicates that the routine failed to mount the tape. The Tape
418Coordinator terminates the operation.
419
420=item *
421
422Any other code indicates that the routine was not able to access the
423correct tape. The Tape Coordinator prompts the operator to insert the
424correct tape.
425
426=back
427
428If the backup command was issued in interactive mode and the operator
429issues the B<backup kill> command while the C<MOUNT> routine is running,
430the Tape Coordinator passes the termination signal to the routine; the
431entire operation terminates.
432
433=head2 The NAME_CHECK Instruction
434
435The C<NAME_CHECK> instruction takes a boolean value as its argument, in
436the following format:
437
438 NAME_CHECK (YES | NO)
439
440When the value is C<YES> and the tape does not have a permanent name, the
441Tape Coordinator checks the AFS tape name when dumping a volume in
442response to the B<backup dump> command. The AFS tape name must be C<<
443<NULL> >> or match the tape name that the B<backup dump> operation assigns
444based on the volume set and dump level names. This is the default behavior
445if the C<NAME_CHECK> instruction does not appear in the configuration
446file.
447
448When the value is C<NO>, the Tape Coordinator does not check the AFS tape
449name before writing to the tape.
450
451The Tape Coordinator always checks that all dumps on the tape are expired,
452and refuses to write to a tape that contains unexpired dumps.
453
454=head2 The UNMOUNT Instruction
455
456The C<UNMOUNT> instruction takes a pathname as its argument, in the
457following format:
458
459 UNMOUNT <filename>
460
461The referenced executable file must reside on the local disk and contain a
462shell script or program that directs an automated tape device, such as a
463jukebox or stacker, to unmount a tape (remove it from the tape reader).
464The operator must write the routine to invoke the unmount command
465specified by the device's manufacturer; AFS does not include any scripts,
466although an example appears in L</EXAMPLES>. The script or program
467inherits the Tape Coordinator's AFS authentication status.
468
469After closing a tape device, the Tape Coordinator checks the configuration
470file for an C<UNMOUNT> instruction, whether or not the B<close> operation
471succeeds. If there is no C<UNMOUNT> instruction, the Tape Coordinator
472takes no action, in which case the operator must take the action necessary
473to remove the current tape from the drive before another can be
474inserted. If there is an C<UNMOUNT> instruction, the Tape Coordinator
475executes the referenced file. It invokes the routine only once, passing in
476the following parameters:
477
478=over 4
479
480=item *
481
482The tape device pathname (as specified in the
483F</usr/afs/backup/tapeconfig> file).
484
485=item *
486
487The tape operation (always unmount).
488
489=back
490
491=head1 PRIVILEGE REQUIRED
492
493The file is protected by UNIX mode bits. Creating the file requires the
494C<w> (write) and C<x> (execute) permissions on the F</usr/afs/backup>
495directory. Editing the file requires the C<w> (write) permission on the
496file.
497
498=head1 EXAMPLES
499
500The following example configuration files demonstrate one way to structure
501a configuration file for a stacker or backup dump file. The examples are
502not necessarily appropriate for a specific cell; if using them as models,
503be sure to adapt them to the cell's needs and equipment.
504
505=head2 Example F<CFG_I<device_name>> File for Stackers
506
507In this example, the administrator creates the following entry for a tape
508stacker called C<stacker0.1> in the F</usr/afs/backup/tapeconfig> file. It
509has port offset 0.
510
511 2G 5K /dev/stacker0.1 0
512
513The administrator includes the following five lines in the
514F</usr/afs/backup/CFG_stacker0.1> file. To review the meaning of each
515instruction, see L</DESCRIPTION>.
516
517 MOUNT /usr/afs/backup/stacker0.1
518 UNMOUNT /usr/afs/backup/stacker0.1
519 AUTOQUERY NO
520 ASK NO
521 NAME_CHECK NO
522
523Finally, the administrator writes the following executable routine in the
524F</usr/afs/backup/stacker0.1> file referenced by the C<MOUNT> and
525C<UNMOUNT> instructions in the F<CFG_stacker0.1> file.
526
527 #! /bin/csh -f
528
529 set devicefile = $1
530 set operation = $2
531 set tries = $3
532 set tapename = $4
533 set tapeid = $5
534
535 set exit_continue = 0
536 set exit_abort = 1
537 set exit_interactive = 2
538
539 #--------------------------------------------
540
541 if (${tries} > 1) then
542 echo "Too many tries"
543 exit ${exit_interactive}
544 endif
545
546 if (${operation} == "unmount") then
547 echo "UnMount: Will leave tape in drive"
548 exit ${exit_continue}
549 endif
550
551 if ((${operation} == "dump") |\
552 (${operation} == "appenddump") |\
553 (${operation} == "savedb")) then
554
555 stackerCmd_NextTape ${devicefile}
556 if (${status} != 0)exit${exit_interactive}
557 echo "Will continue"
558 exit ${exit_continue}
559 endif
560
561 if ((${operation} == "labeltape") |\
562 (${operation} == "readlabel")) then
563 echo "Will continue"
564 exit ${exit_continue}
565 endif
566
567 echo "Prompt for tape"
568 exit ${exit_interactive}
569
570This routine uses two of the parameters passed to it by the Backup System:
571C<tries> and C<operation>. It follows the recommended practice of
572prompting for a tape if the value of the C<tries> parameter exceeds one,
573because that implies that the stacker is out of tapes.
574
575For a B<backup dump> or backup savedb operation, the routine calls the
576example C<stackerCmd_NextTape> function provided by the stacker's
577manufacturer. Note that the final lines in the file return the exit code
578that prompts the operator to insert a tape; these lines are invoked when
579either the stacker cannot load a tape or a the operation being performed
580is not one of those explicitly mentioned in the file (such as a restore
581operation).
582
583=head2 Example F<CFG_I<device_name>> File for Dumping to a Data File
584
585In this example, the administrator creates the following entry for a
586backup data file called F<HSM_device> in the F</usr/afs/backup/tapeconfig>
587file. It has port offset 20.
588
589 1G 0K /dev/HSM_device 20
590
591The administrator includes the following lines in the
592F</usr/afs/backup/CFG_HSM_device> file. To review the meaning of each
593instruction, see L</DESCRIPTION>.
594
595 MOUNT /usr/afs/backup/file
596 FILE YES
597 ASK NO
598
599Finally, the administrator writes the following executable routine in the
600F</usr/afs/backup/file> file referenced by the C<MOUNT> instruction in the
601F<CFG_HSM_device> file, to control how the Tape Coordinator handles the
602file.
603
604 #! /bin/csh -f
605 set devicefile = $1
606 set operation = $2
607 set tries = $3
608 set tapename = $4
609 set tapeid = $5
610
611 set exit_continue = 0
612 set exit_abort = 1
613 set exit_interactive = 2
614
615 #--------------------------------------------
616
617 if (${tries} > 1) then
618 echo "Too many tries"
619 exit ${exit_interactive}
620 endif
621
622 if (${operation} == "labeltape") then
623 echo "Won't label a tape/file"
624 exit ${exit_abort}
625 endif
626
627 if ((${operation} == "dump") |\
628 (${operation} == "appenddump") |\
629 (${operation} == "restore") |\
630 (${operation} == "savedb") |\
631 (${operation} == "restoredb")) then
632
633 /bin/rm -f ${devicefile}
634 /bin/ln -s /hsm/${tapename}_${tapeid} ${devicefile}
635 if (${status} != 0) exit ${exit_abort}
636 endif
637
638 exit ${exit_continue}
639
640Like the example routine for a tape stacker, this routine uses the
641C<tries> and C<operation> parameters passed to it by the Backup
642System. The C<tries> parameter tracks how many times the Tape Coordinator
643has attempted to access the file. A value greater than one indicates that
644the Tape Coordinator cannot access it, and the routine returns exit code 2
645(C<exit_interactive>), which results in a prompt for the operator to load
646a tape. The operator can use this opportunity to change the name of the
647backup data file specified in the B<tapeconfig> file.
648
649The primary function of this routine is to establish a link between the
650device file and the file to be dumped or restored. When the Tape
651Coordinator is executing a B<backup dump>, B<backup restore>, B<backup
652savedb>, or B<backup restoredb> operation, the routine invokes the UNIX
653C<ln -s> command to create a symbolic link from the backup data file named
654in the F<tapeconfig> file to the actual file to use (this is the
655recommended method). It uses the value of the C<tapename> and C<tapeid>
656parameters to construct the file name.
657
658=head1 SEE ALSO
659
660L<tapeconfig(5)>,
661L<backup_diskrestore(8)>,
662L<backup_dump(8)>,
663L<backup_restoredb(8)>,
664L<backup_savedb(8)>,
665L<backup_volrestore(8)>,
666L<backup_volsetrestore(8)>
667
668=head1 COPYRIGHT
669
670IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.
671
672This documentation is covered by the IBM Public License Version 1.0. It was
673converted from HTML to POD by software written by Chas Williams and Russ
674Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.