Reload Slot Command
I have a PCIe device that only works correctly when the computer is fully powered off then on again. Issuing a simple reboot or reboot -p command does not appear to cycle the power to the PCIe card, which causes it not to work after the reboot. Is there a way to, from the OS, cycle power to a device in a PCIe slot? Commands are advanced features activated by typing certain strings of text. 1 Usage 1.1 Relative world coordinates: Tilde notation 1.2 Local coordinates: Caret notation 1.3 Target selectors 1.3.1 Target selector variables 1.3.2 Target selector arguments 1.4 Data tags 1.5 Raw JSON text 1.6 ID arguments in Java Edition 1.6.1 1.6.2 1.7 List of argument types in Java Edition 2 List.
SubsectionsThe Bacula Console (sometimes called the User Agent) is a program thatallows the user or the System Administrator, to interact with the BaculaDirector daemon while the daemon is running.
The current Bacula Console comes in two versions: a shell interface (TTYstyle), and a QT GUI interface (Bat). Both permit the administrator orauthorized users to interact with Bacula. You can determine the status of aparticular job, examine the contents of the Catalog as well as perform certaintape manipulations with the Console program.
In addition, there is a bwx-console built with wxWidgets that allows a graphicrestore of files. As of version 1.34.1 it is in an early stage of development,but it already is quite useful. Unfortunately, it has not been enhanced forsome time now.
Since the Console program interacts with the Director through the network, yourConsole and Director programs do not necessarily need to run on the samemachine.
In fact, a certain minimal knowledge of the Console program is needed in orderfor Bacula to be able to write on more than one tape, because when Bacularequests a new tape, it waits until the user, via the Console program,indicates that the new tape is mounted.
When the Console starts, it reads a standard Bacula configuration filenamed bconsole.conf or bat.conf in the case of the BatQT Console version from the current directory unless you specify the -ccommand line option (see below). This file allows default configuration of the Console, and at the current time, the only Resource Record definedis the Director resource, which gives the Console the name and address ofthe Director. For more information on configuration of the Consoleprogram, please see the Console ConfigurationFileConsoleConfChapter Chapter of this document.
The console program can be run with the following options:
After launching the Console program (bconsole), it will prompt you for the nextcommand with an asterisk (*). Generally, for all commands, you can simplyenter the command name and the Console program will prompt you for thenecessary arguments. Alternatively, in most cases, you may enter the commandfollowed by arguments. The general format is:
where command is one of the commands listed below; keyword is oneof the keywords listed below (usually followed by an argument); and argument is the value. The command may be abbreviated to the shortest uniqueform. If two commands have the same starting letters, the one that will beselected is the one that appears first in the help listing. If you wantthe second command, simply spell out the full command. None of the keywordsfollowing the command may be abbreviated.
For example:
will list all files saved for JobId 23. Or:
will display all the Pool resource records.
The maximum command line length is limited to 511 characters, so if youare scripting the console, you may need to take some care to limit theline length.
Normally, you simply enter quit or exit and the Console programwill terminate. However, it waits until the Director acknowledges the command.If the Director is already doing a lengthy command (e.g. prune), it may takesome time. If you want to immediately terminate the Console program, enter the.quit command.
There is currently no way to interrupt a Console command once issued (i.e.Ctrl-C does not work). However, if you are at a prompt that is asking you toselect one of several possibilities and you would like to abort the command,you can enter a period (.), and in most cases, you will either bereturned to the main command prompt or if appropriate the previous prompt (inthe case of nested prompts). In a few places such as where it is asking for aVolume name, the period will be taken to be the Volume name. In that case, youwill most likely be able to cancel at the next prompt.
Unless otherwise specified, each of the following keywordstakes an argument, which is specified after the keyword followingan equal sign. For example:
Please note, this list is incomplete as it is currently inthe process of being created and is not currently totally in alphabeticorder ...
- restart
- Permitted on the python command, and causes the Python interpreter to be restarted. Takes no argument.
- all
- Permitted on the status and show commands to specify all components or resources respectively.
- allfrompool
- Permitted on the update command to specify that all Volumes in the pool (specified on the command line) should be updated.
- allfrompools
- Permitted on the update command to specify that all Volumes in all pools should be updated.
- before
- Used in the restore command.
- bootstrap
- Used in the restore command.
- catalog
- Allowed in the use command to specify the catalog name to be used.
- catalogs
- Used in the show command. Takes no arguments.
- client fd
- clients
- Used in the show, list, and llist commands. Takes no arguments.
- counters
- Used in the show command. Takes no arguments.
- current
- Used in the restore command. Takes no argument.
- days
- Used to define the number of days the 'list nextvol' command should consider when looking for jobs to be run. The days keyword can also be used on the 'status dir' command so that it will display jobs scheduled for the number of days you want.
- devices
- Used in the show command. Takes no arguments.
- dir director
- directors
- Used in the show command. Takes no arguments.
- directory
- Used in the restore command. Its argument specifies the directory to be restored.
- enabled
- This keyword can appear on the update volume as well as the update slots commands, and can allows one of the following arguments: yes, true, no, false, archived, 0, 1, 2. Where 0 corresponds to no or false, 1 corresponds to yes or true, and 2 corresponds to archived. Archived volumes will not be used, nor will the Media record in the catalog be pruned. Volumes that are not enabled, will not be used for backup or restore.
- done
- Used in the restore command. Takes no argument.
- file
- Used in the restore command.
- files
- Used in the list and llist commands. Takes no arguments.
- fileset
- filesets
- Used in the show command. Takes no arguments.
- help
- Used in the show command. Takes no arguments.
- jobs
- Used in the show, list and llist commands. Takes no arguments.
- jobmedia
- Used in the list and llist commands. Takes no arguments.
- jobtotals
- Used in the list and llist commands. Takes no arguments.
- jobid
- The JobId is the numeric jobid that is printed in the Job Report output. It is the index of the database record for the given job. While it is unique for all the existing Job records in the catalog database, the same JobId can be reused once a Job is removed from the catalog. Probably you will refer specific Jobs that ran using their numeric JobId.
- job jobname
- The Job or Jobname keyword refers to the name you specified in the Job resource, and hence it refers to any number of Jobs that ran. It is typically useful if you want to list all jobs of a particular name.
- level
- listing
- Permitted on the estimate command. Takes no argument.
- limit
- messages
- Used in the show command. Takes no arguments.
- media
- Used in the list and llist commands. Takes no arguments.
- nextvol nextvolume
- Used in the list and llist commands. Takes no arguments.
- on
- Takes no keyword.
- off
- Takes no keyword.
- pool
- pools
- Used in the show, list, and llist commands. Takes no arguments.
- select
- Used in the restore command. Takes no argument.
- storages
- Used in the show command. Takes no arguments.
- schedules
- Used in the show command. Takes no arguments.
- sd store storage
- ujobid
- The ujobid is a unique job identification that is printed in the Job Report output. At the current time, it consists of the Job name (from the Name directive for the job) appended with the date and time the job was run. This keyword is useful if you want to completely identify the Job instance run.
- volume
- volumes
- Used in the list and llist commands. Takes no arguments.
- where
- Used in the restore command.
- yes
- Used in the restore command. Takes no argument.
The following commands are currently implemented:
Normally, the label command is used rather than this command because the label command labels the physical media (tape, disk, DVD, ...) and does the equivalent of the add command. The add command affects only the Catalog and not the physical media (data on Volumes). The physical media must exist and be labeled before use (usually with the label command). This command can, however, be useful if you wish to add a number of Volumes to the Pool that will be physically labeled at a later time. It can also be useful if you are importing a tape from another site. Please see the label command below for the list of legal characters in a Volume name.
When autodisplay is turned off, you must explicitly retrieve the messages with the messages command. When autodisplay is turned on, the messages will be displayed on the console as they are received.
Once a Job is marked to be canceled, it may take a bit of time (generally within a minute but up to two hours) before the Job actually terminates, depending on what operations it is doing. Don't be surprised that you receive a Job not found message. That just means that one of the three daemons had already canceled the job. Messages numbered in the 1000's are from the Director, 2000's are from the File daemon and 3000's from the Storage daemon.
When starting a Job, if Bacula determines that there is no Pool record in the database, but there is a Pool resource of the appropriate name, it will create it for you. If you want the Pool record to appear in the database immediately, simply use this command to force it to be created.
If the keyword Volume appears on the command line, the named Volume will be deleted from the catalog, if the keyword Pool appears on the command line, a Pool will be deleted, and if the keyword Job appears on the command line, a Job and all its associated records (File and JobMedia) will be deleted from the catalog. The full form of this command is:
or
The first form deletes a Pool record from the catalog database. The second form deletes a Volume record from the specified pool in the catalog database. The third form deletes the specified Job record from the catalog database. The last form deletes JobId records for JobIds n, m, o, p, q, r, and t. Where each one of the n,m,... is, of course, a number. That is a 'delete jobid' accepts lists and ranges of jobids.
The estimate command can use the accurate code to detect changes and give a better estimation. You can set the accurate behavior on command line using accurate=yes/no or use the Job setting as default value.
Optionally you may specify the keyword listing in which case, all the files to be backed up will be listed. Note, it could take quite some time to display them if the backup is large. The full form is:
Specification of the job is sufficient, but you can also override the client, fileset, accurate and/or level by specifying them on the estimate command line.
As an example, you might do:
which will do a full listing of all files to be backed up for the Job NightlySave during an Incremental save and put it in the file /tmp/listing. Note, the byte estimate provided by this command is based on the file size contained in the directory item. This can give wildly incorrect estimates of the actual storage used if there are sparse files on your systems. Sparse files are often found on 64 bit systems for certain system files. The size that is returned is the size Bacula will backup if the sparse option is not specified in the FileSet. There is currently no way to get an estimate of the real file size that would be found should the sparse option be enabled.
If you leave out any part, you will be prompted for it. The media type is automatically taken from the Storage resource definition that you supply. Once the necessary information is obtained, the Console program contacts the specified Storage daemon and requests that the Volume be labeled. If the Volume labeling is successful, the Console program will create a Volume record in the appropriate Pool.
The Volume name is restricted to letters, numbers, and the special characters hyphen (-), underscore (_), colon (:), and period (.). All other characters including a space are invalid. This restriction is to ensure good readability of Volume names to reduce operator errors.
Please note, when labeling a blank tape, Bacula will get read I/O error when it attempts to ensure that the tape is not already labeled. If you wish to avoid getting these messages, please write an EOF mark on your tape before attempting to label it:
The label command can fail for a number of reasons:
- The Volume name you specify is already in the Volume database.
- The Storage daemon has a tape or other Volume already mounted on the device, in which case you must unmount the device, insert a blank tape, then do the label command.
- The Volume in the device is already a Bacula labeled Volume. (Bacula will never relabel a Bacula labeled Volume unless it is recycled and you use the relabel command).
- There is no Volume in the drive.
There are two ways to relabel a volume that already has a Bacula label. Thebrute force method is to write an end of file mark on the tape using thesystem mt program, something like the following:
For a disk volume, you would manually delete the Volume.
Then you use the label command to add a new label. However, this couldleave traces of the old volume in the catalog.
The preferable method to relabel a Volume is to first purge the volume,either automatically, or explicitly with the purge command, then usethe relabel command described below.
If your autochanger has barcode labels, you can label all the Volumes inyour autochanger one after another by using the label barcodescommand. For each tape in the changer containing a barcode, Bacula willmount the tape and then label it with the same name as the barcode. Anappropriate Media record will also be created in the catalog. Any barcodethat begins with the same characters as specified on the'CleaningPrefix=xxx' directive in the Director's Pool resource, will betreated as a cleaning tape, and will not be labeled. However, an entry forthe cleaning tape will be created in the catalog. For example with:
Any slot containing a barcode of CLNxxxx will be treated as a cleaning tapeand will not be mounted. Note, the full form of the command is:
What most of the above commands do should be more or less obvious. In general if you do not specify all the command line arguments, the command will prompt you for what is needed.
The list nextvol command will print the Volume name to be used by the specified job. You should be aware that exactly what Volume will be used depends on a lot of factors including the time and what a prior job will do. It may fill a tape that is not full when you issue this command. As a consequence, this command will give you a good estimate of what Volume will be used but not a definitive answer. In addition, this command may have certain side effect because it runs through the same algorithm as a job, which means it may automatically purge or recycle a Volume. By default, the job specified must run within the next two days or no volume will be found. You can, however, use the days=nnn specification to specify up to 50 days. For example, if on Friday, you want to see what Volume will be needed on Monday, for job MyJob, you would use list nextvol job=MyJob days=3.
If you wish to add specialized commands that list the contents of the catalog, you can do so by adding them to the query.sql file. However, this takes some knowledge of programming SQL. Please see the query command below for additional information. See below for listing the full contents of a catalog record with the llist command.
As an example, the command list pools might produce the following output:
As mentioned above, the list command lists what is in the database. Some things are put into the database immediately when Bacula starts up, but in general, most things are put in only when they are first used, which is the case for a Client as with Job records, etc.
Bacula should create a client record in the database the first time you run a job for that client. Doing a status will not cause a database record to be created. The client database record will be created whether or not the job fails, but it must at least start. When the Client is actually contacted, additional info from the client will be added to the client record (a 'uname -a' output).
If you want to see what Client resources you have available in your conf file, you use the Console command show clients.
If instead of the list pools as in the example above, you enter llist pools you might get the following output:
mount storage=storage-name [ slot=num ] [ drive=num ]
mount [ jobid=id job=job-name ]
If you have specified Automatic Mount = yes in the Storage daemon's Device resource, under most circumstances, Bacula will automatically access the Volume unless you have explicitly unmounted it in the Console program.
prune files jobs volume stats client=client-name volume=volume-name
For a Volume to be pruned, the VolStatus must be Full, Used, or Append, otherwise the pruning will not take place.
purge files jobid=jobid job=job-name client=client-name
purge jobs client=client-name (of all jobs)
purge volume volume=vol-name (of all jobs)
For the purge command to work on Volume Catalog database records theVolStatus must be Append, Full, Used, or Error.
The actual data written to the Volume will be unaffected by this command unlessyou are using the ActionOnPurge=Truncate option on those Media.
To ask Bacula to truncate your Purged volumes, you need to use thefollowing command in interactive mode or in a RunScript:
This is possible to specify the volume name, the media type, the pool, thestorage, etc...(see help purge) Be sure that your storage device isidle when you decide to run this command.
python restart
This causes the Python interpreter in the Director to be reinitialized. This can be helpful for testing because once the Director starts and the Python interpreter is initialized, there is no other way to make it accept any changes to the startup script DirStartUp.py. For more details on Python scripting, please see the Python ScriptingPythonChapter chapter of this manual.
The following queries are currently available (version 2.2.7):
relabel storage=storage-name oldvolume=old-volume-name volume=newvolume-name
If you leave out any part, you will be prompted for it. In order for the Volume (old-volume-name) to be relabeled, it must be in the catalog, and the volume status must be marked Purged or Recycle. This happens automatically as a result of applying retention periods, or you may explicitly purge the volume using the purge command.
Once the volume is physically relabeled, the old data previously written on the Volume is lost and cannot be recovered.
release storage=storage-name
After a release command, the device is still kept open by Bacula (unless Always Open is set to No in the Storage Daemon's configuration) so it cannot be used by another program. However, with some tape drives, the operator can remove the current tape and to insert a different one, and when the next Job starts, Bacula will know to re-read the tape label to find out what tape is mounted. If you want to be able to use the drive with another program (e.g. mt), you must use the unmount command to cause Bacula to completely release (close) the device.
While it is possible to reload the Director's configuration on the fly, even while jobs are executing, this is a complex operation and not without side effects. Accordingly, if you have to reload the Director's configuration while Bacula is running, it is advisable to restart the Director at the next convenient opportunity.
restore storage=storage-name client=backup-client-name where=path pool=pool-name fileset=fileset-name restoreclient=restore-client-name select current all done
Where current, if specified, tells the restore command to automatically select a restore to the most current backup. If not specified, you will be prompted. The all specification tells the restore command to restore all files. If it is not specified, you will be prompted for the files to restore. For details of the restore command, please see the Restore ChapterRestoreChapter of this manual.
The client keyword initially specifies the client from which the backup was made and the client to which the restore will be make. However, if the restoreclient keyword is specified, then the restore is written to that client.
run job=job-name client=client-name fileset=FileSet-name level=level-keyword storage=storage-name where=directory-prefix when=universal-time-specification spooldata=yes no yes
Any information that is needed but not specified will be listed for selection, and before starting the job, you will be prompted to accept, reject, or modify the parameters of the job to be run, unless you have specified yes, in which case the job will be immediately sent to the scheduler.
On my system, when I enter a run command, I get the following prompt:
If I then select number 5, I am prompted with:
If I now enter yes, the Job will be run. If I enter mod, I willbe presented with the following prompt.
If you wish to start a job at a later time, you can do so by setting the Whentime. Use the mod option and select When (no. 6). Then enter thedesired start time in YYYY-MM-DD HH:MM:SS format.
The spooldata argument of the run command cannot be modified through the menuand is only accessible by setting its value on the intial command line. Ifno spooldata flag is set, the job, storage or schedule flag is used.
setdebug level=nn [trace=0/1 client=client-name dir director storage=storage-name all]
If trace=1 is set, then tracing will be enabled, and the daemon will be placed in trace mode, which means that all debug output as set by the debug level will be directed to the file bacula.trace in the current directory of the daemon. Normally, tracing is needed only for Win32 clients where the debug output cannot be written to a terminal or redirected to a file. When tracing, each debug output message is appended to the trace file. You must explicitly delete the file when you are done.
Using this command, you can query the SQL catalog database directly. Note you should really know what you are doing otherwise you could damage the catalog database. See the query command below for simpler and safer way of entering SQL queries.
Depending on what database engine you are using (MySQL, PostgreSQL or SQLite), you will have somewhat different SQL commands available. For more detailed information, please refer to the MySQL, PostgreSQL or SQLite documentation.
This command will display the status of all components. For the director, it will display the next jobs that are scheduled during the next 24 hours as well as the status of currently running jobs. For the Storage Daemon, you will have drive status or autochanger content. The File Daemon will give you information about current jobs like average speed or file accounting. The full form of this command is:
status [all dir=dir-name director [days=nnn] client=client-name [slots] storage=storage-name]
If you do a status dir, the console will list any currently running jobs, a summary of all jobs scheduled to be run in the next 24 hours, and a listing of the last ten terminated jobs with their statuses. The scheduled jobs summary will include the Volume name to be used. You should be aware of two things: 1. to obtain the volume name, the code goes through the same code that will be used when the job runs, but it does not do pruning nor recycling of Volumes; 2. The Volume listed is at best a guess. The Volume actually used may be different because of the time difference (more durations may expire when the job runs) and another job could completely fill the Volume requiring a new one.
In the Running Jobs listing, you may find the following types of information:
Looking at the above listing from bottom to top, obviously JobId 5343 (Rufus) is running. JobId 5348 (Minou) is waiting for JobId 5343 to finish because it is using the Storage resource, hence the 'waiting on max Storage jobs'. JobId 5349 has a lower priority than all the other jobs so it is waiting for higher priority jobs to finish, and finally, JobId 2507 (MatouVerify) is waiting because only one job can run at a time, hence it is simply 'waiting execution'
If you do a status dir, it will by default list the first occurrence of all jobs that are scheduled today and tomorrow. If you wish to see the jobs that are scheduled in the next three days (e.g. on Friday you want to see the first occurrence of what tapes are scheduled to be used on Friday, the weekend, and Monday), you can add the days=3 option. Note, a days=0 shows the first occurrence of jobs scheduled today only. If you have multiple run statements, the first occurrence of each run statement for the job will be displayed for the period specified.
If your job seems to be blocked, you can get a general idea of the problem by doing a status dir, but you can most often get a much more specific indication of the problem by doing a status storage=xxx. For example, on an idle test system, when I do status storage=File, I get:
Now, what this tells me is that no jobs are running and that none ofthe devices are in use. Now, if I unmount the autochanger, whichwill not be used in this example, and then start a Job that uses theFile device, the job will block. When I re-issue the status storagecommand, I get for the Device status:
Now, here it should be clear that if a job were running that wantedto use the Autochanger (with two devices), it would block becausethe user unmounted the device. The real problem for the Job I startedusing the 'File' device is that the device is blocked waiting formedia - that is Bacula needs you to label a Volume.
Once you unmount a storage device, Bacula will no longer be able to use it until you issue a mount command for that device. If Bacula needs to access that device, it will block and issue mount requests periodically to the operator.
If the device you are unmounting is an autochanger, it will unload the drive you have specified on the command line. If no drive is specified, it will assume drive 1.
In the case of updating a Volume, you will be prompted for which value youwish to change. The following Volume parameters may be changed:
For slots update slots, Bacula will obtain a list of slots and their barcodes from the Storage daemon, and for each barcode found, it will automatically update the slot in the catalog Media record to correspond to the new value. This is very useful if you have moved cassettes in the magazine, or if you have removed the magazine and inserted a different one. As the slot of each Volume is updated, the InChanger flag for that Volume will also be set, and any other Volumes in the Pool that were last mounted on the same Storage device will have their InChanger flag turned off. This permits Bacula to know what magazine (tape holder) is currently in the autochanger.
If you do not have barcodes, you can accomplish the same thing in version 1.33 and later by using the update slots scan command. The scan keyword tells Bacula to physically mount each tape and to read its VolumeName.
For Pool update pool, Bacula will move the Volume record from its existing pool to the pool specified.
For Volume from Pool, All Volumes from Pool and All Volumes from all Pools, the following values are updated from the Pool record: Recycle, RecyclePool, VolRetention, VolUseDuration, MaxVolJobs, MaxVolFiles, and MaxVolBytes. (RecyclePool feature is available with bacula 2.1.4 or higher.)
The full form of the update command with all command line arguments is:
use database-name
Reload Slot Stack-member-number Command
There is a list of commands that are prefixed with a period (.). Thesecommands are intended to be used either by batch programs or graphical userinterface front-ends. They are not normally used by interactive users. OnceGUI development begins, this list will be considerably expanded. The followingis the list of dot commands:
Normally, all commands entered to the Console program are immediatelyforwarded to the Director, which may be on another machine, to be executed.However, there is a small list of at commands, all beginning with an atcharacter (@), that will not be sent to the Director, but rather interpretedby the Console program directly. Note, these commands are implemented only inthe tty console program and not in the Bat Console. These commands are:
Reload Slot Command Cheat
Note, if you use a semicolon (;) as a separator character, which is common, you will not be able to use the sql command, which requires each command to be terminated by a semicolon.
You can automate many Console tasks by running the console program from ashell script. For example, if you have created a file containing the followingcommands:
when that file is executed, it will unmount the current DDS-4 storage device.You might want to run this command during a Job by using the RunBeforeJob or RunAfterJob records.
It is also possible to run the Console program from file input where the filecontains the commands as follows:
where the file named filename contains any set of console commands.
As a real example, the following script is part of the Bacula regressiontests. It labels a volume (a disk volume), runs a backup, then does a restoreof the files saved.
The output from the backup is directed to /tmp/log1.out and the output fromthe restore is directed to /tmp/log2.out. To ensure that the backup andrestore ran correctly, the output files are checked with:
If you have used the label command to label a Volume, it will beautomatically added to the Pool, and you will not need to add any media to thepool.
Alternatively, you may choose to add a number of Volumes to the pool withoutlabeling them. At a later time when the Volume is requested by Baculayou will need to label it.
Before adding a volume, you must know the following information:
- The name of the Pool (normally 'Default')
- The Media Type as specified in the Storage Resource in the Director's configuration file (e.g. 'DLT8000')
- The number and names of the Volumes you wish to create.
For example, to add media to a Pool, you would issue the following commands tothe console program:
To see what you have added, enter:
Notice that the console program automatically appended a number to the baseVolume name that you specify (Save in this case). If you don't want it toappend a number, you can simply answer 0 (zero) to the question 'Enter numberof Media volumes to create. Max=1000:', and in this case, it will create asingle Volume with the exact name you specify.
Kern Sibbald2010-08-30