You are on page 1of 30

Philipp Storz

Bacula
Network Backup Strategies and Solutions
1. Edition

Open Source Press

The information in this book is distributed on an As Is basis, without warranty. While every
precaution has been taken in the preparation of this work, neither the author nor Open Source
Press GmbH shall have any liability to any person or entity with respect to any loss or damage
caused or alleged to be caused directly or indirectly by the information contained in it.
All rights reserved. No part of this work may be reproduced or transmitted in any form or by
any means, electronic or mechanical, including photocopying, recording, or by any information
storage or retrieval system, without the prior written permission of the copyright owner and
the publisher.
Bibliographic information published by the Deutsche Nationalbibliothek
The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie; detailed bibliographic data are available in the Internet at http://dnb.dnb.de.

Original edition (C) Open Source Press GmbH (Munich, Germany)


Bacula - Backup-Strategien und -Lsungen im Netzwerk
by Philipp Storz
ISBN 978-3-941841-41-3
Copyright 2013 Open Source Press, Munich
Editor: Dr. Markus Wirtz
Translator: Katherine Salter
Typesetting: Open Source Press & Thomas Schraitle (AsciiDoc/DocBook/XSL-FO/XEP)
Graphic Designer: Olga Saborov, Open Source Press
ISBN: 978-3-95539-002-0 (E-Book PDF)

http://www.opensourcepress.de

Table of Contents
Foreword by Kern Sibbald

19

Foreword by the Author

23

1 Introduction

27

1.1

Baculas architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.1.1

The file daemon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

1.1.2

The storage daemon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

1.1.3

The director daemon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

1.1.4

The catalog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

1.1.5

The Bacula console. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

1.2

Interplay between components. . . . . . . . . . . . . . . . . . . . . . . . . . . 30

1.3

Properties of Bacula. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

1.4

Bacula development. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

Storz Bacula

Table of Contents

1.5

About this book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35


1.5.1

Chapter overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

1.5.2

Contents of the DVD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

1.5.3

Language and terminology. . . . . . . . . . . . . . . . . . . . . . . . 39

2 Installation
2.1

2.2

Importing the appliance from the DVD. . . . . . . . . . . . . . . . . . . . . 44


2.1.1

Installing the virtualization software. . . . . . . . . . . . . . . . 46

2.1.2

Importing and starting the virtual machine. . . . . . . . . . . 49

Selecting and installing a database. . . . . . . . . . . . . . . . . . . . . . . . 55


2.2.1

2.3

2.4

2.5

41

Package-based installation of database systems. . . . . . . . 56

Package-based installation of Bacula. . . . . . . . . . . . . . . . . . . . . . 57


2.3.1

Updates and version compatibility. . . . . . . . . . . . . . . . . . 58

2.3.2

Packages from the dassIT Bacula repository. . . . . . . . . . . 59

2.3.3

Packages from the website of the Bacula project. . . . . . . 62

2.3.4

Packages for the distribution in use. . . . . . . . . . . . . . . . . 63

Compiling and installing Bacula from the source code. . . . . . . . . 63


2.4.1

Building the source RPM on your own distribution. . . . . 64

2.4.2

Privileges for Bacula daemons. . . . . . . . . . . . . . . . . . . . . . 67

2.4.3

Compiling the source code manually. . . . . . . . . . . . . . . . 68

Setting up the database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72


2.5.1

General information on setting up databases. . . . . . . . . . 73

www.opensourcepress.de

Table of Contents

2.6

Installing graphic programs for Bacula. . . . . . . . . . . . . . . . . . . . . 76


2.6.1

Bat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

2.6.2

Web-based interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

3 First steps

79

3.1

The Bacula appliance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

3.2

Is Bacula working?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

3.3

3.4

3.2.1

Testing the services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

3.2.2

Testing with Bacula tools. . . . . . . . . . . . . . . . . . . . . . . . . . 84

First steps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
3.3.1

The first backup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

3.3.2

The first restore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

Configuration for productive backups to hard drives. . . . . . . . . 102


3.4.1

Changing the storage location for Bacula volumes. . . . . 103

3.4.2

Changing the files to be backed up. . . . . . . . . . . . . . . . . 104

