4 \section*{Bacula Console}
5 \label{_ConsoleChapter}
6 \index[general]{Console!Bacula}
7 \index[general]{Bacula Console}
8 \index[console]{Console!Bacula}
9 \index[console]{Bacula Console}
10 \addcontentsline{toc}{section}{Bacula Console}
13 \index[general]{General}
14 \addcontentsline{toc}{subsection}{General}
16 The {\bf Bacula Console} (sometimes called the User Agent) is a program that
17 allows the user or the System Administrator, to interact with the Bacula
18 Director daemon while the daemon is running.
20 The current Bacula Console comes in two versions: a shell interface (TTY
21 style), and a GNOME GUI interface. Both permit the administrator or authorized
22 users to interact with Bacula. You can determine the status of a particular
23 job, examine the contents of the Catalog as well as perform certain tape
24 manipulations with the Console program.
26 In addition, there is a wx-console built with wxWidgets that allows a graphic
27 restore of files. As of version 1.34.1 it is in an early stage of development,
28 but it already is quite useful.
30 Since the Console program interacts with the Director through the network, your
31 Console and Director programs do not necessarily need to run on the same
34 In fact, a certain minimal knowledge of the Console program is needed in order
35 for Bacula to be able to write on more than one tape, because when Bacula
36 requests a new tape, it waits until the user, via the Console program,
37 indicates that the new tape is mounted.
39 \subsection*{Console Configuration}
40 \index[general]{Console Configuration}
41 \index[general]{Configuration!Console}
42 \index[console]{Console Configuration}
43 \index[console]{Configuration!Console}
44 \addcontentsline{toc}{subsection}{Console Configuration}
46 When the Console starts, it reads a standard Bacula configuration file named
47 {\bf bconsole.conf} or {\bf gnome-console.conf} in the case of the GNOME
48 Console version. This file allows default configuration of the Console, and at
49 the current time, the only Resource Record defined is the Director resource,
50 which gives the Console the name and address of the Director. For more
51 information on configuration of the Console program, please see the
52 \ilink{Console Configuration File}{_ChapterStart36} Chapter of
55 \subsection*{Running the Console Program}
56 \index[general]{Running the Console Program}
57 \index[general]{Program!Running the Console}
58 \index[console]{Running the Console Program}
59 \index[console]{Program!Running the Console}
60 \addcontentsline{toc}{subsection}{Running the Console Program}
62 The console program can be run with the following options:
65 Usage: bconsole [-s] [-c config_file] [-d debug_level]
66 -c <file> set configuration file to file
67 -dnn set debug level to nn
70 -t test - read configuration and exit
71 -? print this message.
76 After launching the Console program (bconsole), it will prompt you for the
77 next command with an asterisk (*). (Note, in the GNOME version, the prompt is
78 not present; you simply enter the commands you want in the command text box at
79 the bottom of the screen.) Generally, for all commands, you can simply enter
80 the command name and the Console program will prompt you for the necessary
81 arguments. Alternatively, in most cases, you may enter the command followed by
82 arguments. The general format is:
86 <command> <keyword1>[=<argument1>] <keyword2>[=<argument2>] ...
90 where {\bf command} is one of the commands listed below; {\bf keyword} is one
91 of the keywords listed below (usually followed by an argument); and {\bf
92 argument} is the value. The command may be abbreviated to the shortest unique
93 form. If two commands have the same starting letters, the one that will be
94 selected is the one that appears first in the {\bf help} listing. If you want
95 the second command, simply spell out the full command. None of the keywords
96 following the command may be abbreviated.
106 will list all files saved for JobId 23. Or:
114 will display all the Pool resource records.
116 \subsection*{Stopping the Console Program}
117 \index[general]{Program!Stopping the Console}
118 \index[general]{Stopping the Console Program}
119 \index[console]{Program!Stopping the Console}
120 \index[console]{Stopping the Console Program}
121 \addcontentsline{toc}{subsection}{Stopping the Console Program}
123 Normally, you simply enter {\bf quit} or {\bf exit} and the Console program
124 will terminate. However, it waits until the Director acknowledges the command.
125 If the Director is already doing a lengthy command (e.g. prune), it may take
126 some time. If you want to immediately terminate the Console program, enter the
129 There is currently no way to interrupt a Console command once issued (i.e.
130 Ctrl-C does not work). However, if you are at a prompt that is asking you to
131 select one of several possibilities and you would like to abort the command,
132 you can enter a period ({\bf .}), and in most cases, you will either be
133 returned to the main command prompt or if appropriate the previous prompt (in
134 the case of nested prompts). In a few places such as where it is asking for a
135 Volume name, the period will be taken to be the Volume name. In that case, you
136 will most likely be able to cancel at the next prompt.
139 \subsection*{Alphabetic List of Console Keywords}
140 \index[general]{Keywords!Alphabetic List of Console}
141 \index[general]{Alphabetic List of Console Keywords}
142 \index[console]{Keywords!Alphabetic List of Console}
143 \index[console]{Alphabetic List of Console Keywords}
144 \addcontentsline{toc}{subsection}{Alphabetic List of Console Keywords}
145 Unless otherwise specified, each of the following keywords
146 takes an argument, which is specified after the keyword following
147 an equal sign. For example:
153 Please note, this list is incomplete as it is currently in
154 the process of being created and is not currently totally in
160 Permitted on the python command, and causes the Python
161 interpreter to be restarted. Takes no argument.
163 Permitted on the status and show commands to specify all components or
164 resources respectively.
166 Used in the restore command.
168 Used in the restore command.
170 Allowed in the use command to specify the catalog name
173 Used in the show command. Takes no arguments.
176 Used in the show, list, and llist commands. Takes no arguments.
178 Used in the show command. Takes no arguments.
180 Used in the restore command. Takes no argument.
182 Used to define the number of days the "list nextvol" command
183 should consider when looking for jobs to be run. The days keyword
184 can also be used on the "status dir" command so that it will display
185 jobs scheduled for the number of days you want.
187 Used in the show command. Takes no arguments.
188 \item [dir | director]
190 Used in the show command. Takes no arguments.
192 Used in the restore command. Its argument specifies the directory
195 This keyword can appear on the {\bf update volume} command, and can
196 allows one of the following arguments: yes, true, no, false, archived,
197 0, 1, 2. Where 0 corresponds to no or false, 1 corresponds to yes or true, and
198 2 corresponds to archived. Archived volumes will not be used, nor will
199 the Media record in the catalog be pruned. Volumes that are not enabled,
200 will not be used for backup or restore.
202 Used in the restore command. Takes no argument.
204 Used in the restore command.
206 Used in the list and llist commands. Takes no arguments.
209 Used in the show command. Takes no arguments.
211 Used in the show command. Takes no arguments.
213 Used in the show, list and llist commands. Takes no arguments.
215 Used in the list and llist commands. Takes no arguments.
217 Used in the list and llist commands. Takes no arguments.
219 The JobId is the numeric jobid that is printed in the Job
220 Report output. It is the index of the database record for the
221 given job. While it is unique for all the existing Job records
222 in the catalog database, the same JobId can be reused once a
223 Job is removed from the catalog. Probably you will refer
224 specific Jobs that ran using their numeric JobId.
225 \item [job | jobname]
226 The Job or Jobname keyword refers to the name you specified
227 in the Job resource, and hence it refers to any number of
228 Jobs that ran. It is typically useful if you want to list
229 all jobs of a particular name.
232 Permitted on the estimate command. Takes no argument.
235 Used in the show command. Takes no arguments.
237 Used in the list and llist commands. Takes no arguments.
238 \item [nextvol | nextvolume]
239 Used in the list and llist commands. Takes no arguments.
246 Used in the show, list, and llist commands. Takes no arguments.
248 Used in the restore command. Takes no argument.
250 Used in the show command. Takes no arguments.
252 Used in the show command. Takes no arguments.
253 \item [sd | store | storage]
255 The ujobid is a unique job identification that is printed
256 in the Job Report output. At the current time, it consists
257 of the Job name (from the Name directive for the job) appended
258 with the date and time the job was run. This keyword is useful
259 if you want to completely identify the Job instance run.
262 Used in the list and llist commands. Takes no arguments.
264 Used in the restore command.
266 Used in the restore command. Takes no argument.
270 \subsection*{Alphabetic List of Console Commands}
271 \index[general]{Commands!Alphabetic List of Console}
272 \index[general]{Alphabetic List of Console Commands}
273 \index[console]{Commands!Alphabetic List of Console}
274 \index[console]{Alphabetic List of Console Commands}
275 \addcontentsline{toc}{subsection}{Alphabetic List of Console Commands}
277 The following commands are currently implemented:
280 \item [{add [pool=\lt{}pool-name\gt{} storage=\lt{}storage\gt{}
281 jobid=\lt{}JobId\gt{}]} ]
283 This command is not normally used since Bacula will normally
284 do it automatically as Volumes are labeled. However, if you need it,
285 this command is used to add Volumes to an existing Pool. The Volume names
286 entered are placed in the Catalog and thus become available for backup
287 operations. Normally, the {\bf label} command is used rather than this
288 command because the {\bf label} command labels the physical media (tape) and
289 does the equivalent of the {\bf add} command. This command affects only the
290 Catalog and not the physical media (data on Volumes). The physical media must
291 exist and be labeled before use (usually with the {\bf label} command). This
292 command can, however, be useful if you wish to add a number of Volumes to the
293 Pool that will be physically labeled at a later time. It can also be useful
294 if you are importing a tape from another site. Please see the {\bf label}
295 command below for the list of legal characters in a Volume name.
297 \item [autodisplay on/off]
298 \index[console]{autodisplay on/off}
299 This command accepts {\bf on} or {\bf off} as an argument, and turns
300 auto-display of messages on or off respectively. The default for the
301 console program is {\bf off}, which means that you will be notified when
302 there are console messages pending, but they will not automatically be
303 displayed. The default for the gnome-console program is {\bf on}, which
304 means that messages will be displayed when they are received (usually
305 within 5 seconds of them being generated).
307 When autodisplay is turned off, you must explicitly retrieve the
308 messages with the {\bf messages} command. When autodisplay is turned
309 on, the messages will be displayed on the console as they are received.
311 \item [automount on/off]
312 \index[console]{automount on/off}
313 This command accepts {\bf on} or {\bf off} as the argument, and turns
314 auto-mounting of the tape after a {\bf label} command on or off
315 respectively. The default is {\bf on}. If {\bf automount} is turned
316 off, you must explicitly {\bf mount} the tape after a label command to
319 \item [{cancel [jobid=\lt{}number\gt{} job=\lt{}job-name\gt{} ujobid=\lt{}unique-jobid\gt{}]}]
320 \index[console]{cancel jobid}
321 This command is used to cancel a job and accepts {\bf jobid=nnn} or {\bf
322 job=xxx} as an argument where nnn is replaced by the JobId and xxx is
323 replaced by the job name. If you do not specify a keyword, the Console
324 program will prompt you with the names of all the active jobs allowing
327 Once a Job is marked to be canceled, it may take a bit of time
328 (generally within a minute) before it actually terminates, depending on
329 what operations it is doing.
331 \item [{create [pool=\lt{}pool-name\gt{}]}]
332 \index[console]{create pool}
333 This command is not normally used as the Pool records are automatically
334 created by the Director when it starts based on what it finds in
335 the conf file. If needed, this command can be
336 to create a Pool record in the database using the
337 Pool resource record defined in the Director's configuration file. So
338 in a sense, this command simply transfers the information from the Pool
339 resource in the configuration file into the Catalog. Normally this
340 command is done automatically for you when the Director starts providing
341 the Pool is referenced within a Job resource. If you use this command
342 on an existing Pool, it will automatically update the Catalog to have
343 the same information as the Pool resource. After creating a Pool, you
344 will most likely use the {\bf label} command to label one or more
345 volumes and add their names to the Media database.
347 When starting a Job, if Bacula determines that there is no Pool record
348 in the database, but there is a Pool resource of the appropriate name,
349 it will create it for you. If you want the Pool record to appear in the
350 database immediately, simply use this command to force it to be created.
352 \item [{delete [volume=\lt{}vol-name\gt{} pool=\lt{}pool-name\gt{} job
353 jobid=\lt{}id\gt{}]}]
354 \index[console]{delete}
355 The delete command is used to delete a Volume, Pool or Job record from
356 the Catalog as well as all associated catalog Volume records that were
357 created. This command operates only on the Catalog database and has no
358 effect on the actual data written to a Volume. This command can be
359 dangerous and we strongly recommend that you do not use it unless you
360 know what you are doing.
362 If the keyword {\bf Volume} appears on the command line, the named
363 Volume will be deleted from the catalog, if the keyword {\bf Pool}
364 appears on the command line, a Pool will be deleted, and if the keyword
365 {\bf Job} appears on the command line, a Job and all its associated
366 records (File and JobMedia) will be deleted from the catalog. The full
367 form of this command is:
370 delete pool=\lt{}pool-name\gt{}
376 delete volume=\lt{}volume-name\gt{} pool=\lt{}pool-name\gt{} or
380 delete JobId=\lt{}job-id\gt{} JobId=\lt{}job-id2\gt{} ... or
384 delete Job JobId=n,m,o-r,t ...
387 The first form deletes a Pool record from the catalog database. The
388 second form deletes a Volume record from the specified pool in the
389 catalog database. The third form deletes the specified Job record from
390 the catalog database. The last form deletes JobId records for JobIds
391 n, m, o, p, q, r, and t. Where each one of the n,m,... is, of course, a
392 number. That is a "delete jobid" accepts lists and ranges of
395 \item [disable job\lt{}job-name\gt{}]
396 \index[console]{enable}
397 This command permits you to disable a Job for automatic scheduling.
398 The job may have been previously enabled with the Job resource
399 {\bf Enabled} directive or using the console {\bf enable} command.
400 The next time the Director is restarted or the conf file is reloaded,
401 the Enable/Disable state will be set to the value in the Job resource
404 \item [enable job\lt{}job-name\gt{}]
405 \index[console]{enable}
406 This command permits you to enable a Job for automatic scheduling.
407 The job may have been previously disabled with the Job resource
408 {\bf Enabled} directive or using the console {\bf disable} command.
409 The next time the Director is restarted or the conf file is reloaded,
410 the Enable/Disable state will be set to the value in the Job resource
415 \index[console]{estimate}
416 Using this command, you can get an idea how many files will be backed
417 up, or if you are unsure about your Include statements in your FileSet,
418 you can test them without doing an actual backup. The default is to
419 assume a Full backup. However, you can override this by specifying a
420 {\bf level=Incremental} or {\bf level=Differential} on the command line.
421 A Job name must be specified or you will be prompted for one, and
422 optionally a Client and FileSet may be specified on the command line.
423 It then contacts the client which computes the number of files and bytes
424 that would be backed up. Please note that this is an estimate
425 calculated from the number of blocks in the file rather than by reading
426 the actual bytes. As such, the estimated backup size will generally be
427 larger than an actual backup.
429 Optionally you may specify the keyword {\bf listing} in which case, all the
430 files to be backed up will be listed. Note, it could take quite some time to
431 display them if the backup is large. The full form is:
435 estimate job=\lt{}job-name\gt{} listing client=\lt{}client-name\gt{}
436 fileset=\lt{}fileset-name\gt{} level=\lt{}level-name\gt{}
439 Specification of the {\bf job} is sufficient, but you can also override
440 the client, fileset and/or level by specifying them on the estimate
444 As an example, you might do:
449 estimate job=NightlySave listing level=Incremental
454 which will do a full listing of all files to be backed up for the Job {\bf
455 NightlySave} during an Incremental save and put it in the file {\bf
456 /tmp/listing}. Note, the byte estimate provided by this command is
457 based on the file size contained in the directory item. This can give
458 wildly incorrect estimates of the actual storage used if there are
459 sparse files on your systems. Sparse files are often found on 64 bit
460 systems for certain system files. The size that is returned is the size
461 Bacula will backup if the sparse option is not specified in the FileSet.
462 There is currently no way to get an estimate of the real file size that
463 would be found should the sparse option be enabled.
467 \index[console]{help}
468 This command displays the list of commands available.
471 \index[console]{label}
472 \index[console]{relabel}
473 \index[general]{label}
474 \index[general]{relabel}
475 This command is used to label physical volumes. The full form of this command
479 label storage=\lt{}storage-name\gt{} volume=\lt{}volume-name\gt{}
483 If you leave out any part, you will be prompted for it. The media type
484 is automatically taken from the Storage resource definition that you
485 supply. Once the necessary information is obtained, the Console program
486 contacts the specified Storage daemon and requests that the tape be
487 labeled. If the tape labeling is successful, the Console program will
488 create a Volume record in the appropriate Pool.
490 The Volume name is restricted to letters, numbers, and the special
491 characters hyphen ({\bf -}), underscore ({\bf \_}), colon ({\bf :}), and
492 period ({\bf .}). All other characters including a space are illegal.
493 This restriction is to ensure good readability of Volume names to reduce
496 Please note, when labeling a blank tape, Bacula will get {\bf read I/O
497 error} when it attempts to ensure that the tape is already labeled. If
498 you wish to avoid getting these messages, please write an EOF mark on
499 your tape before attempting to label it:
509 The label command can fail for a number of reasons:
512 \item The Volume name you specify is already in the Volume database.
513 \item The Storage daemon has a tape already mounted on the device, in which
514 case you must {\bf unmount} the device, insert a blank tape, then do the
516 \item The tape in the device is already a Bacula labeled tape. (Bacula will
517 never relabel a Bacula labeled tape unless it is recycled and you use the
518 {\bf relabel} command).
519 \item There is no tape in the drive.
522 There are two ways to relabel a volume that already has a Bacula label. The
523 brute force method is to write an end of file mark on the tape using the
524 system {\bf mt} program, something like the following:
528 mt -f /dev/st0 rewind
533 Then you use the {\bf label} command to add a new label. However, this could
534 leave traces of the old volume in the catalog.
536 The preferable method to relabel a tape is to first {\bf purge} the volume,
537 either automatically, or explicitly with the {\bf purge} command, then use
538 the {\bf relabel} command described below.
540 If your autochanger has barcode labels, you can label all the Volumes in your
541 autochanger one after another by using the {\bf label barcodes} command. For
542 each tape in the changer containing a barcode, Bacula will mount the tape and
543 then label it with the same name as the barcode. An appropriate Media record
544 will also be created in the catalog. Any barcode that begins with the same
545 characters as specified on the "CleaningPrefix=xxx" directive in the
546 Director's Pool resource, will be
547 treated as a cleaning tape, and will not be labeled. However,
548 an entry for the cleaning tape will be created in
549 the catalog. For example with:
555 Cleaning Prefix = "CLN"
561 Any slot containing a barcode of CLNxxxx will be treated as a cleaning tape
562 and will not be mounted. Note, the full form of the command is:
566 update storage=xxx pool=yyy slots=1-5,10 barcodes
571 \index[console]{list}
572 The list command lists the requested contents of the Catalog. The
573 various fields of each record are listed on a single line. The various
574 forms of the list command are:
579 list jobid=<id> (list jobid id)
581 list ujobid<unique job name> (list job with unique name)
583 list job=<job-name> (list all jobs with "job-name")
585 list jobname=<job-name> (same as above)
587 In the above, you can add "limit=nn" to limit the output to
592 list jobmedia jobid=<id>
594 list jobmedia job=<job-name>
596 list files jobid=<id>
598 list files job=<job-name>
608 list volumes jobid=<id>
610 list volumes pool=<pool-name>
612 list volumes job=<job-name>
614 list volume=<volume-name>
616 list nextvolume job=<job-name>
618 list nextvol job=<job-name>
620 list nextvol job=<job-name> days=nnn
625 What most of the above commands do should be more or less obvious. In
626 general if you do not specify all the command line arguments, the
627 command will prompt you for what is needed.
629 The {\bf list nextvol} command will print the Volume name to be used by
630 the specified job. You should be aware that exactly what Volume will be
631 used depends on a lot of factors including the time and what a prior job
632 will do. It may fill a tape that is not full when you issue this
633 command. As a consequence, this command will give you a good estimate
634 of what Volume will be used but not a definitive answer. In addition,
635 this command may have certain side effect because it runs through the
636 same algorithm as a job, which means it may automatically purge or
637 recycle a Volume. By default, the job specified must run within the
638 next two days or no volume will be found. You can, however, use the
639 {\bf days=nnn} specification to specify up to 50 days. For example,
640 if on Friday, you want to see what Volume will be needed on Monday,
641 for job MyJob, you would use {\bf list nextvol job=MyJob days=3}.
643 If you wish to add specialized commands that list the contents of the
644 catalog, you can do so by adding them to the {\bf query.sql} file.
645 However, this takes some knowledge of programming SQL. Please see the
646 {\bf query} command below for additional information. See below for
647 listing the full contents of a catalog record with the {\bf llist}
650 As an example, the command {\bf list pools} might produce the following
655 +------+---------+---------+---------+----------+-------------+
656 | PoId | Name | NumVols | MaxVols | PoolType | LabelFormat |
657 +------+---------+---------+---------+----------+-------------+
658 | 1 | Default | 0 | 0 | Backup | * |
659 | 2 | Recycle | 0 | 8 | Backup | File |
660 +------+---------+---------+---------+----------+-------------+
664 As mentioned above, the {\bf list} command lists what is in the
665 database. Some things are put into the database immediately when Bacula
666 starts up, but in general, most things are put in only when they are
667 first used, which is the case for a Client as with Job records, etc.
669 Bacula should create a client record in the database the first time you
670 run a job for that client. Doing a {\bf status} will not cause a
671 database record to be created. The client database record will be
672 created whether or not the job fails, but it must at least start. When
673 the Client is actually contacted, additional info from the client will
674 be added to the client record (a "uname -a" output).
676 If you want to see what Client resources you have available in your conf
677 file, you use the Console command {\bf show clients}.
680 \index[console]{llist}
681 The llist or "long list" command takes all the same arguments that the
682 list command described above does. The difference is that the llist
683 command list the full contents of each database record selected. It
684 does so by listing the various fields of the record vertically, with one
685 field per line. It is possible to produce a very large number of output
686 lines with this command.
688 If instead of the {\bf list pools} as in the example above, you enter
689 {\bf llist pools} you might get the following output:
700 VolRetention: 1,296,000
701 VolUseDuration: 86,400
717 VolUseDuration: 3,600
729 \index[console]{messages}
730 This command causes any pending console messages to be immediately displayed.
734 \index[console]{mount}
735 The mount command is used to get Bacula to read a volume on a physical
736 device. It is a way to tell Bacula that you have mounted a tape and
737 that Bacula should examine the tape. This command is used only after
738 there was no Volume in a drive and Bacula requests you to mount a new
739 Volume or when you have specifically unmounted a Volume with the {\bf
740 unmount} console command, which causes Bacula to close the drive. If
741 you have an autoloader, the mount command will not cause Bacula to
742 operate the autoloader. The various forms of the mount command are:
744 mount storage=\lt{}storage-name\gt{}
746 mount [ jobid=\lt{}id\gt{} | job=\lt{}job-name\gt{} ]
748 If you have specified {\bf Automatic Mount = yes} in the Storage daemon's
749 Device resource, under most circumstances, Bacula will automatically access
750 the Volume unless you have explicitly {\bf unmount}ed it in the Console
754 \index[console]{python}
755 The python command takes a single argument {\bf restart}:
759 This causes the Python interpreter in the Director to be reinitialized.
760 This can be helpful for testing because once the Director starts and the
761 Python interpreter is initialized, there is no other way to make it
762 accept any changes to the startup script {\bf DirStartUp.py}. For more
763 details on Python scripting, please see the \ilink{Python
764 Scripting}{_ChapterStart60} chapter of this manual.
766 \label{ManualPruning}
768 \index[console]{prune}
769 The Prune command allows you to safely remove expired database records
770 from Jobs and Volumes. This command works only on the Catalog database
771 and does not affect data written to Volumes. In all cases, the Prune
772 command applies a retention period to the specified records. You can
773 Prune expired File entries from Job records; you can Prune expired Job
774 records from the database, and you can Prune both expired Job and File
775 records from specified Volumes.
777 prune files|jobs|volume client=\lt{}client-name\gt{}
778 volume=\lt{}volume-name\gt{}
780 For a Volume to be pruned, the {\bf VolStatus} must be Full, Used, or
781 Append, otherwise the pruning will not take place.
784 \index[console]{purge}
785 The Purge command will delete associated Catalog database records from
786 Jobs and Volumes without considering the retention period. {\bf Purge}
787 works only on the Catalog database and does not affect data written to
788 Volumes. This command can be dangerous because you can delete catalog
789 records associated with current backups of files, and we recommend that
790 you do not use it unless you know what you are doing. The permitted
791 forms of {\bf purge} are:
793 purge files jobid=\lt{}jobid\gt{}|job=\lt{}job-name\gt{}|client=\lt{}client-name\gt{}
795 purge jobs client=\lt{}client-name\gt{} (of all jobs)
797 purge volume|volume=\lt{}vol-name\gt{} (of all jobs)
799 For the {\bf purge} command to work on Volume Catalog database records the
800 {\bf VolStatus} must be Append, Full, Used, or Error.
802 The actual data written to the Volume will be unaffected by this command.
805 \index[console]{relabel}
806 \index[general]{relabel}
807 This command is used to label physical volumes. The full form of this
810 relabel storage=\lt{}storage-name\gt{} oldvolume=\lt{}old-volume-name\gt{}
811 volume=\lt{}newvolume-name\gt{}
813 If you leave out any part, you will be prompted for it. In order for
814 the Volume (old-volume-name) to be relabeled, it must be in the catalog,
815 and the volume status must be marked {\bf Purged} or {\bf Recycle}.
816 This happens automatically as a result of applying retention periods, or
817 you may explicitly purge the volume using the {\bf purge} command.
819 Once the volume is physically relabeled, the old data previously written
820 on the Volume is lost and cannot be recovered.
823 \index[console]{release}
824 This command is used to cause the Storage daemon to rewind (release) the
825 current tape in the drive, and to re-read the Volume label the next time
828 release storage=\lt{}storage-name\gt{}
830 After a release command, the device is still kept open by Bacula (unless
831 Always Open is set to No in the Storage Daemon's configuration) so it
832 cannot be used by another program. However, with some tape drives, the
833 operator can remove the current tape and to insert a different one, and
834 when the next Job starts, Bacula will know to re-read the tape label to
835 find out what tape is mounted. If you want to be able to use the drive
836 with another program (e.g. {\bf mt}), you must use the {\bf unmount}
837 command to cause Bacula to completely release (close) the device.
840 \index[console]{reload}
841 The reload command causes the Director to re-read its configuration
842 file and apply the new values. The new values will take effect
843 immediately for all new jobs. However, if you change schedules,
844 be aware that the scheduler pre-schedules jobs up to two hours in
845 advance, so any changes that are to take place during the next two
846 hours may be delayed. Jobs that have already been scheduled to run
847 (i.e. surpassed their requested start time) will continue with the
848 old values. New jobs will use the new values. Each time you issue
849 a reload command while jobs are running, the prior config values
850 will queued until all jobs that were running before issuing
851 the reload terminate, at which time the old config values will
852 be released from memory. The Directory permits keeping up to
853 10 prior set of configurations before it will refuse a reload
854 command. Once at least one old set of config values has been
855 released it will again accept new reload commands.
857 While it is possible to reload the Director's configuration on the fly,
858 even while jobs are executing, this is a complex operation and not
859 without side effects. Accordingly, if you have to reload the Director's
860 configuration while Bacula is running, it is advisable to restart the
861 Director at the next convenient opportunity.
863 \label{restore_command}
865 \index[console]{restore}
866 The restore command allows you to select one or more Jobs (JobIds) to be
867 restored using various methods. Once the JobIds are selected, the File
868 records for those Jobs are placed in an internal Bacula directory tree,
869 and the restore enters a file selection mode that allows you to
870 interactively walk up and down the file tree selecting individual files
871 to be restored. This mode is somewhat similar to the standard Unix {\bf
872 restore} program's interactive file selection mode.
874 restore storage=\lt{}storage-name\gt{} client=\lt{}client-name\gt{}
875 where=\lt{}path\gt{} pool=\lt{}pool-name\gt{} fileset=\lt{}fileset-name\gt{}
876 select current all done
878 Where {\bf current}, if specified, tells the restore command to
879 automatically select a restore to the most current backup. If not
880 specified, you will be prompted. The {\bf all} specification tells the
881 restore command to restore all files. If it is not specified, you will
882 be prompted for the files to restore. For details of the {\bf restore}
883 command, please see the \ilink{Restore Chapter}{_ChapterStart13} of this
888 This command allows you to schedule jobs to be run immediately. The full form
891 run job=\lt{}job-name\gt{} client=\lt{}client-name\gt{}
892 fileset=\lt{}FileSet-name\gt{} level=\lt{}level-keyword\gt{}
893 storage=\lt{}storage-name\gt{} where=\lt{}directory-prefix\gt{}
894 when=\lt{}universal-time-specification\gt{} yes
896 Any information that is needed but not specified will be listed for
897 selection, and before starting the job, you will be prompted to accept,
898 reject, or modify the parameters of the job to be run, unless you have
899 specified {\bf yes}, in which case the job will be immediately sent to
902 On my system, when I enter a run command, I get the following prompt:
906 A job name must be specified.
907 The defined Job resources are:
917 Select Job resource (1-9):
922 If I then select number 5, I am prompted with:
928 FileSet: Minou Full Set
933 When: 2003-04-23 17:08:18
934 OK to run? (yes/mod/no):
939 If I now enter {\bf yes}, the Job will be run. If I enter {\bf mod}, I will
940 be presented with the following prompt.
944 Parameters to modify:
952 Select parameter to modify (1-7):
957 If you wish to start a job at a later time, you can do so by setting the When
958 time. Use the {\bf mod} option and select {\bf When} (no. 6). Then enter the
959 desired start time in YYYY-MM-DD HH:MM:SS format.
962 \index[console]{setdebug}
963 \index[dir]{setdebug}
964 \index[dir]{debugging}
965 \index[dir]{debugging Win32}
966 \index[dir]{Windows!debugging}
967 This command is used to set the debug level in each daemon. The form of this
970 setdebug level=nn [trace=0/1 client=\lt{}client-name\gt{} | dir | director |
971 storage=\lt{}storage-name\gt{} | all]
973 If trace=1 is set, then tracing will be enabled, and the daemon will be
974 placed in trace mode, which means that all debug output as set by the
975 debug level will be directed to the file {\bf bacula.trace} in the
976 current directory of the daemon. Normally, tracing is needed only for
977 Win32 clients where the debug output cannot be written to a terminal or
978 redirected to a file. When tracing, each debug output message is
979 appended to the trace file. You must explicitly delete the file when
983 \index[console]{show}
985 The show command will list the Director's resource records as defined in
986 the Director's configuration file (normally {\bf bacula-dir.conf}).
987 This command is used mainly for debugging purposes by developers.
988 The following keywords are accepted on the
989 show command line: catalogs, clients, counters, devices, directors,
990 filesets, jobs, messages, pools, schedules, storages, all, help.
991 Please don't confuse this command
992 with the {\bf list}, which displays the contents of the catalog.
995 \index[console]{sqlquery}
996 The sqlquery command puts the Console program into SQL query mode where
997 each line you enter is concatenated to the previous line until a
998 semicolon (;) is seen. The semicolon terminates the command, which is
999 then passed directly to the SQL database engine. When the output from
1000 the SQL engine is displayed, the formation of a new SQL command begins.
1001 To terminate SQL query mode and return to the Console command prompt,
1002 you enter a period (.) in column 1.
1004 Using this command, you can query the SQL catalog database directly.
1005 Note you should really know what you are doing otherwise you could
1006 damage the catalog database. See the {\bf query} command below for
1007 simpler and safer way of entering SQL queries.
1009 Depending on what database engine you are using (MySQL, PostgreSQL or
1010 SQLite), you will have somewhat different SQL commands available. For
1011 more detailed information, please refer to the MySQL, PostgreSQL or
1012 SQLite documentation.
1016 This command will display the status of the next jobs that are scheduled
1017 during the next twenty-four hours as well as the status of currently
1018 running jobs. The full form of this command is:
1020 status [all | dir=\lt{}dir-name\gt{} | director |
1021 client=\lt{}client-name\gt{} | storage=\lt{}storage-name\gt{} |
1024 If you do a {\bf status dir}, the console will list any currently
1025 running jobs, a summary of all jobs scheduled to be run in the next 24
1026 hours, and a listing of the last 10 terminated jobs with their statuses.
1027 The scheduled jobs summary will include the Volume name to be used. You
1028 should be aware of two things: 1. to obtain the volume name, the code
1029 goes through the same code that will be used when the job runs, which
1030 means that it may prune or recycle a Volume; 2. The Volume listed is
1031 only a best guess. The Volume actually used may be different because of
1032 the time difference (more durations may expire when the job runs) and
1033 another job could completely fill the Volume requiring a new one.
1035 In the Running Jobs listing, you may find the following types of
1041 2507 Catalog MatouVerify.2004-03-13_05.05.02 is waiting execution
1042 5349 Full CatalogBackup.2004-03-13_01.10.00 is waiting for higher
1043 priority jobs to finish
1044 5348 Differe Minou.2004-03-13_01.05.09 is waiting on max Storage jobs
1045 5343 Full Rufus.2004-03-13_01.05.04 is running
1049 Looking at the above listing from bottom to top, obviously JobId 5343
1050 (Rufus) is running. JobId 5348 (Minou) is waiting for JobId 5343 to
1051 finish because it is using the Storage resource, hence the "waiting on
1052 max Storage jobs". JobId 5349 has a lower priority than all the other
1053 jobs so it is waiting for higher priority jobs to finish, and finally,
1054 JobId 2508 (MatouVerify) is waiting because only one job can run at a
1055 time, hence it is simply "waiting execution"
1057 If you do a {\bf status dir}, it will by default list the first
1058 occurrence of all jobs that are scheduled today and tomorrow. If you
1059 wish to see the jobs that are scheduled in the next 3 days (e.g. on
1060 Friday you want to see the first occurrence of what tapes are scheduled
1061 to be used on Friday, the weekend, and Monday), you can add the {\bf
1062 days=3} option. Note, a {\bf days=0} shows the first occurrence of jobs
1063 scheduled today only. If you have multiple run statements, the first
1064 occurrence of each run statement for the job will be displayed for the
1067 If your job seems to be blocked, you can get a general idea of the
1068 problem by doing a {\bf status dir}, but you can most often get a
1069 much more specific indication of the problem by doing a
1070 {\bf status storage=xxx}. For example, on an idle test system, when
1071 I do {\bf status storage=File}, I get:
1075 Connecting to Storage daemon File at 192.168.68.112:8103
1077 rufus-sd Version: 1.39.6 (24 March 2006) i686-pc-linux-gnu redhat (Stentz)
1078 Daemon started 26-Mar-06 11:06, 0 Jobs run since started.
1084 Jobs waiting to reserve a drive:
1088 JobId Level Files Bytes Status Finished Name
1089 ======================================================================
1090 59 Full 234 4,417,599 OK 15-Jan-06 11:54 kernsave
1094 utochanger "DDS-4-changer" with devices:
1096 Device "DDS-4" (/dev/nst0) is mounted with Volume="TestVolume002"
1098 Slot 2 is loaded in drive 0.
1099 Total Bytes Read=0 Blocks Read=0 Bytes/block=0
1100 Positioned at File=0 Block=0
1101 Device "Dummy" is not open or does not exist.
1102 No DEVICE structure.
1104 Device "DVD-Writer" (/dev/hdc) is not open.
1105 Device "File" (/tmp) is not open.
1108 In Use Volume status:
1113 Now, what this tells me is that no jobs are running and that none of
1114 the devices are in use. Now, if I {\bf unmount} the autochanger, which
1115 will not be used in this example, and then start a Job that uses the
1116 File device, the job will block. When I re-issue the status storage
1117 command, I get for the Device status:
1124 Autochanger "DDS-4-changer" with devices:
1126 Device "DDS-4" (/dev/nst0) is not open.
1127 Device is BLOCKED. User unmounted.
1128 Drive 0 is not loaded.
1129 Device "Dummy" is not open or does not exist.
1130 No DEVICE structure.
1132 Device "DVD-Writer" (/dev/hdc) is not open.
1133 Device "File" (/tmp) is not open.
1134 Device is BLOCKED waiting for media.
1140 Now, here it should be clear that if a job were running that wanted
1141 to use the Autochanger (with two devices), it would block because
1142 the user unmounted the device. The real problem for the Job I started
1143 using the "File" device is that the device is blocked waiting for
1144 media -- that is Bacula needs you to label a Volume.
1147 \index[console]{unmount}
1148 This command causes the indicated Bacula Storage daemon to unmount the
1149 specified device. The forms of the command are the same as the mount command:
1152 unmount storage=<storage-name>
1154 unmount [ jobid=<id> | job=<job-name> ]
1158 \label{UpdateCommand}
1160 \index[console]{update}
1161 This command will update the catalog for either a specific Pool record, a Volume
1162 record, or the Slots in an autochanger with barcode capability. In the case
1163 of updating a Pool record, the new information will be automatically taken
1164 from the corresponding Director's configuration resource record. It can be
1165 used to increase the maximum number of volumes permitted or to set a maximum
1166 number of volumes. The following main keywords may be specified:
1169 media, volume, pool, slots
1173 In the case of updating a Volume, you will be prompted for which value you
1174 wish to change. The following Volume parameters may be changed:
1180 Volume Retention Period
1183 Maximum Volume Files
1184 Maximum Volume Bytes
1191 All Volumes from Pool
1196 For slots {\bf update slots}, Bacula will obtain a list of slots and
1197 their barcodes from the Storage daemon, and for each barcode found, it
1198 will automatically update the slot in the catalog Media record to
1199 correspond to the new value. This is very useful if you have moved
1200 cassettes in the magazine, or if you have removed the magazine and
1201 inserted a different one. As the slot of each Volume is updated, the
1202 InChanger flag for that Volume will also be set, and any other Volumes
1203 in the Pool that were last mounted on the same Storage device
1204 will have their InChanger flag turned off. This permits
1205 Bacula to know what magazine (tape holder) is currently in the
1208 If you do not have barcodes, you can accomplish the same thing in
1209 version 1.33 and later by using the {\bf update slots scan} command.
1210 The {\bf scan} keyword tells Bacula to physically mount each tape and to
1211 read its VolumeName.
1213 For Pool {\bf update pool}, Bacula will move the Volume record from its
1214 existing pool to the pool specified.
1216 For {\bf Volume from Pool} and {\bf All Volumes from Pool}, the
1217 following values are updated from the Pool record: Recycle,
1218 VolRetention, VolUseDuration, MaxVolJobs, MaxVolFiles, and MaxVolBytes.
1220 The full form of the update command with all command line arguments is:
1224 update volume=xxx pool=yyy slots volstatus=xxx VolRetention=ddd
1225 VolUse=ddd MaxVolJobs=nnn MaxVolBytes=nnn Recycle=yes|no
1232 \index[console]{use}
1233 This command allows you to specify which Catalog database to use. Normally,
1234 you will be using only one database so this will be done automatically. In
1235 the case that you are using more than one database, you can use this command
1236 to switch from one to another.
1238 use \lt{}database-name\gt{}
1242 \index[console]{var name}
1243 This command takes a string or quoted string and does variable expansion on
1244 it the same way variable expansion is done on the {\bf LabelFormat} string.
1245 Thus, for the most part, you can test your LabelFormat strings. The
1246 difference between the {\bf var} command and the actual LabelFormat process
1247 is that during the var command, no job is running so "dummy" values are
1248 used in place of Job specific variables. Generally, however, you will get a
1249 good idea of what is going to happen in the real case.
1252 \index[console]{version}
1253 The command prints the Director's version.
1256 \index[console]{quit}
1257 This command terminates the console program. The console program sends the
1258 {\bf quit} request to the Director and waits for acknowledgment. If the
1259 Director is busy doing a previous command for you that has not terminated, it
1260 may take some time. You may quit immediately by issuing the {\bf .quit}
1261 command (i.e. quit preceded by a period).
1264 \index[console]{query}
1265 This command reads a predefined SQL query from the query file (the name and
1266 location of the query file is defined with the QueryFile resource record in
1267 the Director's configuration file). You are prompted to select a query from
1268 the file, and possibly enter one or more parameters, then the command is
1269 submitted to the Catalog database SQL engine.
1271 The following queries are currently available (version 1.24):
1277 2: List where a file is saved:
1278 3: List where the most recent copies of a file are saved:
1279 4: List total files/bytes by Job:
1280 5: List total files/bytes by Volume:
1281 6: List last 20 Full Backups for a Client:
1282 7: List Volumes used by selected JobId:
1283 8: List Volumes to Restore All Files:
1284 9: List where a File is saved:
1285 Choose a query (1-9):
1291 \index[console]{exit}
1292 This command terminates the console program.
1295 \index[console]{wait}
1296 The wait command causes the Director to pause until there are no jobs
1297 running. This command is useful in a batch situation such as regression
1298 testing where you wish to start a job and wait until that job completes
1299 before continuing. This command now has the following options:
1302 wait [jobid=nn] [jobuid=unique id] [job=job name]
1305 If specified with a specific JobId, ... the wait command will wait
1306 for that particular job to terminate before continuing.
1311 \subsection*{Special dot Commands}
1312 \index[general]{Commands!Special dot}
1313 \index[general]{Special dot Commands}
1314 \addcontentsline{toc}{subsection}{Special dot Commands}
1316 There is a list of commands that are prefixed with a period (.). These
1317 commands are intended to be used either by batch programs or graphical user
1318 interface front-ends. They are not normally used by interactive users. Once
1319 GUI development begins, this list will be considerably expanded. The following
1320 is the list of dot commands:
1324 .backups job=xxx list backups for specified job
1325 .clients list all client names
1326 .defaults client=xxx fileset=yyy list defaults for specified client
1327 .die cause the Director to segment fault (for debugging)
1328 .dir when in tree mode prints the equivalent to the dir command,
1329 but with fields separated by commas rather than spaces.
1331 .filesets list all fileset names
1332 .help help command output
1333 .jobs list all job names
1334 .levels list all levels
1335 .messages get quick messages
1336 .msgs return any queued messages
1337 .pools list all pool names
1339 .status get status output
1340 .storage return storage resource names
1341 .types list job types
1347 \subsection*{Special At (@) Commands}
1348 \index[general]{Commands!Special At @}
1349 \index[general]{Special At (@) Commands}
1350 \addcontentsline{toc}{subsection}{Special At (@) Commands}
1352 Normally, all commands entered to the Console program are immediately
1353 forwarded to the Director, which may be on another machine, to be executed.
1354 However, there is a small list of {\bf at} commands, all beginning with an at
1355 character (@), that will not be sent to the Director, but rather interpreted
1356 by the Console program directly. Note, these commands are implemented only in
1357 the tty console program and not in the GNOME Console. These commands are:
1361 \item [@input \lt{}filename\gt{}]
1362 \index[console]{@input \lt{}filename\gt{}}
1363 Read and execute the commands contained in the file specified.
1365 \item [@output \lt{}filename\gt{} w/a]
1366 \index[console]{@output \lt{}filename\gt{} w/a}
1367 Send all following output to the filename specified either overwriting the
1368 file (w) or appending to the file (a). To redirect the output to the
1369 terminal, simply enter {\bf @output} without a filename specification.
1370 WARNING: be careful not to overwrite a valid file. A typical example during a
1371 regression test might be:
1382 \item [@tee \lt{}filename\gt{} w/a]
1383 \index[console]{@tee \lt{}filename\gt{} w/a}
1384 Send all subsequent output to both the specified file and the terminal. It is
1385 turned off by specifying {\bf @tee} or {\bf @output} without a filename.
1387 \item [@sleep \lt{}seconds\gt{}]
1388 \index[console]{@sleep \lt{}seconds\gt{}}
1389 Sleep the specified number of seconds.
1392 \index[console]{@time}
1393 Print the current time and date.
1396 \index[console]{@version}
1397 Print the console's version.
1400 \index[console]{@quit}
1404 \index[console]{@exit}
1407 \item [@\# anything]
1408 \index[console]{anything}
1414 \subsection*{Running the Console Program from a Shell Script}
1415 \index[general]{Script!Running the Console Program from a Shell}
1416 \index[general]{Running the Console Program from a Shell Script}
1417 \addcontentsline{toc}{subsection}{Running the Console Program from a Shell
1420 You can automate many Console tasks by running the console program from a
1421 shell script. For example, if you have created a file containing the following
1426 ./bconsole -c ./bconsole.conf <<END_OF_DATA
1427 unmount storage=DDS-4
1433 when that file is executed, it will unmount the current DDS-4 storage device.
1434 You might want to run this command during a Job by using the {\bf
1435 RunBeforeJob} or {\bf RunAfterJob} records.
1437 It is also possible to run the Console program from file input where the file
1438 contains the commands as follows:
1442 ./bconsole -c ./bconsole.conf <filename
1446 where the file named {\bf filename} contains any set of console commands.
1448 As a real example, the following script is part of the Bacula regression
1449 tests. It labels a volume (a disk volume), runs a backup, then does a restore
1454 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
1457 @output /tmp/log1.out
1458 label volume=TestVolume001
1465 @output /tmp/log2.out
1476 The output from the backup is directed to /tmp/log1.out and the output from
1477 the restore is directed to /tmp/log2.out. To ensure that the backup and
1478 restore ran correctly, the output files are checked with:
1482 grep "^Termination: *Backup OK" /tmp/log1.out
1484 grep "^Termination: *Restore OK" /tmp/log2.out
1489 \subsection*{Adding Volumes to a Pool}
1490 \index[general]{Adding Volumes to a Pool}
1491 \index[general]{Pool!Adding Volumes to a}
1492 \addcontentsline{toc}{subsection}{Adding Volumes to a Pool}
1494 If you have used the {\bf label} command to label a Volume, it will be
1495 automatically added to the Pool, and you will not need to add any media to the
1498 Alternatively, you may choose to add a number of Volumes to the pool without
1499 labeling them. At a later time when the Volume is requested by {\bf Bacula}
1500 you will need to label it.
1502 Before adding a volume, you must know the following information:
1505 \item The name of the Pool (normally "Default")
1506 \item The Media Type as specified in the Storage Resource in the Director's
1507 configuration file (e.g. "DLT8000")
1508 \item The number and names of the Volumes you wish to create.
1511 For example, to add media to a Pool, you would issue the following commands to
1512 the console program:
1517 Enter name of Pool to add Volumes to: Default
1518 Enter the Media Type: DLT8000
1519 Enter number of Media volumes to create. Max=1000: 10
1520 Enter base volume name: Save
1521 Enter the starting number: 1
1522 10 Volumes created in pool Default
1527 To see what you have added, enter:
1531 *list media pool=Default
1532 +-------+----------+---------+---------+-------+------------------+
1533 | MedId | VolumeNa | MediaTyp| VolStat | Bytes | LastWritten |
1534 +-------+----------+---------+---------+-------+------------------+
1535 | 11 | Save0001 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1536 | 12 | Save0002 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1537 | 13 | Save0003 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1538 | 14 | Save0004 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1539 | 15 | Save0005 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1540 | 16 | Save0006 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1541 | 17 | Save0007 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1542 | 18 | Save0008 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1543 | 19 | Save0009 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1544 | 20 | Save0010 | DLT8000 | Append | 0 | 0000-00-00 00:00 |
1545 +-------+----------+---------+---------+-------+------------------+
1550 Notice that the console program automatically appended a number to the base
1551 Volume name that you specify (Save in this case). If you don't want it to
1552 append a number, you can simply answer 0 (zero) to the question "Enter number
1553 of Media volumes to create. Max=1000:", and in this case, it will create a
1554 single Volume with the exact name you specify.