This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
/
tutorial.tex
1390 lines (1151 loc) · 50.8 KB
/
tutorial.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%%
%%
\chapter{A Brief Tutorial}
\label{TutorialChapter}
\index[general]{Tutorial}
This chapter will guide you through running Bareos. To do so, we assume you
have installed Bareos.
However, we assume that you have not changed the .conf files. If you have
modified the .conf files, please go back and uninstall Bareos, then reinstall
it, but do not make any changes. The examples in this chapter use the default
configuration files, and will write the volumes to disk in your \path|/var/lib/bareos/storage/|
directory, in addition, the data backed up will be the source directory where
you built Bareos. As a consequence, you can run all the Bareos daemons for
these tests as non-root. Please note, in production, your File daemon(s) must
run as root. See the Security chapter for more information on this subject.
The general flow of running Bareos is:
\begin{enumerate}
\item cd {\textless}install-directory{\textgreater}
\item Start the Database (if using MySQL or PostgreSQL)
\item Start the Bareos Daemons
\item Start the Console program to interact with the Director
\item Run a job
\item When the Volume fills, unmount the Volume, if it is a tape, label a new
one, and continue running. In this chapter, we will write only to disk files
so you won't need to worry about tapes for the moment.
\item Test recovering some files from the Volume just written to ensure the
backup is good and that you know how to recover. Better test before disaster
strikes
\item Add a second client.
\end{enumerate}
Each of these steps is described in more detail below.
\section{Before Running Bareos}
\index[general]{Bareos!Before Running}
Before running Bareos for the first time in production, we recommend that you
run the {\bf test} command in the {\bf btape} program as described in the
\ilink{Utility Program Chapter}{btape} of this manual. This will
help ensure that Bareos functions correctly with your tape drive. If you have
a modern HP, Sony, Tandberg Data or Quantum LTO tape drive running on Linux or
Solaris, you can probably skip this test as Bareos is well tested with these
drives and systems. For all other cases, you are {\bf strongly} encouraged to
run the test before continuing. {\bf btape} also has a {\bf fill} command that
attempts to duplicate what Bareos does when filling a tape and writing on the
next tape. You should consider trying this command as well, but be forewarned,
it can take hours (about four hours on my drive) to fill a large capacity tape.
\section{Starting the Database}
\label{StartDB}
\index[general]{Starting the Database}
\index[general]{Database!Starting the}
If you are using MySQL or PostgreSQL as the Bareos database, you should start
it before you attempt to run a job to avoid getting error messages from Bareos
when it starts.
If you are using SQLite you need do nothing. SQLite is automatically
started by {\bf Bareos}.
\section{Starting the Daemons}
\label{StartDaemon}
\index[general]{Starting the Daemons}
\index[general]{Daemons!Starting the}
Assuming you have installed the packages,
to start the three daemons, from your installation directory, simply enter:
\begin{verbatim}
service bareos-dir start
service bareos-sd start
service bareos-fd start
\end{verbatim}
The {\bf bareos} script starts the Storage daemon, the File daemon, and the
Director daemon, which all normally run as daemons in the background. If you
are using the autostart feature of Bareos, your daemons will either be
automatically started on reboot, or you can control them individually with the
files {\bf bareos-dir}, {\bf bareos-fd}, and {\bf bareos-sd}, which are
usually located in {\bf /etc/init.d}, though the actual location is system
dependent.
Some distributions may do this differently.
Note, on Windows, currently only the File daemon is ported, and it must be
started differently. Please see the
\ilink{Windows Version of Bareos}{Win32Chapter} chapter of this
manual.
The rpm packages configure the daemons to run as user=root and group=bareos.
The rpm installation also creates the group \group{bareos} if it does not exist on the
system. Any users that you add to the group \group{bareos} will have access to files
created by the daemons. To disable or alter this behavior edit the daemon
startup scripts:
\begin{itemize}
\item /etc/init.d/bareos-dir
\item /etc/init.d/bareos-sd
\item /etc/init.d/bareos-fd
\end{itemize}
and then restart as noted above.
The
\ilink{installation chapter}{InstallChapter} of this manual
explains how you can install scripts that will automatically restart the
daemons when the system starts.
\section{Using the Director to Query and Start Jobs}
To communicate with the director and to query the state of Bareos or run jobs,
from the top level directory, simply enter:
\command{bconsole}
% Alternatively to running the command line console, if you have
% Qt4 installed and used the {\bf \verb:--:enable-bat} on the configure command,
% you may use the Bareos Administration Tool ({\bf bat}):
%
% ./bat
%
% Which has a graphical interface, and many more features than bconsole.
For simplicity, here we will describe only the \command{bconsole} program,
also there is also a graphical interface called \command{BAT}.
The {\bf bconsole} runs the Bareos Console program, which connects to the
Director daemon. Since Bareos is a network program, you can run the Console
program anywhere on your network. Most frequently, however, one runs it on the
same machine as the Director. Normally, the Console program will print
something similar to the following:
\footnotesize
\begin{verbatim}
root@bareos:~ # bconsole
Connecting to Director bareos:9101
Enter a period to cancel a command.
*
\end{verbatim}
\normalsize
the asterisk is the console command prompt.
Type {\bf help} to see a list of available commands:
\begin{bconsole}{*}{help}{}{}
Command Description
======= ===========
add Add media to a pool
autodisplay Autodisplay console messages
automount Automount after label
cancel Cancel a job
create Create DB Pool from resource
delete Delete volume, pool or job
disable Disable a job
enable Enable a job
estimate Performs FileSet estimate, listing gives full listing
exit Terminate Bconsole session
export Export volumes from normal slots to import/export slots
gui Non-interactive gui mode
help Print help on specific command
import Import volumes from import/export slots to normal slots
label Label a tape
list List objects from catalog
llist Full or long list like list command
messages Display pending messages
memory Print current memory usage
mount Mount storage
move Move slots in an autochanger
prune Prune expired records from catalog
purge Purge records from catalog
quit Terminate Bconsole session
query Query catalog
restore Restore files
relabel Relabel a tape
release Release storage
reload Reload conf file
rerun Rerun a job
run Run a job
status Report status
setbandwidth Sets bandwidth
setdebug Sets debug level
setip Sets new client address -- if authorized
show Show resource records
sqlquery Use SQL to query catalog
time Print current time
trace Turn on/off trace to file
unmount Unmount storage
umount Umount - for old-time Unix guys, see unmount
update Update volume, pool or stats
use Use specific catalog
var Does variable expansion
version Print Director version
wait Wait until no jobs are running
\end{bconsole}
Details of the console program's commands are explained in the
\ilink{Console Chapter}{_ConsoleChapter} of this manual.
\section{Running a Job}
\label{Running}
\index[general]{Job!Running a}
\index[general]{Running a Job}
At this point, we assume you have done the following:
\begin{itemize}
\item Installed Bareos
\item Started the Database
\item Prepared the database for Bareos
\item Started Bareos Director, Storage Daemon and File Daemon
\item Invoked the Console program with {\bf bconsole}
\end{itemize}
Furthermore, we assume for the moment you are using the default configuration
files.
At this point, enter the \bcommand{show filesets} and you should get something similar this:
\begin{bconsole}{*}{show filesets}{}{}
FileSet: name=Full Set
O M
N
I /usr/sbin
N
E /var/lib/bareos
E /var/lib/bareos/storage
E /proc
E /tmp
E /.journal
E /.fsck
N
\end{bconsole}
This is a pre-defined {\bf FileSet} that will backup the Bareos source
directory. The actual directory names printed should correspond to your system
configuration. For testing purposes, we have chosen a directory of moderate
size (about 40 Megabytes) and complexity without being too big. The FileSet
{\bf Catalog} is used for backing up Bareos's catalog and is not of interest
to us for the moment. The {\bf I} entries are the files or directories that
will be included in the backup and the {\bf E} are those that will be
excluded, and the {\bf O} entries are the options specified for
the FileSet. You can change what is backed up by editing {\bf bareos-dir.conf}
and changing the {\bf File =} line in the {\bf FileSet} resource.
Now is the time to run your first backup job. We are going to backup your
Bareos source directory to a File Volume in your \path|/var/lib/bareos/storage/|
directory just to show you how easy it is. Now enter:
\footnotesize
\begin{verbatim}
status dir
\end{verbatim}
\normalsize
and you should get the following output:
\footnotesize
\begin{verbatim}
bareos-dir Version: 13.2.0 (09 April 2013) x86_64-pc-linux-gnu debian Debian GNU/Linux 6.0 (squeeze)
Daemon started 23-May-13 13:17. Jobs: run=0, running=0 mode=0
Heap: heap=270,336 smbytes=59,285 max_bytes=59,285 bufs=239 max_bufs=239
Scheduled Jobs:
Level Type Pri Scheduled Name Volume
===================================================================================
Incremental Backup 10 23-May-13 23:05 BackupClient1 testvol
Full Backup 11 23-May-13 23:10 BackupCatalog testvol
====
Running Jobs:
Console connected at 23-May-13 13:34
No Jobs running.
====
\end{verbatim}
\normalsize
where the times and the Director's name will be different according to your
setup. This shows that an Incremental job is scheduled to run for the Job {\bf
BackupClient1} at 1:05am and that at 1:10, a {\bf BackupCatalog} is scheduled to
run. Note, you should probably change the name {\bf BackupClient1} to be the name of
your machine, if not, when you add additional clients, it will be very
confusing.
Now enter:
\footnotesize
\begin{verbatim}
status client
\end{verbatim}
\normalsize
and you should get something like:
\footnotesize
\begin{verbatim}
Automatically selected Client: bareos-fd
Connecting to Client bareos-fd at bareos:9102
bareos-fd Version: 13.2.0 (09 April 2013) x86_64-pc-linux-gnu debian Debian GNU/Linux 6.0 (squeeze)
Daemon started 23-May-13 13:17. Jobs: run=0 running=0.
Heap: heap=135,168 smbytes=26,000 max_bytes=26,147 bufs=65 max_bufs=66
Sizeof: boffset_t=8 size_t=8 debug=0 trace=0 bwlimit=0kB/s
Running Jobs:
Director connected at: 23-May-13 13:58
No Jobs running.
====
\end{verbatim}
\normalsize
In this case, the client is named {\bf bareos-fd} your name will be different,
but the line beginning with {\bf bareos-fd Version ...} is printed by your File
daemon, so we are now sure it is up and running.
Finally do the same for your Storage daemon with:
\footnotesize
\begin{verbatim}
status storage
\end{verbatim}
\normalsize
and you should get:
\footnotesize
\begin{verbatim}
Automatically selected Storage: File
Connecting to Storage daemon File at bareos:9103
bareos-sd Version: 13.2.0 (09 April 2013) x86_64-pc-linux-gnu debian Debian GNU/Linux 6.0 (squeeze)
Daemon started 23-May-13 13:17. Jobs: run=0, running=0.
Heap: heap=241,664 smbytes=28,574 max_bytes=88,969 bufs=73 max_bufs=74
Sizes: boffset_t=8 size_t=8 int32_t=4 int64_t=8 mode=0 bwlimit=0kB/s
Running Jobs:
No Jobs running.
====
Device status:
Device "FileStorage" (/var/lib/bareos/storage) is not open.
==
====
Used Volume status:
====
====
\end{verbatim}
\normalsize
You will notice that the default Storage daemon device is named {\bf File} and
that it will use device {\bf /var/lib/bareos/storage}, which is not currently open.
Now, let's actually run a job with:
\footnotesize
\begin{verbatim}
run
\end{verbatim}
\normalsize
you should get the following output:
\footnotesize
\begin{verbatim}
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
A job name must be specified.
The defined Job resources are:
1: BackupClient1
2: BackupCatalog
3: RestoreFiles
Select Job resource (1-3):
\end{verbatim}
\normalsize
Here, Bareos has listed the three different Jobs that you can run, and you
should choose number {\bf 1} and type enter, at which point you will get:
\footnotesize
\begin{verbatim}
Run Backup job
JobName: BackupClient1
Level: Incremental
Client: bareos-fd
Format: Native
FileSet: Full Set
Pool: File (From Job resource)
NextPool: *None* (From unknown source)
Storage: File (From Job resource)
When: 2013-05-23 14:50:04
Priority: 10
OK to run? (yes/mod/no):
\end{verbatim}
\normalsize
At this point, take some time to look carefully at what is printed and
understand it. It is asking you if it is OK to run a job named {\bf BackupClient1}
with FileSet {\bf Full Set} (we listed above) as an Incremental job on your
Client (your client name will be different), and to use Storage {\bf File} and
Pool {\bf Default}, and finally, it wants to run it now (the current time
should be displayed by your console).
Here we have the choice to run ({\bf yes}), to modify one or more of the above
parameters ({\bf mod}), or to not run the job ({\bf no}). Please enter {\bf
yes}, at which point you should immediately get the command prompt (an
asterisk). If you wait a few seconds, then enter the command {\bf messages}
you will get back something like:
\TODO{Replace bconsole output by current version of Bareos.}
\footnotesize
\begin{verbatim}
28-Apr-2003 14:22 bareos-dir: Last FULL backup time not found. Doing
FULL backup.
28-Apr-2003 14:22 bareos-dir: Start Backup JobId 1,
Job=Client1.2003-04-28_14.22.33
28-Apr-2003 14:22 bareos-sd: Job Client1.2003-04-28_14.22.33 waiting.
Cannot find any appendable volumes.
Please use the "label" command to create a new Volume for:
Storage: FileStorage
Media type: File
Pool: Default
\end{verbatim}
\normalsize
The first message, indicates that no previous Full backup was done, so Bareos
is upgrading our Incremental job to a Full backup (this is normal). The second
message indicates that the job started with JobId 1., and the third message
tells us that Bareos cannot find any Volumes in the Pool for writing the
output. This is normal because we have not yet created (labeled) any Volumes.
Bareos indicates to you all the details of the volume it needs.
At this point, the job is BLOCKED waiting for a Volume. You can check this if
you want by doing a {\bf status dir}. In order to continue, we must create a
Volume that Bareos can write on. We do so with:
\footnotesize
\begin{verbatim}
label
\end{verbatim}
\normalsize
and Bareos will print:
\footnotesize
\begin{verbatim}
The defined Storage resources are:
1: File
Item 1 selected automatically.
Enter new Volume name:
\end{verbatim}
\normalsize
at which point, you should enter some name beginning with a letter and
containing only letters and numbers (period, hyphen, and underscore) are also
permitted. For example, enter {\bf TestVolume001}, and you should get back:
\footnotesize
\begin{verbatim}
Defined Pools:
1: Default
Item 1 selected automatically.
Connecting to Storage daemon File at bareos:8103 ...
Sending label command for Volume "TestVolume001" Slot 0 ...
3000 OK label. Volume=TestVolume001 Device=/var/lib/bareos/storage
Catalog record for Volume "TestVolume002", Slot 0 successfully created.
Requesting mount FileStorage ...
3001 OK mount. Device=/var/lib/bareos/storage
\end{verbatim}
\normalsize
Finally, enter {\bf messages} and you should get something like:
\footnotesize
\begin{verbatim}
28-Apr-2003 14:30 bareos-sd: Wrote label to prelabeled Volume
"TestVolume001" on device /var/lib/bareos/storage
28-Apr-2003 14:30 rufus-dir: Bareos 1.30 (28Apr03): 28-Apr-2003 14:30
JobId: 1
Job: BackupClient1.2003-04-28_14.22.33
FileSet: Full Set
Backup Level: Full
Client: bareos-fd
Start time: 28-Apr-2003 14:22
End time: 28-Apr-2003 14:30
Files Written: 1,444
Bytes Written: 38,988,877
Rate: 81.2 KB/s
Software Compression: None
Volume names(s): TestVolume001
Volume Session Id: 1
Volume Session Time: 1051531381
Last Volume Bytes: 39,072,359
FD termination status: OK
SD termination status: OK
Termination: Backup OK
28-Apr-2003 14:30 rufus-dir: Begin pruning Jobs.
28-Apr-2003 14:30 rufus-dir: No Jobs found to prune.
28-Apr-2003 14:30 rufus-dir: Begin pruning Files.
28-Apr-2003 14:30 rufus-dir: No Files found to prune.
28-Apr-2003 14:30 rufus-dir: End auto prune.
\end{verbatim}
\normalsize
If you don't see the output immediately, you can keep entering {\bf messages}
until the job terminates.
Instead of typing \command{messages} multiple times,
you can also ask bconsole to wait, until a specific job is finished:
\footnotesize
\begin{verbatim}
wait jobid=1
\end{verbatim}
\normalsize
or just \command{wait}, which waits for all running jobs to finish.
Another useful command is {\bf autodisplay on}.
With autodisplay activated, messages will automatically be displayed as soon as they are ready.
If you do an {\bf ls -l} of your {\bf /var/lib/bareos/storage} directory, you will see that you
have the following item:
\footnotesize
\begin{verbatim}
-rw-r----- 1 bareos bareos 39072153 Apr 28 14:30 TestVolume001
\end{verbatim}
\normalsize
This is the file Volume that you just wrote and it contains all the data of
the job just run. If you run additional jobs, they will be appended to this
Volume unless you specify otherwise.
You might ask yourself if you have to label all the Volumes that Bareos is
going to use. The answer for disk Volumes, like the one we used, is no. It is
possible to have Bareos automatically label volumes. For tape Volumes, you
will most likely have to label each of the Volumes you want to use.
If you would like to stop here, you can simply enter {\bf quit} in the Console
program.
% To clean up, simply
% delete the file {\bf /tmp/TestVolume001}, and you should also re-initialize
% your database using:
%
% \footnotesize
% \begin{verbatim}
% ./drop_bareos_tables
% ./make_bareos_tables
% \end{verbatim}
% \normalsize
%
% Please note that this will erase all information about the previous jobs that
% have run, and that you might want to do it now while testing but that normally
% you will not want to re-initialize your database.
If you would like to try restoring the files that you just backed up, read the
following section.
\label{restoring}
\section{Restoring Your Files}
\index[general]{Files!Restoring Your}
\index[general]{Restoring Your Files}
If you have run the default configuration and run the job as demonstrated above,
you can restore the backed up files in the Console
program by entering:
\footnotesize
\begin{verbatim}
restore all
\end{verbatim}
\normalsize
where you will get:
\footnotesize
\begin{verbatim}
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
To select the JobIds, you have the following choices:
1: List last 20 Jobs run
2: List Jobs where a given File is saved
3: Enter list of comma separated JobIds to select
4: Enter SQL list command
5: Select the most recent backup for a client
6: Select backup for a client before a specified time
7: Enter a list of files to restore
8: Enter a list of files to restore before a specified time
9: Find the JobIds of the most recent backup for a client
10: Find the JobIds for a backup for a client before a specified time
11: Enter a list of directories to restore for found JobIds
12: Select full restore to a specified Job date
13: Cancel
Select item: (1-13):
\end{verbatim}
\normalsize
As you can see, there are a number of options, but for the current
demonstration, please enter {\bf 5} to do a restore of the last backup you
did, and you will get the following output:
\footnotesize
\begin{verbatim}
Automatically selected Client: bareos-fd
The defined FileSet resources are:
1: Catalog
2: Full Set
Select FileSet resource (1-2):
\end{verbatim}
\normalsize
As you can see, Bareos knows what client
you have, and since there was only one, it selected it automatically.
Select {\bf 2}, because you want to restore files from the file set.
\footnotesize
\begin{verbatim}
+-------+-------+----------+------------+---------------------+---------------+
| jobid | level | jobfiles | jobbytes | starttime | volumename |
+-------+-------+----------+------------+---------------------+---------------+
| 1 | F | 166 | 19,069,526 | 2013-05-05 23:05:02 | TestVolume001 |
+-------+-------+----------+------------+---------------------+---------------+
You have selected the following JobIds: 1
Building directory tree for JobId(s) 1 ... +++++++++++++++++++++++++++++++++++++++++
165 files inserted into the tree and marked for extraction.
You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.
cwd is: /
$
\end{verbatim}
\normalsize
where I have truncated the listing on the right side to make it more readable.
Then Bareos produced a listing containing all the jobs that
form the current backup, in this case, there is only one, and the Storage
daemon was also automatically chosen. Bareos then took all the files that were
in Job number 1 and entered them into a {\bf directory tree} (a sort of in
memory representation of your filesystem). At this point, you can use the {\bf
cd} and {\bf ls} ro {\bf dir} commands to walk up and down the directory tree
and view what files will be restored. For example, if I enter {\bf cd
/usr/sbin} and then enter {\bf dir} I will get a listing
of all the files in the Bareos source directory. On your system, the path might
be somewhat different. For more information on this, please refer to the
\ilink{Restore Command Chapter}{RestoreChapter} of this manual for
more details.
To exit this mode, simply enter:
\footnotesize
\begin{verbatim}
done
\end{verbatim}
\normalsize
and you will get the following output:
\footnotesize
\begin{verbatim}
Bootstrap records written to
/home/user/bareos/testbin/working/restore.bsr
The restore job will require the following Volumes:
TestVolume001
1444 files selected to restore.
Run Restore job
JobName: RestoreFiles
Bootstrap: /home/user/bareos/testbin/working/restore.bsr
Where: /tmp/bareos-restores
Replace: always
FileSet: Full Set
Backup Client: rufus-fd
Restore Client: rufus-fd
Storage: File
JobId: *None*
When: 2005-04-28 14:53:54
OK to run? (yes/mod/no):
Bootstrap records written to /var/lib/bareos/bareos-dir.restore.1.bsr
The job will require the following
Volume(s) Storage(s) SD Device(s)
===========================================================================
TestVolume001 File FileStorage
Volumes marked with "*" are online.
166 files selected to be restored.
Run Restore job
JobName: RestoreFiles
Bootstrap: /var/lib/bareos/bareos-dir.restore.1.bsr
Where: /tmp/bareos-restores
Replace: Always
FileSet: Full Set
Backup Client: bareos-fd
Restore Client: bareos-fd
Format: Native
Storage: File
When: 2013-05-23 15:56:53
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no):
\end{verbatim}
\normalsize
If you answer {\bf yes} your files will be restored to {\bf
/tmp/bareos-restores}. If you want to restore the files to their original
locations, you must use the {\bf mod} option and explicitly set {\bf Where:}
to nothing (or to /). We recommend you go ahead and answer {\bf yes} and after
a brief moment, enter {\bf messages}, at which point you should get a listing
of all the files that were restored as well as a summary of the job that looks
similar to this:
\footnotesize
\begin{verbatim}
23-May 15:24 bareos-dir JobId 2: Start Restore Job RestoreFiles.2013-05-23_15.24.01_10
23-May 15:24 bareos-dir JobId 2: Using Device "FileStorage" to read.
23-May 15:24 bareos-sd JobId 2: Ready to read from volume "TestVolume001" on device "FileStorage" (/var/lib/bareos/storage).
23-May 15:24 bareos-sd JobId 2: Forward spacing Volume "TestVolume001" to file:block 0:194.
23-May 15:58 bareos-dir JobId 3: Bareos bareos-dir 13.2.0 (09Apr13):
Build OS: x86_64-pc-linux-gnu debian Debian GNU/Linux 6.0 (squeeze)
JobId: 2
Job: RestoreFiles.2013-05-23_15.58.48_11
Restore Client: bareos-fd
Start time: 23-May-2013 15:58:50
End time: 23-May-2013 15:58:52
Files Expected: 166
Files Restored: 166
Bytes Restored: 19,069,526
Rate: 9534.8 KB/s
FD Errors: 0
FD termination status: OK
SD termination status: OK
Termination: Restore OK
\end{verbatim}
\normalsize
After exiting the Console program, you can examine the files in {\bf
/tmp/bareos-restores}, which will contain a small directory tree with all the
files. Be sure to clean up at the end with:
\footnotesize
\begin{verbatim}
rm -rf /tmp/bareos-restore
\end{verbatim}
\normalsize
\section{Quitting the Console Program}
\index[general]{Program!Quitting the Console}
\index[general]{Quitting the Console Program}
Simply enter the command {\bf quit}.
\label{SecondClient}
\section{Adding a Second Client}
\index[general]{Client!Adding a Second}
\index[general]{Adding a Second Client}
\subsection{Changes on the Client}
If you have gotten the example shown above to work on your system, you may be
ready to add a second Client (File daemon). That is you have a second machine
that you would like backed up. The only part you need installed on the other
machine is the {\bf bareos-filedaemon}.
This packages installs also its configuration file \path|/etc/bareos/bareos-fd.conf|
an sets its hostname + \path|-fd| as FileDaemon name.
However, the client does not known the Bareos Director, so this information must be given manually.
Lets assume, your second like has the hostname {\bf client2}
and this name is resolvable by DNS from the client and from the Bareos Director.
Specify the Bareos Director in the File Daemon configuration file \path|/etc/bareos/bareos-fd.conf|:
\footnotesize
\begin{verbatim}
...
#
# List Directors who are permitted to contact this File daemon
#
Director {
Name = bareos-dir
Password = "PASSWORD" # this is the passwort which you need to use within the client ressource.
}
...
\end{verbatim}
\normalsize
The password is also generated at installation time,
but you are free to change it. Just keep in mind, it must be identical on the client and the Bareos Director.
Restart the Bareos File Daemon by
\footnotesize
\begin{verbatim}
root@client2:~ # service bareos-fd restart
\end{verbatim}
\normalsize
\subsection{Changes on the Bareos Director (Server)}
Then you need to
make some additions to your Director's configuration file to define the new
File Daemon (Client).
Starting from our original example which should be
installed on your system, you should add the following lines (essentially
copies of the existing data but with the names changed) to your Director's
configuration file {\bf bareos-dir.conf}.
Add following section makes the new client know to the Bareos Director.
Add this section to the existing Bareos Director configuration file \path|/etc/bareos/bareos-dir.conf|:
\footnotesize
\begin{verbatim}
Client {
Name = client2-fd
Address = client2 # the name has to be resolvable through DNS. If this is not possible, you can work with IP addresses
Password = "PASSWORD" # password for FileDaemon which has to be the same like the password in the director ressource of the bareos-fd.conf on the backup client. Copy it the the client to this line.
}
\end{verbatim}
\normalsize
Using this, the client is know to the Bareos Director. Additional you must specify, what to do with this client.
Therefore we specify a Job, which mostly takes its settings from the existing DefaultJob:
\footnotesize
\begin{verbatim}
Job {
JobDefs = "DefaultJob"
Name = "client2"
Client = "client2-fd"
}
\end{verbatim}
\normalsize
Check if the configuration file is correct by
\footnotesize
\begin{verbatim}
root@bareos:~ # bareos-dir -t -c /etc/bareos/bareos-dir.conf
\end{verbatim}
\normalsize
If everything is okay, reload the Bareos Director:
\footnotesize
\begin{verbatim}
root@bareos:~ # service bareos-dir reload
\end{verbatim}
\normalsize
Now the setup for the second client should be ready.
To test the functionality, you can run a backup and restore job like in the example with the first attached FileDaemon.
However, there is an even earier way to check if a connection to a File Daemon is working. This is the \command{estimate listing} command in bconsole. Using this, the Bareos Director immediately connects to a client and returns all files that will be included in the next backup.
Start \command{bconsole} and follow the instructions:
\footnotesize
\begin{verbatim}
* estimate listing
\end{verbatim}
\normalsize
The result should appear immediately.
To make this a real production installation, you will possibly want to use
different Pool, or a different schedule. It is up to you to customize.
% For some important tips on changing names and passwords, and a diagram of what
% names and passwords must match, please see
% \ilink{Authorization Errors}{AuthorizationErrors} in the FAQ chapter
% of this manual.
\section{When The Tape Fills}
\label{FullTape}
\index[general]{Tape!Full}
\index[general]{When The Tape Fills}
\index[general]{Problem!Tape Full}
If you have scheduled your job, typically nightly, there will come a time when
the tape fills up and {\bf Bareos} cannot continue. In this case, Bareos will
send you a message similar to the following:
\footnotesize
\begin{verbatim}
bareos-sd: block.c:337 === Write error errno=28: ERR=No space left on device
\end{verbatim}
\normalsize
This indicates that Bareos got a write error because the tape is full. Bareos
will then search the Pool specified for your Job looking for an appendable
volume. In the best of all cases, you will have properly set your Retention
Periods and you will have all your tapes marked to be Recycled, and {\bf
Bareos} will automatically recycle the tapes in your pool requesting and
overwriting old Volumes. For more information on recycling, please see the
\ilink{Recycling chapter}{RecyclingChapter} of this manual. If you
find that your Volumes were not properly recycled (usually because of a
configuration error), please see the
\ilink{Manually Recycling Volumes}{manualrecycling} section of
the Recycling chapter.
If like me, you have a very large set of Volumes and you label them with the
date the Volume was first writing, or you have not set up your Retention
periods, Bareos will not find a tape in the pool, and it will send you a
message similar to the following:
\footnotesize
\begin{verbatim}
bareos-sd: Job usersave.2002-09-19.10:50:48 waiting. Cannot find any
appendable volumes.
Please use the "label" command to create a new Volume for:
Storage: SDT-10000
Media type: DDS-4
Pool: Default
\end{verbatim}
\normalsize
Until you create a new Volume, this message will be repeated an hour later,
then two hours later, and so on doubling the interval each time up to a
maximum interval of one day.
The obvious question at this point is: What do I do now?
The answer is simple: first, using the Console program, close the tape drive
using the {\bf unmount} command. If you only have a single drive, it will be
automatically selected, otherwise, make sure you release the one specified on
the message (in this case {\bf STD-10000}).
Next, you remove the tape from the drive and insert a new blank tape. Note, on
some older tape drives, you may need to write an end of file mark ({\bf mt \
-f \ /dev/nst0 \ weof}) to prevent the drive from running away when Bareos
attempts to read the label.
Finally, you use the {\bf label} command in the Console to write a label to
the new Volume. The {\bf label} command will contact the Storage daemon to
write the software label, if it is successful, it will add the new Volume to
the Pool, then issue a {\bf mount} command to the Storage daemon. See the
previous sections of this chapter for more details on labeling tapes.
The result is that Bareos will continue the previous Job writing the backup to
the new Volume.
If you have a Pool of volumes and Bareos is cycling through them, instead of
the above message "Cannot find any appendable volumes.", Bareos may ask you
to mount a specific volume. In that case, you should attempt to do just that.
If you do not have the volume any more (for any of a number of reasons), you
can simply mount another volume from the same Pool, providing it is
appendable, and Bareos will use it. You can use the {\bf list volumes} command
in the console program to determine which volumes are appendable and which are
not.
If like me, you have your Volume retention periods set correctly, but you have
no more free Volumes, you can relabel and reuse a Volume as follows:
\begin{itemize}
\item Do a {\bf list volumes} in the Console and select the oldest Volume for
relabeling.
\item If you have setup your Retention periods correctly, the Volume should
have VolStatus {\bf Purged}.
\item If the VolStatus is not set to Purged, you will need to purge the
database of Jobs that are written on that Volume. Do so by using the command
{\bf purge jobs volume} in the Console. If you have multiple Pools, you will
be prompted for the Pool then enter the VolumeName (or MediaId) when
requested.
\item Then simply use the {\bf relabel} command to relabel the Volume.
\end{itemize}
To manually relabel the Volume use the following additional steps:
\begin{itemize}
\item To delete the Volume from the catalog use the {\bf delete volume}
command in the Console and select the VolumeName (or MediaId) to be deleted.
\item Use the {\bf unmount} command in the Console to unmount the old tape.
\item Physically relabel the old Volume that you deleted so that it can be
reused.
\item Insert the old Volume in the tape drive.
\item From a command line do: {\bf mt \ -f \ /dev/st0 \ rewind} and {\bf mt \
-f \ /dev/st0 \ weof}, where you need to use the proper tape drive name for
your system in place of {\bf /dev/st0}.
\item Use the {\bf label} command in the Console to write a new Bareos label
on your tape.
\item Use the {\bf mount} command in the Console if it is not automatically