3.4.3

Integrating the appliance into the network. . . . . . . . . . . 113

3.4.4

Configuring the network. . . . . . . . . . . . . . . . . . . . . . . . . 114

3.4.5

Adjusting addresses in Bacula. . . . . . . . . . . . . . . . . . . . . 114

4 Backup techniques and concepts


4.1

117

Backup types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118


4.1.1

Storz Bacula

Full backup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

Table of Contents

4.2

4.1.2

Differential backup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

4.1.3

Incremental backup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Backup intervals and retention time. . . . . . . . . . . . . . . . . . . . . . 122

5 Configuring Bacula

127

5.1

Baculas own backup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

5.2

General information on Bacula configuration files. . . . . . . . . . . 129

5.3

Bacula resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

5.4

5.3.1

director daemon configuration bacula-dir.conf. . . . . . 133

5.3.2

Storage daemon configuration bacula-sd.conf. . . . . . 148

5.3.3

File daemon configuration bacula-fd.conf. . . . . . . . . 149

5.3.4

File daemon/client configuration bacula-fd.conf. . . . 151

5.3.5

Bacula console configuration bconsole.conf. . . . . . . . 152

Adding a new client. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153


5.4.1

Installing the client software. . . . . . . . . . . . . . . . . . . . . . 154

5.4.2

Installing the file daemon. . . . . . . . . . . . . . . . . . . . . . . . 154

5.4.3

Configuring the file daemon. . . . . . . . . . . . . . . . . . . . . . 155

5.4.4

File daemon in the director configuration. . . . . . . . . . . . 158

5.4.5

Checking the connection between director and file


daemon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

5.4.6

Interaction between passwords and names. . . . . . . . . . 160

5.4.7

Configuring a FileSet for a new client. . . . . . . . . . . . . . . 161

www.opensourcepress.de

Table of Contents

5.5

5.6

5.4.8

Configuring a job for a new client. . . . . . . . . . . . . . . . . . 163

5.4.9

Checking the client connection. . . . . . . . . . . . . . . . . . . . 164

Implementing a multiple pool backup strategy. . . . . . . . . . . . . . 165


5.5.1

Backup type and interval. . . . . . . . . . . . . . . . . . . . . . . . . 166

5.5.2

Storage time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

5.5.3

Simulation of our backup concept. . . . . . . . . . . . . . . . . 170

Catalog database maintenance and media management. . . . . . 172


5.6.1

Storage times and automatic media management. . . . . 172

5.6.2

How does Bacula identify the next medium to write


to?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

5.6.3

Life cycle of a Bacula volume. . . . . . . . . . . . . . . . . . . . . 181

6 Backup hardware

183

6.1

Backing up to hard drives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

6.2

Integrating a tape library in Bacula. . . . . . . . . . . . . . . . . . . . . . . 186

6.3

6.2.1

Tape drives and medium changers the basics. . . . . . . 186

6.2.2

Tape drives and medium changers in practice. . . . . . . . . 190

6.2.3

Tape drives and media changers with Bacula. . . . . . . . . 198

6.2.4

Testing with btape. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

6.2.5

Data spooling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

6.2.6

Using an autochanger with Bacula. . . . . . . . . . . . . . . . . 212

Using a single tape drive with Bacula. . . . . . . . . . . . . . . . . . . . . 215

Storz Bacula

Table of Contents

6.4

Backup concept for single drives. . . . . . . . . . . . . . . . . . . . . . . . . 217

7 Operating Bacula
7.1

7.2

Commands with arguments. . . . . . . . . . . . . . . . . . . . . . . . . . . . 224


7.1.1

Submitting arguments interactively. . . . . . . . . . . . . . . . 225

7.1.2

Automatically filling arguments. . . . . . . . . . . . . . . . . . . 226

7.1.3

Entering arguments directly. . . . . . . . . . . . . . . . . . . . . . 226

7.1.4

Tab completion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

7.1.5

Automatic completion of incomplete input. . . . . . . . . . 227

Bacula console commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228


7.2.1

Status information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

7.2.2

Job management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

7.2.3

Media management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

7.2.4

Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262

7.2.5

Other. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266

8 Advanced applications
8.1

223

271

