<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2008 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>The Bootstrap File</TITLE> <META NAME="description" CONTENT="The Bootstrap File"> <META NAME="keywords" CONTENT="main"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2008"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="main.css"> <LINK REL="next" HREF="Bacula_Copyright_Trademark_.html"> <LINK REL="previous" HREF="Bacula_Security_Issues.html"> <LINK REL="up" HREF="Bacula_Main_Reference.html"> <LINK REL="next" HREF="Bacula_Copyright_Trademark_.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html2057" HREF="Bacula_Copyright_Trademark_.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html2051" HREF="Bacula_Main_Reference.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html2045" HREF="Bacula_Security_Issues.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html2053" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html2055" HREF="Thanks.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html2058" HREF="Bacula_Copyright_Trademark_.html">Bacula Copyright, Trademark, and</A> <B> Up:</B> <A NAME="tex2html2052" HREF="Bacula_Main_Reference.html">Bacula Main Reference</A> <B> Previous:</B> <A NAME="tex2html2046" HREF="Bacula_Security_Issues.html">Bacula Security Issues</A> <B> <A NAME="tex2html2054" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html2056" HREF="Thanks.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <!--Table of Child-Links--> <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A> <UL> <LI><A NAME="tex2html2059" HREF="Bootstrap_File.html#SECTION004710000000000000000">Bootstrap File Format</A> <LI><A NAME="tex2html2060" HREF="Bootstrap_File.html#SECTION004720000000000000000">Automatic Generation of Bootstrap Files</A> <LI><A NAME="tex2html2061" HREF="Bootstrap_File.html#SECTION004730000000000000000">Bootstrap for bscan</A> <LI><A NAME="tex2html2062" HREF="Bootstrap_File.html#SECTION004740000000000000000">A Final Bootstrap Example</A> </UL> <!--End of Table of Child-Links--> <HR> <H1><A NAME="SECTION004700000000000000000"></A> <A NAME="BootstrapChapter"></A> <BR> The Bootstrap File </H1> <A NAME="22296"></A> <A NAME="22297"></A> <P> The information in this chapter is provided so that you may either create your own bootstrap files, or so that you can edit a bootstrap file produced by <B>Bacula</B>. However, normally the bootstrap file will be automatically created for you during the restore_command_ConsoleChapter command in the Console program, or by using a Write Bootstrapwritebootstrap record in your Backup Jobs, and thus you will never need to know the details of this file. <P> The <B>bootstrap</B> file contains ASCII information that permits precise specification of what files should be restored, what volume they are on, and where they are on the volume. It is a relatively compact form of specifying the information, is human readable, and can be edited with any text editor. <P> <H1><A NAME="SECTION004710000000000000000"> Bootstrap File Format</A> </H1> <A NAME="22305"></A> <A NAME="22306"></A> <P> The general format of a <B>bootstrap</B> file is: <P> <B>keyword= value</B> <P> Where each <B>keyword</B> and the <B>value</B> specify which files to restore. More precisely the <B>keyword</B> and their <B>values</B> serve to limit which files will be restored and thus act as a filter. The absence of a keyword means that all records will be accepted. <P> Blank lines and lines beginning with a pound sign (#) in the bootstrap file are ignored. <P> There are keywords which permit filtering by Volume, Client, Job, FileIndex, Session Id, Session Time, ... <P> The more keywords that are specified, the more selective the specification of which files to restore will be. In fact, each keyword is <B>AND</B>ed with other keywords that may be present. <P> For example, <P> <PRE> Volume = Test-001 VolSessionId = 1 VolSessionTime = 108927638 </PRE> <P> directs the Storage daemon (or the <B>bextract</B> program) to restore only those files on Volume Test-001 <B>AND</B> having VolumeSessionId equal to one <B>AND</B> having VolumeSession time equal to 108927638. <P> The full set of permitted keywords presented in the order in which they are matched against the Volume records are: <P> <DL> <DT><STRONG>Volume</STRONG></DT> <DD><A NAME="22323"></A> The value field specifies what Volume the following commands apply to. Each Volume specification becomes the current Volume, to which all the following commands apply until a new current Volume (if any) is specified. If the Volume name contains spaces, it should be enclosed in quotes. At lease one Volume specification is required. <P> </DD> <DT><STRONG>Count</STRONG></DT> <DD><A NAME="22324"></A> The value is the total number of files that will be restored for this Volume. This allows the Storage daemon to know when to stop reading the Volume. This value is optional. <P> </DD> <DT><STRONG>VolFile</STRONG></DT> <DD><A NAME="22325"></A> The value is a file number, a list of file numbers, or a range of file numbers to match on the current Volume. The file number represents the physical file on the Volume where the data is stored. For a tape volume, this record is used to position to the correct starting file, and once the tape is past the last specified file, reading will stop. <P> </DD> <DT><STRONG>VolBlock</STRONG></DT> <DD><A NAME="22326"></A> The value is a block number, a list of block numbers, or a range of block numbers to match on the current Volume. The block number represents the physical block within the file on the Volume where the data is stored. <P> </DD> <DT><STRONG>VolSessionTime</STRONG></DT> <DD><A NAME="22327"></A> The value specifies a Volume Session Time to be matched from the current volume. <P> </DD> <DT><STRONG>VolSessionId</STRONG></DT> <DD><A NAME="22328"></A> The value specifies a VolSessionId, a list of volume session ids, or a range of volume session ids to be matched from the current Volume. Each VolSessionId and VolSessionTime pair corresponds to a unique Job that is backed up on the Volume. <P> </DD> <DT><STRONG>JobId</STRONG></DT> <DD><A NAME="22329"></A> The value specifies a JobId, list of JobIds, or range of JobIds to be selected from the current Volume. Note, the JobId may not be unique if you have multiple Directors, or if you have reinitialized your database. The JobId filter works only if you do not run multiple simultaneous jobs. This value is optional and not used by Bacula to restore files. <P> </DD> <DT><STRONG>Job</STRONG></DT> <DD><A NAME="22330"></A> The value specifies a Job name or list of Job names to be matched on the current Volume. The Job corresponds to a unique VolSessionId and VolSessionTime pair. However, the Job is perhaps a bit more readable by humans. Standard regular expressions (wildcards) may be used to match Job names. The Job filter works only if you do not run multiple simultaneous jobs. This value is optional and not used by Bacula to restore files. <P> </DD> <DT><STRONG>Client</STRONG></DT> <DD><A NAME="22331"></A> The value specifies a Client name or list of Clients to will be matched on the current Volume. Standard regular expressions (wildcards) may be used to match Client names. The Client filter works only if you do not run multiple simultaneous jobs. This value is optional and not used by Bacula to restore files. <P> </DD> <DT><STRONG>FileIndex</STRONG></DT> <DD><A NAME="22332"></A> The value specifies a FileIndex, list of FileIndexes, or range of FileIndexes to be selected from the current Volume. Each file (data) stored on a Volume within a Session has a unique FileIndex. For each Session, the first file written is assigned FileIndex equal to one and incremented for each file backed up. <P> This for a given Volume, the triple VolSessionId, VolSessionTime, and FileIndex uniquely identifies a file stored on the Volume. Multiple copies of the same file may be stored on the same Volume, but for each file, the triple VolSessionId, VolSessionTime, and FileIndex will be unique. This triple is stored in the Catalog database for each file. <P> To restore a particular file, this value (or a range of FileIndexes) is required. <P> </DD> <DT><STRONG>FileRegex</STRONG></DT> <DD><A NAME="22333"></A> The value is a regular expression. When specified, only matching filenames will be restored. <P> <PRE> FileRegex=^/etc/passwd(.old)? </PRE> <P> </DD> <DT><STRONG>Slot</STRONG></DT> <DD><A NAME="22336"></A> The value specifies the autochanger slot. There may be only a single <B> Slot</B> specification for each Volume. <P> </DD> <DT><STRONG>Stream</STRONG></DT> <DD><A NAME="22338"></A> The value specifies a Stream, a list of Streams, or a range of Streams to be selected from the current Volume. Unless you really know what you are doing (the internals of <B>Bacula</B>), you should avoid this specification. This value is optional and not used by Bacula to restore files. <P> </DD> <DT><STRONG>*JobType</STRONG></DT> <DD><A NAME="22340"></A> Not yet implemented. <P> </DD> <DT><STRONG>*JobLevel</STRONG></DT> <DD><A NAME="22341"></A> Not yet implemented. </DD> </DL> <P> The <B>Volume</B> record is a bit special in that it must be the first record. The other keyword records may appear in any order and any number following a Volume record. <P> Multiple Volume records may be specified in the same bootstrap file, but each one starts a new set of filter criteria for the Volume. <P> In processing the bootstrap file within the current Volume, each filter specified by a keyword is <B>AND</B>ed with the next. Thus, <P> <PRE> Volume = Test-01 Client = "My machine" FileIndex = 1 </PRE> <P> will match records on Volume <B>Test-01</B> <B>AND</B> Client records for <B>My machine</B> <B>AND</B> FileIndex equal to <B>one</B>. <P> Multiple occurrences of the same record are <B>OR</B>ed together. Thus, <P> <PRE> Volume = Test-01 Client = "My machine" Client = "Backup machine" FileIndex = 1 </PRE> <P> will match records on Volume <B>Test-01</B> <B>AND</B> (Client records for <B>My machine</B> <B>OR</B> <B>Backup machine</B>) <B>AND</B> FileIndex equal to <B>one</B>. <P> For integer values, you may supply a range or a list, and for all other values except Volumes, you may specify a list. A list is equivalent to multiple records of the same keyword. For example, <P> <PRE> Volume = Test-01 Client = "My machine", "Backup machine" FileIndex = 1-20, 35 </PRE> <P> will match records on Volume <B>Test-01</B> <B>AND</B> <B>(</B>Client records for <B>My machine</B> <B>OR</B> <B>Backup machine</B><B>)</B> <B>AND</B> <B>(</B>FileIndex 1 <B>OR</B> 2 <B>OR</B> 3 ... <B>OR</B> 20 <B>OR</B> 35<B>)</B>. <P> As previously mentioned above, there may be multiple Volume records in the same bootstrap file. Each new Volume definition begins a new set of filter conditions that apply to that Volume and will be <B>OR</B>ed with any other Volume definitions. <P> As an example, suppose we query for the current set of tapes to restore all files on Client <B>Rufus</B> using the <B>query</B> command in the console program: <P> <PRE> Using default Catalog name=MySQL DB=bacula *query Available queries: 1: List Job totals: 2: List where a file is saved: 3: List where the most recent copies of a file are saved: 4: List total files/bytes by Job: 5: List total files/bytes by Volume: 6: List last 10 Full Backups for a Client: 7: List Volumes used by selected JobId: 8: List Volumes to Restore All Files: Choose a query (1-8): 8 Enter Client Name: Rufus +-------+------------------+------------+-----------+----------+------------+ | JobId | StartTime | VolumeName | StartFile | VolSesId | VolSesTime | +-------+------------------+------------+-----------+----------+------------+ | 154 | 2002-05-30 12:08 | test-02 | 0 | 1 | 1022753312 | | 202 | 2002-06-15 10:16 | test-02 | 0 | 2 | 1024128917 | | 203 | 2002-06-15 11:12 | test-02 | 3 | 1 | 1024132350 | | 204 | 2002-06-18 08:11 | test-02 | 4 | 1 | 1024380678 | +-------+------------------+------------+-----------+----------+------------+ </PRE> <P> The output shows us that there are four Jobs that must be restored. The first one is a Full backup, and the following three are all Incremental backups. <P> The following bootstrap file will restore those files: <P> <PRE> Volume=test-02 VolSessionId=1 VolSessionTime=1022753312 Volume=test-02 VolSessionId=2 VolSessionTime=1024128917 Volume=test-02 VolSessionId=1 VolSessionTime=1024132350 Volume=test-02 VolSessionId=1 VolSessionTime=1024380678 </PRE> <P> As a final example, assume that the initial Full save spanned two Volumes. The output from <B>query</B> might look like: <P> <PRE> +-------+------------------+------------+-----------+----------+------------+ | JobId | StartTime | VolumeName | StartFile | VolSesId | VolSesTime | +-------+------------------+------------+-----------+----------+------------+ | 242 | 2002-06-25 16:50 | File0003 | 0 | 1 | 1025016612 | | 242 | 2002-06-25 16:50 | File0004 | 0 | 1 | 1025016612 | | 243 | 2002-06-25 16:52 | File0005 | 0 | 2 | 1025016612 | | 246 | 2002-06-25 19:19 | File0006 | 0 | 2 | 1025025494 | +-------+------------------+------------+-----------+----------+------------+ </PRE> <P> and the following bootstrap file would restore those files: <P> <PRE> Volume=File0003 VolSessionId=1 VolSessionTime=1025016612 Volume=File0004 VolSessionId=1 VolSessionTime=1025016612 Volume=File0005 VolSessionId=2 VolSessionTime=1025016612 Volume=File0006 VolSessionId=2 VolSessionTime=1025025494 </PRE> <P> <H1><A NAME="SECTION004720000000000000000"> Automatic Generation of Bootstrap Files</A> </H1> <A NAME="22391"></A> <A NAME="22392"></A> <P> One thing that is probably worth knowing: the bootstrap files that are generated automatically at the end of the job are not as optimized as those generated by the restore command. This is because during Incremental and Differential jobs, the records pertaining to the files written for the Job are appended to the end of the bootstrap file. As consequence, all the files saved to an Incremental or Differential job will be restored first by the Full save, then by any Incremental or Differential saves. <P> When the bootstrap file is generated for the restore command, only one copy (the most recent) of each file is restored. <P> So if you have spare cycles on your machine, you could optimize the bootstrap files by doing the following: <P> <PRE> ./bconsole restore client=xxx select all done no quit Backup bootstrap file. </PRE> <P> The above will not work if you have multiple FileSets because that will be an extra prompt. However, the <B>restore client=xxx select all</B> builds the in-memory tree, selecting everything and creates the bootstrap file. <P> The <B>no</B> answers the <B>Do you want to run this (yes/mod/no)</B> question. <P> <A NAME="bscanBootstrap"></A> <H1><A NAME="SECTION004730000000000000000"> Bootstrap for bscan</A> </H1> <A NAME="22400"></A> <A NAME="22401"></A> <A NAME="22402"></A> If you have a very large number of Volumes to scan with <B>bscan</B>, you may exceed the command line limit (511 characters). I that case, you can create a simple bootstrap file that consists of only the volume names. An example might be: <P> <PRE> Volume="Vol001" Volume="Vol002" Volume="Vol003" Volume="Vol004" Volume="Vol005" </PRE> <P> <H1><A NAME="SECTION004740000000000000000"> A Final Bootstrap Example</A> </H1> <A NAME="22407"></A> <A NAME="22408"></A> <P> If you want to extract or copy a single Job, you can do it by selecting by JobId (code not tested) or better yet, if you know the VolSessionTime and the VolSessionId (printed on Job report and in Catalog), specifying this is by far the best. Using the VolSessionTime and VolSessionId is the way Bacula does restores. A bsr file might look like the following: <P> <PRE> Volume="Vol001" VolSessionId=10 VolSessionTime=1080847820 </PRE> <P> If you know how many files are backed up (on the job report), you can enormously speed up the selection by adding (let's assume there are 157 files): <P> <PRE> FileIndex=1-157 Count=157 </PRE> <P> Finally, if you know the File number where the Job starts, you can also cause bcopy to forward space to the right file without reading every record: <P> <PRE> VolFile=20 </PRE> <P> There is nothing magic or complicated about a BSR file. Parsing it and properly applying it within Bacula *is* magic, but you don't need to worry about that. <P> If you want to see a *real* bsr file, simply fire up the <B>restore</B> command in the console program, select something, then answer no when it prompts to run the job. Then look at the file <B>restore.bsr</B> in your working directory. <P> <HR> <!--Navigation Panel--> <A NAME="tex2html2057" HREF="Bacula_Copyright_Trademark_.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html2051" HREF="Bacula_Main_Reference.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html2045" HREF="Bacula_Security_Issues.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html2053" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html2055" HREF="Thanks.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html2058" HREF="Bacula_Copyright_Trademark_.html">Bacula Copyright, Trademark, and</A> <B> Up:</B> <A NAME="tex2html2052" HREF="Bacula_Main_Reference.html">Bacula Main Reference</A> <B> Previous:</B> <A NAME="tex2html2046" HREF="Bacula_Security_Issues.html">Bacula Security Issues</A> <B> <A NAME="tex2html2054" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html2056" HREF="Thanks.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> 2010-06-14 </ADDRESS> </BODY> </HTML>