1Catalog Services 2================ 3 4General 5------- 6 7This chapter is intended to be a technical discussion of the Catalog 8services and as such is not targeted at end users but rather at 9developers and system administrators that want or need to know more of 10the working details of **Bareos**. 11 12The **Bareos Catalog** services consist of the programs that provide the 13SQL database engine for storage and retrieval of all information 14concerning files that were backed up and their locations on the storage 15media. 16 17We have investigated the possibility of using the following SQL engines 18for Bareos: Beagle, mSQL, GNU SQL, PostgreSQL, SQLite, Oracle, and 19MySQL. Each presents certain problems with either licensing or maturity. 20At present, we have chosen for development purposes to use MySQL, 21PostgreSQL and SQLite. MySQL was chosen because it is fast, proven to be 22reliable, widely used, and actively being developed. MySQL is released 23under the GNU GPL license. PostgreSQL was chosen because it is a 24full-featured, very mature database, and because Dan Langille did the 25Bareos driver for it. PostgreSQL is distributed under the BSD license. 26SQLite was chosen because it is small, efficient, and can be directly 27embedded in **Bareos** thus requiring much less effort from the system 28administrator or person building **Bareos**. In our testing SQLite has 29performed very well, and for the functions that we use, it has never 30encountered any errors except that it does not appear to handle 31databases larger than 2GBytes. That said, we would not recommend it for 32serious production use. 33 34The Bareos SQL code has been written in a manner that will allow it to 35be easily modified to support any of the current SQL database systems on 36the market (for example: mSQL, iODBC, unixODBC, Solid, OpenLink ODBC, 37EasySoft ODBC, InterBase, Oracle8, Oracle7, and DB2). 38 39If you do not specify either **``--``\ with-mysql** or 40**``--``\ with-postgresql** or **``--``\ with-sqlite** on the 41./configure line, Bareos will use its minimalist internal database. This 42database is kept for build reasons but is no longer supported. Bareos 43**requires** one of the three databases (MySQL, PostgreSQL, or SQLite) 44to run. 45 46Filenames and Maximum Filename Length 47~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 48 49In general, either MySQL, PostgreSQL or SQLite permit storing arbitrary 50long path names and file names in the catalog database. In practice, 51there still may be one or two places in the Catalog interface code that 52restrict the maximum path length to 512 characters and the maximum file 53name length to 512 characters. These restrictions are believed to have 54been removed. Please note, these restrictions apply only to the Catalog 55database and thus to your ability to list online the files saved during 56any job. All information received and stored by the Storage daemon 57(normally on tape) allows and handles arbitrarily long path and 58filenames. 59 60Database Table Design 61~~~~~~~~~~~~~~~~~~~~~ 62 63All discussions that follow pertain to the MySQL database. The details 64for the PostgreSQL and SQLite databases are essentially identical except 65for that all fields in the SQLite database are stored as ASCII text and 66some of the database creation statements are a bit different. The 67details of the internal Bareos catalog are not discussed here. 68 69Because the Catalog database may contain very large amounts of data for 70large sites, we have made a modest attempt to normalize the data tables 71to reduce redundant information. While reducing the size of the database 72significantly, it does, unfortunately, add some complications to the 73structures. 74 75In simple terms, the Catalog database must contain a record of all Jobs 76run by Bareos, and for each Job, it must maintain a list of all files 77saved, with their File Attributes (permissions, create date, …), and the 78location and Media on which the file is stored. This is seemingly a 79simple task, but it represents a huge amount interlinked data. Note: the 80list of files and their attributes is not maintained when using the 81internal Bareos database. The data stored in the File records, which 82allows the user or administrator to obtain a list of all files backed up 83during a job, is by far the largest volume of information put into the 84Catalog database. 85 86Although the Catalog database has been designed to handle backup data 87for multiple clients, some users may want to maintain multiple 88databases, one for each machine to be backed up. This reduces the risk 89of confusion of accidental restoring a file to the wrong machine as well 90as reducing the amount of data in a single database, thus increasing 91efficiency and reducing the impact of a lost or damaged database. 92 93Sequence of Creation of Records for a Save Job 94---------------------------------------------- 95 96Start with StartDate, ClientName, Filename, Path, Attributes, MediaName, 97MediaCoordinates. (PartNumber, NumParts). In the steps below, “Create 98new” means to create a new record whether or not it is unique. “Create 99unique” means each record in the database should be unique. Thus, one 100must first search to see if the record exists, and only if not should a 101new one be created, otherwise the existing RecordId should be used. 102 1031. Create new Job record with StartDate; save JobId 104 1052. Create unique Media record; save MediaId 106 1073. Create unique Client record; save ClientId 108 1094. Create unique Filename record; save FilenameId 110 1115. Create unique Path record; save PathId 112 1136. Create unique Attribute record; save AttributeId store ClientId, 114 FilenameId, PathId, and Attributes 115 1167. Create new File record store JobId, AttributeId, MediaCoordinates, 117 etc 118 1198. Repeat steps 4 through 8 for each file 120 1219. Create a JobMedia record; save MediaId 122 12310. Update Job record filling in EndDate and other Job statistics 124 125Database Tables 126--------------- 127 128Filename 129~~~~~~~~ 130 131+-------------+-----------+-------------+ 132| Column Name | Data Type | Remark | 133+=============+===========+=============+ 134| FilenameId | integer | Primary Key | 135+-------------+-----------+-------------+ 136| Name | Blob | Filename | 137+-------------+-----------+-------------+ 138 139The **Filename** table shown above contains the name of each file backed 140up with the path removed. If different directories or machines contain 141the same filename, only one copy will be saved in this table. 142 143Path 144~~~~ 145 146+-------------+-----------+-------------+ 147| Column Name | Data Type | Remark | 148+=============+===========+=============+ 149| PathId | integer | Primary Key | 150+-------------+-----------+-------------+ 151| Path | Blob | Full Path | 152+-------------+-----------+-------------+ 153 154The **Path** table contains shown above the path or directory names of 155all directories on the system or systems. The filename and any MSDOS 156disk name are stripped off. As with the filename, only one copy of each 157directory name is kept regardless of how many machines or drives have 158the same directory. These path names should be stored in Unix path name 159format. 160 161Some simple testing on a Linux file system indicates that separating the 162filename and the path may be more complication than is warranted by the 163space savings. For example, this system has a total of 89,097 files, 16460,467 of which have unique filenames, and there are 4,374 unique paths. 165 166Finding all those files and doing two stats() per file takes an average 167wall clock time of 1 min 35 seconds on a 400MHz machine running RedHat 1686.1 Linux. 169 170Finding all those files and putting them directly into a MySQL database 171with the path and filename defined as TEXT, which is variable length up 172to 65,535 characters takes 19 mins 31 seconds and creates a 27.6 MByte 173database. 174 175Doing the same thing, but inserting them into Blob fields with the 176filename indexed on the first 30 characters and the path name indexed on 177the 255 (max) characters takes 5 mins 18 seconds and creates a 5.24 MB 178database. Rerunning the job (with the database already created) takes 179about 2 mins 50 seconds. 180 181Running the same as the last one (Path and Filename Blob), but Filename 182indexed on the first 30 characters and the Path on the first 50 183characters (linear search done there after) takes 5 mins on the average 184and creates a 3.4 MB database. Rerunning with the data already in the DB 185takes 3 mins 35 seconds. 186 187Finally, saving only the full path name rather than splitting the path 188and the file, and indexing it on the first 50 characters takes 6 mins 43 189seconds and creates a 7.35 MB database. 190 191File 192~~~~ 193 194+-------------+-----------+---------------------------------------+ 195| Column Name | Data Type | Remark | 196+=============+===========+=======================================+ 197| FileId | integer | Primary Key | 198+-------------+-----------+---------------------------------------+ 199| FileIndex | integer | The sequential file number in the Job | 200+-------------+-----------+---------------------------------------+ 201| JobId | integer | Link to Job Record | 202+-------------+-----------+---------------------------------------+ 203| PathId | integer | Link to Path Record | 204+-------------+-----------+---------------------------------------+ 205| FilenameId | integer | Link to Filename Record | 206+-------------+-----------+---------------------------------------+ 207| DeltaSeq | smallint | | 208+-------------+-----------+---------------------------------------+ 209| MarkId | integer | Used to mark files during Verify Jobs | 210+-------------+-----------+---------------------------------------+ 211| LStat | tinyblob | File attributes in base64 encoding | 212+-------------+-----------+---------------------------------------+ 213| MD5 | tinyblob | MD5/SHA1 signature in base64 encoding | 214+-------------+-----------+---------------------------------------+ 215 216The **File** table shown above contains one entry for each file backed 217up by Bareos. Thus a file that is backed up multiple times (as is 218normal) will have multiple entries in the File table. This will probably 219be the table with the most number of records. Consequently, it is 220essential to keep the size of this record to an absolute minimum. At the 221same time, this table must contain all the information (or pointers to 222the information) about the file and where it is backed up. Since a file 223may be backed up many times without having changed, the path and 224filename are stored in separate tables. 225 226This table contains by far the largest amount of information in the 227Catalog database, both from the stand point of number of records, and 228the stand point of total database size. As a consequence, the user must 229take care to periodically reduce the number of File records using the 230**retention** command in the Console program. 231 232As MD5 hash (also termed message digests) consists of 128-bit (16-byte). 233A typical format (eg. ``md5sum``, …) to represent them is as a sequence 234of 32 hexadecimal digits. However, in the **MD5** column, the digest is 235represented as base64. 236 237To compare a Bareos digest with command line tools, you have to use 238 239:: 240 241 openssl dgst -md5 -binary $PATH_OF_YOUR_FILE | base64 242 243Also you have to note, that even the table column is named **MD5**, it 244used to store any kind of digest (MD5, SHA1, …). This is not directly 245indicated by the value, however, you can determine the type depending of 246the length of the digest. 247 248Job / JobHisto 249~~~~~~~~~~~~~~ 250 251+----------+----------------+------------------------------------------+ 252| Column | Data Type | Remark | 253| Name | | | 254+==========+================+==========================================+ 255| JobId | integer | Primary Key | 256+----------+----------------+------------------------------------------+ 257| Job | tinyblob | Unique Job Name | 258+----------+----------------+------------------------------------------+ 259| Name | tinyblob | Job Name | 260+----------+----------------+------------------------------------------+ 261| Type | binary(1) | Job Type: Backup, Copy, Clone, Archive, | 262| | | Migration | 263+----------+----------------+------------------------------------------+ 264| Level | binary(1) | Job Level | 265+----------+----------------+------------------------------------------+ 266| ClientId | integer | Client index | 267+----------+----------------+------------------------------------------+ 268| JobStatu | binary(1) | Job Termination Status | 269| s | | | 270+----------+----------------+------------------------------------------+ 271| SchedTim | datetime | Time/date when Job scheduled | 272| e | | | 273+----------+----------------+------------------------------------------+ 274| StartTim | datetime | Time/date when Job started | 275| e | | | 276+----------+----------------+------------------------------------------+ 277| EndTime | datetime | Time/date when Job ended | 278+----------+----------------+------------------------------------------+ 279| ReadEndT | datetime | Time/date when original Job ended | 280| ime | | | 281+----------+----------------+------------------------------------------+ 282| JobTDate | bigint | Start day in Unix format but 64 bits; | 283| | | used for Retention period. | 284+----------+----------------+------------------------------------------+ 285| VolSessi | integer | Unique Volume Session ID | 286| onId | | | 287+----------+----------------+------------------------------------------+ 288| VolSessi | integer | Unique Volume Session Time | 289| onTime | | | 290+----------+----------------+------------------------------------------+ 291| JobFiles | integer | Number of files saved in Job | 292+----------+----------------+------------------------------------------+ 293| JobBytes | bigint | Number of bytes saved in Job | 294+----------+----------------+------------------------------------------+ 295| JobError | integer | Number of errors during Job | 296| s | | | 297+----------+----------------+------------------------------------------+ 298| JobMissi | integer | Number of files not saved (not yet used) | 299| ngFiles | | | 300+----------+----------------+------------------------------------------+ 301| PoolId | integer | Link to Pool Record | 302+----------+----------------+------------------------------------------+ 303| FileSetI | integer | Link to FileSet Record | 304| d | | | 305+----------+----------------+------------------------------------------+ 306| PrioJobI | integer | Link to prior Job Record when migrated | 307| d | | | 308+----------+----------------+------------------------------------------+ 309| PurgedFi | tiny integer | Set when all File records purged | 310| les | | | 311+----------+----------------+------------------------------------------+ 312| HasBase | tiny integer | Set when Base Job run | 313+----------+----------------+------------------------------------------+ 314 315The **Job** table contains one record for each Job run by Bareos. Thus 316normally, there will be one per day per machine added to the database. 317Note, the JobId is used to index Job records in the database, and it 318often is shown to the user in the Console program. However, care must be 319taken with its use as it is not unique from database to database. For 320example, the user may have a database for Client data saved on machine 321Rufus and another database for Client data saved on machine Roxie. In 322this case, the two database will each have JobIds that match those in 323another database. For a unique reference to a Job, see Job below. 324 325The Name field of the Job record corresponds to the Name resource record 326given in the Director’s configuration file. Thus it is a generic name, 327and it will be normal to find many Jobs (or even all Jobs) with the same 328Name. 329 330The Job field contains a combination of the Name and the schedule time 331of the Job by the Director. Thus for a given Director, even with 332multiple Catalog databases, the Job will contain a unique name that 333represents the Job. 334 335For a given Storage daemon, the VolSessionId and VolSessionTime form a 336unique identification of the Job. This will be the case even if multiple 337Directors are using the same Storage daemon. 338 339The JobStatus field specifies how the job terminated. 340 341The JobHisto table is the same as the Job table, but it keeps long term 342statistics (i.e. it is not pruned with the Job). 343 344FileSet 345~~~~~~~ 346 347+-------------+-----------+-------------------------------+ 348| Column Name | Data Type | Remark | 349+=============+===========+===============================+ 350| FileSetId | integer | Primary Key | 351+-------------+-----------+-------------------------------+ 352| FileSet | tinyblob | FileSet name | 353+-------------+-----------+-------------------------------+ 354| MD5 | tinyblob | MD5 checksum of FileSet | 355+-------------+-----------+-------------------------------+ 356| CreateTime | datetime | Time and date Fileset created | 357+-------------+-----------+-------------------------------+ 358 359The **FileSet** table contains one entry for each FileSet that is used. 360The MD5 signature is kept to ensure that if the user changes anything 361inside the FileSet, it will be detected and the new FileSet will be 362used. This is particularly important when doing an incremental update. 363If the user deletes a file or adds a file, we need to ensure that a Full 364backup is done prior to the next incremental. 365 366JobMedia 367~~~~~~~~ 368 369+--------+--------+---------------------------------------------------+ 370| Column | Data | Remark | 371| Name | Type | | 372+========+========+===================================================+ 373| JobMed | intege | Primary Key | 374| iaId | r | | 375+--------+--------+---------------------------------------------------+ 376| JobId | intege | Link to Job Record | 377| | r | | 378+--------+--------+---------------------------------------------------+ 379| MediaI | intege | Link to Media Record | 380| d | r | | 381+--------+--------+---------------------------------------------------+ 382| FirstI | intege | The index (sequence number) of the first file | 383| ndex | r | written for this Job to the Media | 384+--------+--------+---------------------------------------------------+ 385| LastIn | intege | The index of the last file written for this Job | 386| dex | r | to the Media | 387+--------+--------+---------------------------------------------------+ 388| StartF | intege | Tape: the physical media file mark number of the | 389| ile | r | first block written for this Job. | 390+--------+--------+---------------------------------------------------+ 391| | | Other: upper 32-bit of the position of the first | 392| | | block written for this Job. | 393+--------+--------+---------------------------------------------------+ 394| EndFil | intege | Tape: the physical media file mark number of the | 395| e | r | last block written for this Job. | 396+--------+--------+---------------------------------------------------+ 397| | | Other: upper 32-bit of the position of the last | 398| | | block written for this Job. | 399+--------+--------+---------------------------------------------------+ 400| StartB | intege | Tape: the number of the first block written for | 401| lock | r | this Job | 402+--------+--------+---------------------------------------------------+ 403| | | Other: lower 32-bit of the position of the first | 404| | | block written for this Job. | 405+--------+--------+---------------------------------------------------+ 406| Endblo | intege | Tape: the number of the last block written for | 407| ck | r | this Job | 408+--------+--------+---------------------------------------------------+ 409| | | Other: lower 32-bit of the position of the last | 410| | | block written for this Job. | 411+--------+--------+---------------------------------------------------+ 412| VolInd | intege | The Volume use sequence number within the Job | 413| ex | r | | 414+--------+--------+---------------------------------------------------+ 415 416The **JobMedia** table contains one entry at the following: start of the 417job, start of each new tape file mark, start of each new tape, end of 418the job. You will have 2 or more JobMedia records per Job. 419 420Tape Volume 421^^^^^^^^^^^ 422 423The number ob records depends on the “Maximum File Size” specified in 424the Device resource. This record allows Bareos to efficiently position 425close to any given file in a backup. For restoring a full Job, these 426records are not very important, but if you want to retrieve a single 427file that was written near the end of a 100GB backup, the JobMedia 428records can speed it up by orders of magnitude by permitting forward 429spacing files and blocks rather than reading the whole 100GB backup. 430 431Other Volume 432^^^^^^^^^^^^ 433 434StartFile and StartBlock are both 32-bit integer values. However, as the 435position on a disk volume is specified in bytes, we need this to be a 43664-bit value. 437 438Therefore, the start position is calculated as: 439 440:: 441 442 StartPosition = StartFile * 4294967296 + StartBlock 443 444The end position of a job on a volume can be determined by: 445 446:: 447 448 EndPosition = EndFile * 4294967296 + EndBlock 449 450Be aware, that you can not assume, that the job size on a volume is 451``EndPosition - StartPosition``. When interleaving is used other jobs 452can also be stored between Start- and EndPosition. 453 454:: 455 456 EndPosition - StartPosition >= JobSizeOnThisMedia 457 458Volume (Media) 459~~~~~~~~~~~~~~ 460 461+-----------------+----------+-----------------------------------------+ 462| Column Name | Data | Remark | 463| | Type | | 464+=================+==========+=========================================+ 465| MediaId | integer | Primary Key | 466+-----------------+----------+-----------------------------------------+ 467| VolumeName | tinyblob | Volume name | 468+-----------------+----------+-----------------------------------------+ 469| Slot | integer | Autochanger Slot number or zero | 470+-----------------+----------+-----------------------------------------+ 471| PoolId | integer | Link to Pool Record | 472+-----------------+----------+-----------------------------------------+ 473| MediaType | tinyblob | The MediaType supplied by the user | 474+-----------------+----------+-----------------------------------------+ 475| MediaTypeId | integer | The MediaTypeId | 476+-----------------+----------+-----------------------------------------+ 477| LabelType | tinyint | The type of label on the Volume | 478+-----------------+----------+-----------------------------------------+ 479| FirstWritten | datetime | Time/date when first written | 480+-----------------+----------+-----------------------------------------+ 481| LastWritten | datetime | Time/date when last written | 482+-----------------+----------+-----------------------------------------+ 483| LabelDate | datetime | Time/date when tape labeled | 484+-----------------+----------+-----------------------------------------+ 485| VolJobs | integer | Number of jobs written to this media | 486+-----------------+----------+-----------------------------------------+ 487| VolFiles | integer | Number of files written to this media | 488+-----------------+----------+-----------------------------------------+ 489| VolBlocks | integer | Number of blocks written to this media | 490+-----------------+----------+-----------------------------------------+ 491| VolMounts | integer | Number of time media mounted | 492+-----------------+----------+-----------------------------------------+ 493| VolBytes | bigint | Number of bytes saved in Job | 494+-----------------+----------+-----------------------------------------+ 495| VolParts | integer | The number of parts for a Volume (DVD) | 496+-----------------+----------+-----------------------------------------+ 497| VolErrors | integer | Number of errors during Job | 498+-----------------+----------+-----------------------------------------+ 499| VolWrites | integer | Number of writes to media | 500+-----------------+----------+-----------------------------------------+ 501| MaxVolBytes | bigint | Maximum bytes to put on this media | 502+-----------------+----------+-----------------------------------------+ 503| VolCapacityByte | bigint | Capacity estimate for this volume | 504| s | | | 505+-----------------+----------+-----------------------------------------+ 506| VolStatus | enum | Status of media: Full, Archive, Append, | 507| | | Recycle, Read-Only, Disabled, Error, | 508| | | Busy | 509+-----------------+----------+-----------------------------------------+ 510| Enabled | tinyint | Whether or not Volume can be written | 511+-----------------+----------+-----------------------------------------+ 512| Recycle | tinyint | Whether or not Bareos can recycle the | 513| | | Volumes: Yes, No | 514+-----------------+----------+-----------------------------------------+ 515| ActionOnPurge | tinyint | What happens to a Volume after purging | 516+-----------------+----------+-----------------------------------------+ 517| VolRetention | bigint | 64 bit seconds until expiration | 518+-----------------+----------+-----------------------------------------+ 519| VolUseDureation | bigint | 64 bit seconds volume can be used | 520+-----------------+----------+-----------------------------------------+ 521| MaxVolJobs | integer | maximum jobs to put on Volume | 522+-----------------+----------+-----------------------------------------+ 523| MaxVolFiles | integer | maximume EOF marks to put on Volume | 524+-----------------+----------+-----------------------------------------+ 525| InChanger | tinyint | Whether or not Volume in autochanger | 526+-----------------+----------+-----------------------------------------+ 527| StorageId | integer | Storage record ID | 528+-----------------+----------+-----------------------------------------+ 529| DeviceId | integer | Device record ID | 530+-----------------+----------+-----------------------------------------+ 531| MediaAddressing | integer | Method of addressing media | 532+-----------------+----------+-----------------------------------------+ 533| VolReadTime | bigint | Time Reading Volume | 534+-----------------+----------+-----------------------------------------+ 535| VolWriteTime | bigint | Time Writing Volume | 536+-----------------+----------+-----------------------------------------+ 537| EndFile | integer | End File number of Volume | 538+-----------------+----------+-----------------------------------------+ 539| EndBlock | integer | End block number of Volume | 540+-----------------+----------+-----------------------------------------+ 541| LocationId | integer | Location record ID | 542+-----------------+----------+-----------------------------------------+ 543| RecycleCount | integer | Number of times recycled | 544+-----------------+----------+-----------------------------------------+ 545| InitialWrite | datetime | When Volume first written | 546+-----------------+----------+-----------------------------------------+ 547| ScratchPoolId | integer | Id of Scratch Pool | 548+-----------------+----------+-----------------------------------------+ 549| RecyclePoolId | integer | Pool ID where to recycle Volume | 550+-----------------+----------+-----------------------------------------+ 551| Comment | blob | User text field | 552+-----------------+----------+-----------------------------------------+ 553 554The **Volume** table (internally referred to as the Media table) 555contains one entry for each volume, that is each tape, cassette (8mm, 556DLT, DAT, …), or file on which information is or was backed up. There is 557one Volume record created for each of the NumVols specified in the Pool 558resource record. 559 560Pool 561~~~~ 562 563+-----------------------+-----------------------+-----------------------+ 564| Column Name | Data Type | Remark | 565+=======================+=======================+=======================+ 566| PoolId | integer | Primary Key | 567+-----------------------+-----------------------+-----------------------+ 568| Name | Tinyblob | Pool Name | 569+-----------------------+-----------------------+-----------------------+ 570| NumVols | Integer | Number of Volumes in | 571| | | the Pool | 572+-----------------------+-----------------------+-----------------------+ 573| MaxVols | Integer | Maximum Volumes in | 574| | | the Pool | 575+-----------------------+-----------------------+-----------------------+ 576| UseOnce | tinyint | Use volume once | 577+-----------------------+-----------------------+-----------------------+ 578| UseCatalog | tinyint | Set to use catalog | 579+-----------------------+-----------------------+-----------------------+ 580| AcceptAnyVolume | tinyint | Accept any volume | 581| | | from Pool | 582+-----------------------+-----------------------+-----------------------+ 583| VolRetention | bigint | 64 bit seconds to | 584| | | retain volume | 585+-----------------------+-----------------------+-----------------------+ 586| VolUseDuration | bigint | 64 bit seconds volume | 587| | | can be used | 588+-----------------------+-----------------------+-----------------------+ 589| MaxVolJobs | integer | max jobs on volume | 590+-----------------------+-----------------------+-----------------------+ 591| MaxVolFiles | integer | max EOF marks to put | 592| | | on Volume | 593+-----------------------+-----------------------+-----------------------+ 594| MaxVolBytes | bigint | max bytes to write on | 595| | | Volume | 596+-----------------------+-----------------------+-----------------------+ 597| AutoPrune | tinyint | yes or no for | 598| | | autopruning | 599+-----------------------+-----------------------+-----------------------+ 600| Recycle | tinyint | yes or no for | 601| | | allowing auto | 602| | | recycling of Volume | 603+-----------------------+-----------------------+-----------------------+ 604| ActionOnPurge | tinyint | Default Volume | 605| | | ActionOnPurge | 606+-----------------------+-----------------------+-----------------------+ 607| PoolType | enum | Backup, Copy, Cloned, | 608| | | Archive, Migration | 609+-----------------------+-----------------------+-----------------------+ 610| LabelType | tinyint | Type of label | 611| | | ANSI/Bareos | 612+-----------------------+-----------------------+-----------------------+ 613| LabelFormat | Tinyblob | Label format | 614+-----------------------+-----------------------+-----------------------+ 615| Enabled | tinyint | Whether or not Volume | 616| | | can be written | 617+-----------------------+-----------------------+-----------------------+ 618| ScratchPoolId | integer | Id of Scratch Pool | 619+-----------------------+-----------------------+-----------------------+ 620| RecyclePoolId | integer | Pool ID where to | 621| | | recycle Volume | 622+-----------------------+-----------------------+-----------------------+ 623| NextPoolId | integer | Pool ID of next Pool | 624+-----------------------+-----------------------+-----------------------+ 625| MigrationHighBytes | bigint | High water mark for | 626| | | migration | 627+-----------------------+-----------------------+-----------------------+ 628| MigrationLowBytes | bigint | Low water mark for | 629| | | migration | 630+-----------------------+-----------------------+-----------------------+ 631| MigrationTime | bigint | Time before migration | 632+-----------------------+-----------------------+-----------------------+ 633 634The **Pool** table contains one entry for each media pool controlled by 635Bareos in this database. One media record exists for each of the NumVols 636contained in the Pool. The PoolType is a Bareos defined keyword. The 637MediaType is defined by the administrator, and corresponds to the 638MediaType specified in the Director’s Storage definition record. The 639CurrentVol is the sequence number of the Media record for the current 640volume. 641 642Client 643~~~~~~ 644 645+---------------+-----------+-------------------------------------+ 646| Column Name | Data Type | Remark | 647+===============+===========+=====================================+ 648| ClientId | integer | Primary Key | 649+---------------+-----------+-------------------------------------+ 650| Name | TinyBlob | File Services Name | 651+---------------+-----------+-------------------------------------+ 652| UName | TinyBlob | uname -a from Client (not yet used) | 653+---------------+-----------+-------------------------------------+ 654| AutoPrune | tinyint | yes or no for autopruning | 655+---------------+-----------+-------------------------------------+ 656| FileRetention | bigint | 64 bit seconds to retain Files | 657+---------------+-----------+-------------------------------------+ 658| JobRentention | bigint | 64 bit seconds to retain Job | 659+---------------+-----------+-------------------------------------+ 660 661The **Client** table contains one entry for each machine backed up by 662Bareos in this database. Normally the Name is a fully qualified domain 663name. 664 665Storage 666~~~~~~~ 667 668+-------------+-----------+---------------------------------+ 669| Column Name | Data Type | Remark | 670+=============+===========+=================================+ 671| StorageId | integer | Unique Id | 672+-------------+-----------+---------------------------------+ 673| Name | tinyblob | Resource name of Storage device | 674+-------------+-----------+---------------------------------+ 675| AutoChanger | tinyint | Set if it is an autochanger | 676+-------------+-----------+---------------------------------+ 677 678The **Storage** table contains one entry for each Storage used. 679 680Counter 681~~~~~~~ 682 683+--------------+-----------+-----------------------------+ 684| Column Name | Data Type | Remark | 685+==============+===========+=============================+ 686| Counter | tinyblob | Counter name | 687+--------------+-----------+-----------------------------+ 688| MinValue | integer | Start/Min value for counter | 689+--------------+-----------+-----------------------------+ 690| MaxValue | integer | Max value for counter | 691+--------------+-----------+-----------------------------+ 692| CurrentValue | integer | Current counter value | 693+--------------+-----------+-----------------------------+ 694| WrapCounter | tinyblob | Name of another counter | 695+--------------+-----------+-----------------------------+ 696 697The **Counter** table contains one entry for each permanent counter 698defined by the user. 699 700Log 701~~~ 702 703+-------------+-----------+------------------------------+ 704| Column Name | Data Type | Remark | 705+=============+===========+==============================+ 706| LogIdId | integer | Primary Key | 707+-------------+-----------+------------------------------+ 708| JobId | integer | Points to Job record | 709+-------------+-----------+------------------------------+ 710| Time | datetime | Time/date log record created | 711+-------------+-----------+------------------------------+ 712| LogText | blob | Log text | 713+-------------+-----------+------------------------------+ 714 715The **Log** table contains a log of all Job output. 716 717Location 718~~~~~~~~ 719 720+-------------+-----------+-----------------------------------+ 721| Column Name | Data Type | Remark | 722+=============+===========+===================================+ 723| LocationId | integer | Primary Key | 724+-------------+-----------+-----------------------------------+ 725| Location | tinyblob | Text defining location | 726+-------------+-----------+-----------------------------------+ 727| Cost | integer | Relative cost of obtaining Volume | 728+-------------+-----------+-----------------------------------+ 729| Enabled | tinyint | Whether or not Volume is enabled | 730+-------------+-----------+-----------------------------------+ 731 732The **Location** table defines where a Volume is physically. 733 734LocationLog 735~~~~~~~~~~~ 736 737+-----------+----------+-----------------------------------------------+ 738| Column | Data | Remark | 739| Name | Type | | 740+===========+==========+===============================================+ 741| LocLogId | integer | Primary Key | 742+-----------+----------+-----------------------------------------------+ 743| Date | datetime | Time/date log record created | 744+-----------+----------+-----------------------------------------------+ 745| MediaId | integer | Points to Media record | 746+-----------+----------+-----------------------------------------------+ 747| LocationI | integer | Points to Location record | 748| d | | | 749+-----------+----------+-----------------------------------------------+ 750| NewVolSta | integer | enum: Full, Archive, Append, Recycle, Purged | 751| tus | | Read-only, Disabled, Error, Busy, Used, | 752| | | Cleaning | 753+-----------+----------+-----------------------------------------------+ 754| Enabled | tinyint | Whether or not Volume is enabled | 755+-----------+----------+-----------------------------------------------+ 756 757The **LocationLog** table contains a log of all Job output. 758 759Version 760~~~~~~~ 761 762+-------------+-----------+-------------+ 763| Column Name | Data Type | Remark | 764+=============+===========+=============+ 765| VersionId | integer | Primary Key | 766+-------------+-----------+-------------+ 767 768The **Version** table defines the Bareos database version number. Bareos 769checks this number before reading the database to ensure that it is 770compatible with the Bareos binary file. 771 772BaseFiles 773~~~~~~~~~ 774 775+-------------+-----------+-------------------+ 776| Column Name | Data Type | Remark | 777+=============+===========+===================+ 778| BaseId | integer | Primary Key | 779+-------------+-----------+-------------------+ 780| BaseJobId | integer | JobId of Base Job | 781+-------------+-----------+-------------------+ 782| JobId | integer | Reference to Job | 783+-------------+-----------+-------------------+ 784| FileId | integer | Reference to File | 785+-------------+-----------+-------------------+ 786| FileIndex | integer | File Index number | 787+-------------+-----------+-------------------+ 788 789The **BaseFiles** table contains all the File references for a 790particular JobId that point to a Base file – i.e. they were previously 791saved and hence were not saved in the current JobId but in BaseJobId 792under FileId. FileIndex is the index of the file, and is used for 793optimization of Restore jobs to prevent the need to read the FileId 794record when creating the in memory tree. This record is not yet 795implemented. 796