FileSet in detail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271


8.1.1

Specifying files and directories. . . . . . . . . . . . . . . . . . . . 272

8.1.2

Determining the files to be backed up: Include and


Exclude. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

8.1.3

FileSet options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274

8.1.4

Dynamic generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 286

www.opensourcepress.de

10

Table of Contents

8.2

8.3

8.4

8.1.5

Detecting modified FileSets. . . . . . . . . . . . . . . . . . . . . . . 290

8.1.6

How does Bacula process the Include/Exclude


directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290

8.1.7

Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

8.1.8

Backing up all local file systems. . . . . . . . . . . . . . . . . . . 293

8.1.9

Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

Run directive in detail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302


8.2.1

Time data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

8.2.2

Job Overrides. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305

Commands before, during and after backup. . . . . . . . . . . . . . . . 308


8.3.1

RunScript resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

8.3.2

RunScripts under Windows. . . . . . . . . . . . . . . . . . . . . . . 313

The Messages resource in detail. . . . . . . . . . . . . . . . . . . . . . . . . 316


8.4.1

Directives for sending messages by email. . . . . . . . . . . . 317

8.4.2

Definition of message targets. . . . . . . . . . . . . . . . . . . . . 318

8.4.3

An overview of message targets. . . . . . . . . . . . . . . . . . . 321

9 Advanced configuration
9.1

325

Scaling Bacula. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325


9.1.1

Executing multiple jobs simultaneously. . . . . . . . . . . . . 325

9.1.2

Writing multiple jobs onto one medium. . . . . . . . . . . . . 329

9.1.3

Multiple tape drives in an autochanger. . . . . . . . . . . . . . 331

Storz Bacula

11

Table of Contents

9.2

9.3

backup-2-disk-2-tape/migration/copy jobs. . . . . . . . . . . . . . . . 339


9.2.1

Why perform migrations?. . . . . . . . . . . . . . . . . . . . . . . . 340

9.2.2

Restrictions on migration and copy jobs. . . . . . . . . . . . . 341

9.2.3

Configuring migration and copy jobs. . . . . . . . . . . . . . . 341

9.2.4

Migrations in practice. . . . . . . . . . . . . . . . . . . . . . . . . . . 344

9.2.5

Copy jobs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

9.2.6

Copy jobs in practice. . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

Advanced job management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354


9.3.1

Handling duplicate jobs. . . . . . . . . . . . . . . . . . . . . . . . . . 354

9.3.2

Restricting the runtime of jobs. . . . . . . . . . . . . . . . . . . . 356

9.4

Backup strategy for laptops. . . . . . . . . . . . . . . . . . . . . . . . . . . . 357

9.5

Accurate backup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360

9.6

9.5.1

Why accurate backup?. . . . . . . . . . . . . . . . . . . . . . . . . . . 360

9.5.2

Example of problems without accurate backup. . . . . . . 362

9.5.3

How does accurate backup work?. . . . . . . . . . . . . . . . . . 365

9.5.4

Configuration of accurate backup. . . . . . . . . . . . . . . . . . 365

Encrypting data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368


9.6.1

Creating the necessary keys. . . . . . . . . . . . . . . . . . . . . . 370

9.6.2

Configuration in the file daemon. . . . . . . . . . . . . . . . . . 371

9.6.3

Restoring with the master key. . . . . . . . . . . . . . . . . . . . . 373

www.opensourcepress.de

12

Table of Contents

9.6.4

TLS authentication, transport and communication


encryption. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374

9.7

Permissions for user interfaces with ACLs. . . . . . . . . . . . . . . . . . 387

9.8

Virtual full backup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395


9.8.1

9.9

Virtual full backup in practice. . . . . . . . . . . . . . . . . . . . . 397

De-duplication base jobs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407


9.9.1

Basic considerations on base jobs. . . . . . . . . . . . . . . . . . 407

9.9.2

Practical example of a backup with base jobs. . . . . . . . . 409

9.9.3

Scheduling base jobs. . . . . . . . . . . . . . . . . . . . . . . . . . . . 412

9.9.4

How base jobs work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413

9.9.5

Fine-tuning base jobs. . . . . . . . . . . . . . . . . . . . . . . . . . . 414

9.10 Verify jobs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415


9.10.1 Intrusion detection with Bacula. . . . . . . . . . . . . . . . . . . 415
9.11 Backups through firewalls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
9.11.1 Ports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
9.11.2 NAT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
9.11.3 Timeouts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
9.12 Read-only file daemon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
9.13 Command line tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
9.13.1 bwild. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
9.13.2 bregex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425

Storz Bacula

13

Table of Contents

9.13.3 bcopy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426


9.13.4 bsmtp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
10 Internal processes

427

10.1 Network communication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427


10.1.1 Port numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
10.1.2 The communication process. . . . . . . . . . . . . . . . . . . . . . 428
10.1.3 Allocation of target addresses. . . . . . . . . . . . . . . . . . . . . 430
10.1.4 Which communications take place, and when?. . . . . . . 432
10.2 Database schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
11 Extended applications

445

11.1 User interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445


11.1.1 Bacula Tray Monitor. . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
11.1.2 Bat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
11.1.3 mhvtl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
11.2 Using scripts to automate the Bacula console. . . . . . . . . . . . . . 450
11.3 Backups of virtual machines. . . . . . . . . . . . . . . . . . . . . . . . . . . 452
11.3.1 VMware. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
11.3.2 VMware Consolidated Backup. . . . . . . . . . . . . . . . . . . . . 454
11.3.3 Citrix XenServer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
11.4 Backup of the Novell NSS file system. . . . . . . . . . . . . . . . . . . . 477

www.opensourcepress.de

14

Table of Contents

11.5 Plugins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479


11.5.1 Configuration and activation. . . . . . . . . . . . . . . . . . . . . 479
11.5.2 bpipe. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
11.5.3 Citrix XenServer and bpipe. . . . . . . . . . . . . . . . . . . . . . . 483
12 Emergency restore

487

12.1 Precautionary measures that protect the Bacula system. . . . . . 488


12.2 Ways to approach a restore. . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
12.3 Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
12.3.1 bextract. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
12.3.2 bls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
12.3.3 bscan. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
12.3.4 dbcheck. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
12.4 Performing an emergency restore. . . . . . . . . . . . . . . . . . . . . . . 491
13 Troubleshooting

495

13.1 No privilege. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495


13.2 Cannot label Volume because it is already labeled. . . . . . . . . . . 496
13.3 No route to host. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
13.4 Unable to authenticate with xxx daemon. . . . . . . . . . . . . . . . . 497
13.5 is waiting for Client xxx-fd to connect to Storage yyy. . . . . . . . 498
13.6 gethostbyname() for host xxx failed. . . . . . . . . . . . . . . . . . . . . . 501

Storz Bacula

15

Table of Contents

I Appendix

503

A Client installation

505

A.1 Microsoft Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505


A.1.1 Operational test. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
A.1.2 Windows firewall. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
A.2 Mac OS X. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
A.3 Solaris. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
B Variable replacement in Bacula

521

B.1 Variable replacement for media labels. . . . . . . . . . . . . . . . . . . . . 521


B.2 Variable replacement in RunScripts. . . . . . . . . . . . . . . . . . . . . . . 523
B.3 Variable replacement in the autochanger command. . . . . . . . . . 524
B.4 Mount command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
B.5 Variable replacement in the mail and operator commands. . . . . 525
C Directives and their data types

527

C.1 Director configuration (bacula-dir.conf). . . . . . . . . . . . . . . . . . . 528


C.1.1 Catalog resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
C.1.2 Client resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
C.1.3 Console resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
C.1.4 Counter resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
C.1.5 Director resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
www.opensourcepress.de

16

Table of Contents

C.1.6 FileSet resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535


C.1.7 FileSet include/exclude resource. . . . . . . . . . . . . . . . . . . 535
C.1.8 FileSet options resource. . . . . . . . . . . . . . . . . . . . . . . . . 536
C.1.9 Job resource / JobDefs resource. . . . . . . . . . . . . . . . . . . 538
C.1.10 Pool resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
C.1.11 RunScript resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
C.1.12 Schedule resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
C.1.13 Storage resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
C.1.14 Messages resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
C.2 Console configuration (bconsole.conf). . . . . . . . . . . . . . . . . . . . 548
C.2.1 Console resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
C.2.2 Director resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
C.3 File daemon configuration (bacula-fd.conf). . . . . . . . . . . . . . . . 551
C.3.1 Client/file daemon resource. . . . . . . . . . . . . . . . . . . . . . . 551
C.3.2 Director resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
C.3.3 Messages resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
C.4 Storage daemon configuration (bacula-sd.conf). . . . . . . . . . . . . 555
C.4.1 AutoChanger resource. . . . . . . . . . . . . . . . . . . . . . . . . . . 555
C.4.2 Device resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
C.4.3 Director resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
C.4.4 Storage resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561

Storz Bacula

17

Table of Contents

C.4.5 Messages resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562


C.5 Shared configuration resources. . . . . . . . . . . . . . . . . . . . . . . . . 563
C.5.1 Messages resource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
C.6 Bacula types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
C.6.1 FileSet options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572
C.6.2 Commands in the Bacula console. . . . . . . . . . . . . . . . . . 573
C.7 Modifiers for data types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Index

www.opensourcepress.de

577

18

Foreword by Kern Sibbald


The story of Bacula begins near the end of 1999 after I had been working
on the apcupsd project (UPS control program) for several years. By then,
I was ready to start a new and bigger project, so I started searching for
an idea of what I could do. I asked John Walker (founder of Autodesk),
and he had some suggestions, one of which was to write a replacement
for the NetWorker program he was using to backup his Solaris machines.
Since I had begun my professional programming career by working a
backup program for a mainframe, the idea of a network backup program
was very interesting, especially because a network backup program embodies a number of interesting technologies.
John also gave a number of suggestions for names of the program. The
name Bacula has a nice sound in most languages and has a number of
subtle and interesting meanings, so it quickly became the choice.
The actual design and coding of Bacula in January 2000 began in
Neuchtel, Switzerland and continued from June 2000 until this day in
Lausanne, Swtizerland where I now live.
Since above all a backup program must be robust and free of serious errors,
there was a lot of basic programming to do. Thus, I set out to write a set
Storz Bacula

19

Foreword by Kern Sibbald

of subroutines that would check for orphaned (lost) memory, memory


corruptions, low level networking, buffer pool management, and so on.
This base part took about a year. Then I spent a year writing the three
main daemons (Director, Storage daemon, and File daemon) and the
database code needed to store backup information.
In April 2002 when Bacula was functioning relatively well, I made the
first public release on Source Forge with a GPLv2 license. In those early
years, there were still quite a number of basic features to be added, so
knowing what to work on was obvious. Something I enjoyed a lot about
this period was helping early adopters to fix their problems (and bugs).
Today, a lot of the design of Bacula may seem quite obvious, but in
January 2000, that was not the case. One of the more difficult design decisions was what kind of database to use to store the backup metadata
(filenames, file size, location of the data in the backup volumes,). Most
people recommended to write a specialized database that would be very
fast for Bacula, but after a lot of thought, using an Open Source database
engine became the clear choice.
At that time (mid-2000) the most common database engines were MySQL
and SQLite, with PostgreSQL somewhat later. The major reason for
choosing an Open Source SQL database was to allow users to be able to
access the data directly with SQL. My major concern was that the performance might unduly suffer. However, as Bacula databases have grown in
size, we have always found ways to make the database engines perform
sufficiently well.
Another important design decision was to use threads rather than launch
multiple programs as processes. The advantage of multiple threads rather
than multiple processes is that it is much more efficient, but the downside
is that programmers must have a good appreciation of how threads work
to avoid deadlock situations.

www.opensourcepress.de

20

Foreword by Kern Sibbald

The choice to release Bacula as Open Source software under the GPL
(General Public License) though it wasnt a design decision was also quite
significant because it created a community of dedicated users who have
consistently sent in bug fixes, contributed code for new features, given
us ideas, and above all reported bugs. This has made Bacula into an extremely robust, feature rich program.
Over the years, these design decisions as well as others proved to be correct one as the project grew and the number of features and Bacula complexity increased without running into design problems.
By 2006, it became clear that Bacula was being used by more and more
corporations, yet its use was less than optimal due to the lack of Bacula
professional services that are required by most large corporations. This
naturally lead to the idea of forming a company composed of Bacula experts to provide the needed services. I also saw it as a way of financing
faster development of Bacula as well as providing a means of ensuring
the continuation of Bacula long term.
My first contact with Philipp Storz was in early 2007 when he requested
to list his company, dassIT, on the bacula.org web site as a provider of
professional services for Bacula. Philipp already had several years of experience with Bacula. Later that year when the founding team of Bacula
Systems was meeting, Philipp joined us in Basel, Switzerland to discuss
ways in which Bacula Systems (not yet formed) could work with independent partners such as dassIT. It was our first contact with a Bacula
partner even before Bacula Systems was created.
Getting the company, Bacula Systems, started was a fairly long process
because it was not easy finding the right people to invest both money and
time in a company where the source code was available for free. However,
by the beginning of 2008 the team was complete and Bacula Systems was
officially incorporated in Switzerland on the first of July 2008 by 8

Storz Bacula

21

Foreword by Kern Sibbald

founding members, all of whom invested in the company as well as contributed without pay their time to make the company work. Today the
company has grown significantly with over half the founders employed
by Bacula Systems, and the future of the company looks very promising.
It is very difficult to try to predict what Bacula will evolve into during
the next five or ten years, but what seems certain is that Bacula is here
to stay, and that there are a good number of high-end features that are
needed. For example, a large number of large corporations require specific
modules (plugins) to backup and restore Oracle. This is something that
Bacula Systems is currently working on. Other projects include: optimizing
data transfer across communications lines using deduplication; providing
SAN shared storage features; adding backup of Vmware with vSphere
integration; backing up KVM virtual machines; more graphical user interfaces; As long as computer technology keeps up its rapid pace of development there will always will be a need for additional features and capabilities in Bacula.
Not only was Philipp an early adopter of Bacula and the first Bacula Systems reseller, but he is also the first to write and publish a Bacula book.
It is quite appropriate that someone with Philipps experience would do
this. It gives me great pleasure to know that the book will shortly be in
the hands of people who want to become Bacula users or who are already
Bacula users, and I look forward to seeing it on book store shelves.

www.opensourcepress.de

22

Foreword by the Author


In 2004 I went into business with three of my former colleagues. Our own
IT landscape grew quickly, and we needed a backup solution for our data.
As an open-source company we could only ever choose an open-source
solution, but all those I was familiar with had pretty serious flaws.
There were several makeshift solutions, mostly based on rsync, and there
was Amanda, an option we eliminated for reasons of limitations and experience. Then I discovered Bacula and was immediately won over: the
project had a clear architecture and extensive documentation, and the
expertise of its developers was evident. Both quality and reliability were
unusually high, and, unlike the other projects, it was capable of native
backups of Windows systems. The more I dealt with the project, the more
I knew that it was exactly what we wanted.
I have been in personal contact with Kern Sibbald since May 2007, and
we at dass IT have been organising the Bacula conference since 2009.
Maik Auendorf put us in contact with Markus Wirtz from Open Source
Press: how about writing a book on Bacula? A short time later work began
on the manuscript.

Storz Bacula

23

Foreword by the Author

The information in this book and the book appliance were prepared with
the greatest of care. If you discover any errors or inaccuracies, I would
greatly appreciate feedback on the website for this book. There I intend
to gather updates and corrections that will be added to the next edition
if there is one.
I have to admit that I underestimated how much work this book would
be. It was also a lot of fun, and I hope that it will be useful to you in the
administration of your system.
Have fun with this book!

Acknowledgements
Many people helped me in many different ways to create this book. I
would like to thank them at this point:
Kern Sibbald for Bacula.
Marco van Wieringen from ELM Consultancy B.V and Planets Communications B.V. for the know-how on Solaris and for the Solaris packages.
Bruno Friedmann for the collaboration on creating the rpm packages.
Markus Wirtz from Open Source Press for his support and patience.
openSUSE, in particular for the Build Service for creating packages and
for SuSE Studio, which was a great help in creating the VM.
Jochen Schfer for his help on backups of Novell file systems.
Sebastian Lederer for the Mac OS packages.
Stephan Martin for TinyCA2.

http://www.bacula-book.com/

www.opensourcepress.de

24

Foreword by the Author

Frank Ueberschar for the photograph on the cover of the print edition.
My colleagues at dass IT, and of course
my wife Elena and my daughter Vlada Xenia.

Storz Bacula

25

Chapter

Introduction
The website of the Bacula project defines Bacula as follows:
Bacula is a set of open-source computer programs that
permit you (or the system administrator) to manage the
backup, recovery, and verification of computer data
across a network of computers of different kinds. [] In
technical terms, it is an open-source, network-based
backup program.
Kern Sibbald launched this open-source project in 2000 and has been
leading development ever since. Bacula differs from many other free

http://www.bacula.org

Storz Bacula

27

1 Introduction

projects in that it has excellent documentation and a very high quality of


code.
Bacula offers backup agents (file daemons) for virtually all operating
systems and a wide range of functions extending beyond the simple backup
of files.
The name Bacula is a combination of two words, backup and Dracula.
Like the famous bloodsucker from Transylvania, Bacula comes at night
and sucks vital elements from the computers in a network hence the
bat logo of the project. But the similarities end there, because Baculas
primary purpose is to restore data when necessary, while the worldfamous Count is certainly not known for being a blood donor.

1.1 Baculas architecture


A Bacula system consists of several interacting components that allow
data to be backed up reliably. In line with the traditional Unix principle,
each component performs a specific set of tasks involved in the backup
of data. The components use the network to communicate.

1.1.1 The file daemon


One of the tasks of a backup system is to read the data for backup from
the computer requiring backup. During a restore, these data have to be
returned to the computer that was backed up. The tool responsible is referred to as an agent or client in many backup systems. In Bacula, this
task is performed by the file daemon. This means that the terms client
and file daemon are used synonymously in Bacula terminology. In this
book, we will use the term client when the focus is on the computer to be
www.opensourcepress.de

28

1.1 Baculas architecture

backed up, and file daemon when referring to the Bacula tool. Do not let
this confuse you just remember that file daemon and client are essentially the same.

1.1.2 The storage daemon


The data imported by the file daemon have to be written to the backup
media during the backup and then read out from there during a restore.
In Bacula systems, this task is performed by a storage daemon able to write
to hard disks, single-tape drives and medium changer devices. Medium
changer devices are activated by the storage daemon, which then automatically inserts the required medium into the drive.

1.1.3 The director daemon


The director daemon is the central component and manages all the information throughout the entire system. It instructs the file daemon and the
storage daemon to perform backups, restores or checks. The director
daemon saves all data relating to completed sessions, such as which client
wrote which file to which medium. Furthermore, the director is responsible
for scheduling backups and starts them independently. The director daemon also performs media management and gathers messages.

1.1.4 The catalog


The director daemon uses a database to save the information on completed
backups, saved files and the media used. In Bacula, that database is referred

Storz Bacula

29

1 Introduction

to as the catalog database or simply catalog. The director provides support


for both the PostgreSQL and the MySQL database systems.

1.1.5 The Bacula console


The fifth important component is the Bacula console, which is used to
control and administrate the Bacula system. The Bacula console connects
to the director to provide a convenient command line interface.

1.2 Interplay between components


Figure 1.1 demonstrates how the aforementioned components work together in the Bacula system. Director daemon, storage daemon and file
daemon communicate with each other via the network. The director is
also controlled by the Bacula console via the network. The director can
save administrative information in the catalog database. The file daemons
on the computers being backed up transfer the data to the storage daemon
via the network; the storage daemon then transfers them to the storage
media by means of the connected backup devices.
Figure 1.1 shows the simplest executable Bacula system, which contains
only one director, one storage daemon and one or more file daemons.

Even though Bacula also supports SQLite, that database is recommended only and explicitly for tests and minimal environments.

www.opensourcepress.de

30

1.2 Interplay between components

Figure 1.1: The architecture of Bacula

Of course, Bacula is not bound by this structure; it is far more flexible,


because any number of Bacula consoles, directors, storage daemons and
file daemons can communicate with each other. Figure 1.2 illustrates this
clearly.

Storz Bacula

31

You might also like