]> git.sur5r.net Git - bacula/docs/blob - docs/manual/recycling.tex
Final changes
[bacula/docs] / docs / manual / recycling.tex
1 %%
2 %%
3
4 \section*{Automatic Volume Recycling}
5 \label{_ChapterStart22}
6 \index[general]{Recycling!Automatic Volume }
7 \index[general]{Automatic Volume Recycling }
8 \addcontentsline{toc}{section}{Automatic Volume Recycling}
9
10 By default, once Bacula starts writing a Volume, it can
11 append to the volume, but it will not overwrite the existing
12 data thus destroying it.
13 However when Bacula {\bf recycles} a Volume, the Volume becomes
14 available for being reused, and Bacula can at some later time
15 over write the previous contents of that Volume.
16 Thus all previous data will be lost. If the Volume is a tape,
17 the tape will be rewritten from the beginning.  If the Volume is
18 a disk file, the file will be truncated before being rewritten.
19
20 You may not want Bacula to automatically recycle (reuse) tapes.  This would
21 require a large number of tapes though, and in such a case, it is possible
22 to manually recycle tapes.  For more on manual recycling, see the section
23 entitled \ilink{ Manually Recycling Volumes}{manualrecycling} below in this
24 chapter.
25
26 Most people prefer to have a Pool of tapes that are used for daily backups and
27 recycled once a week, another Pool of tapes that are used for Full backups
28 once a week and recycled monthly, and finally a Pool of tapes that are used
29 once a month and recycled after a year or two. With a scheme like this, the 
30 number of tapes in your pool or pools remains constant.
31
32 By properly defining your Volume Pools with appropriate Retention periods,
33 Bacula can manage the recycling (such as defined above) automatically. 
34
35 Automatic recycling of Volumes is controlled by three records in the {\bf
36 Pool} resource definition in the Director's configuration file. These three
37 records are: 
38
39 \begin{itemize}
40 \item AutoPrune = yes 
41 \item VolumeRetention = \lt{}time\gt{} 
42 \item Recycle = yes 
43    \end{itemize}
44
45 Automatic recycling of Volumes is performed by Bacula only when it wants a
46 new Volume and no appendable Volumes are available in the Pool. It will then
47 search the Pool for any Volumes with the {\bf Recycle} flag set and whose
48 Volume Status is {\bf Full}. At that point, the recycling occurs in two steps.
49 The first is that the Catalog for a Volume must be purged of all Jobs and
50 Files contained on that Volume, and the second step is the actual recycling of
51 the Volume. The Volume will be purged if the VolumeRetention period has
52 expired. When a Volume is marked as Purged, it means that no Catalog records
53 reference that Volume, and the Volume can be recycled. Until recycling
54 actually occurs, the Volume data remains intact. If no Volumes can be found
55 for recycling for any of the reasons stated above, Bacula will request
56 operator intervention (i.e. it will ask you to label a new volume). 
57
58 A key point mentioned above, that can be a source of frustration, is that Bacula
59 will only recycle purged Volumes if there is no other appendable Volume
60 available, otherwise, it will always write to an appendable Volume before
61 recycling even if there are Volume marked as Purged. This preserves your data
62 as long as possible. So, if you wish to "force" Bacula to use a purged
63 Volume, you must first ensure that no other Volume in the Pool is marked {\bf
64 Append}. If necessary, you can manually set a volume to {\bf Full}. The reason
65 for this is that Bacula wants to preserve the data on your old tapes (even
66 though purged from the catalog) as long as absolutely possible before
67 overwriting it. 
68
69 \label{AutoPruning}
70 \subsection*{Automatic Pruning}
71 \index[general]{Automatic Pruning }
72 \index[general]{Pruning!Automatic }
73 \addcontentsline{toc}{subsection}{Automatic Pruning}
74
75 As Bacula writes files to tape, it keeps a list of files, jobs, and volumes in
76 a database called the catalog. Among other things, the database helps Bacula
77 to decide which files to back up in an incremental or differential backup, and
78 helps you locate files on past backups when you want to restore something.
79 However, the catalog will grow larger and larger as time goes on, and
80 eventually it can become unacceptably large. 
81
82 Bacula's process for removing entries from the catalog is called Pruning. The
83 default is Automatic Pruning, which means that once an entry reaches a certain
84 age (e.g. 30 days old) it is removed from the catalog. Once a job has been
85 pruned, you can still restore it from the backup tape, but one additional step
86 is required: scanning the volume with bscan. The alternative to Automatic
87 Pruning is Manual Pruning, in which you explicitly tell Bacula to erase the
88 catalog entries for a volume. You'd usually do this when you want to reuse a
89 Bacula volume, because there's no point in keeping a list of files that USED
90 TO BE on a tape. Or, if the catalog is starting to get too big, you could
91 prune the oldest jobs to save space. Manual pruning is done with the 
92 \ilink{ prune command}{ManualPruning} in the console. (thanks to
93 Bryce Denney for the above explanation). 
94
95 \subsection*{Prunning Directives}
96 \index[general]{Prunning Directives }
97 \index[general]{Directives!Prunning }
98 \addcontentsline{toc}{subsection}{Prunning Directives}
99
100 There are three pruning durations. All apply to catalog database records and
101 not to the actual data in a Volume. The pruning (or retention) durations are
102 for: Volumes (Media records), Jobs (Job records), and Files (File records).
103 The durations inter-depend a bit because if Bacula prunes a Volume, it
104 automatically removes all the Job records, and all the File records. Also when
105 a Job record is pruned, all the File records for that Job are also pruned
106 (deleted) from the catalog. 
107
108 Having the File records in the database means that you can examine all the
109 files backed up for a particular Job. They take the most space in the catalog
110 (probably 90-95\% of the total). When the File records are pruned, the Job
111 records can remain, and you can still examine what Jobs ran, but not the
112 details of the Files backed up. In addition, without the File records, you
113 cannot use the Console restore command to restore the files. 
114
115 When a Job record is pruned, the Volume (Media record) for that Job can still
116 remain in the database, and if you do a "list volumes", you will see the
117 volume information, but the Job records (and its File records) will no longer
118 be available. 
119
120 In each case, pruning removes information about where older files are, but it
121 also prevents the catalog from growing to be too large. You choose the
122 retention periods in function of how many files you are backing up and the
123 time periods you want to keep those records online, and the size of the
124 database. You can always re-insert the records (with 98\% of the original data)
125 by using "bscan" to scan in a whole Volume or any part of the volume that
126 you want. 
127
128 By setting {\bf AutoPrune} to {\bf yes} you will permit {\bf Bacula} to
129 automatically prune all Volumes in the Pool when a Job needs another Volume.
130 Volume pruning means removing records from the catalog. It does not shrink the
131 size of the Volume or affect the Volume data until the Volume gets
132 overwritten. When a Job requests another volume and there are no Volumes with
133 Volume Status {\bf Append} available, Bacula will begin volume pruning. This
134 means that all Jobs that are older than the {\bf VolumeRetention} period will
135 be pruned from every Volume that has Volume Status {\bf Full} or {\bf Used}
136 and has Recycle set to {\bf yes}. Pruning consists of deleting the
137 corresponding Job, File, and JobMedia records from the catalog database. No
138 change to the physical data on the Volume occurs during the pruning process.
139 When all files are pruned from a Volume (i.e. no records in the catalog), the
140 Volume will be marked as {\bf Purged} implying that no Jobs remain on the
141 volume. The Pool records that control the pruning are described below. 
142
143 \begin{description}
144
145 \item [AutoPrune = \lt{}yes|no\gt{}]
146    \index[console]{AutoPrune  }
147    If AutoPrune is set to  {\bf yes} (default), Bacula (version 1.20 or greater)
148 will  automatically apply the Volume retention period when running a Job  and
149 it needs a new Volume but no appendable volumes are available.  At that point,
150 Bacula will prune all Volumes that can be pruned  (i.e. AutoPrune set) in an
151 attempt to find a usable volume. If  during the autoprune, all files are
152 pruned from the Volume, it  will be marked with VolStatus {\bf Purged}.  The
153 default is {\bf yes}.  
154
155 \item [Volume Retention = \lt{}time-period-specification\gt{}]
156    \index[console]{Volume Retention  }
157    The  Volume Retention record defines the length of time that  Bacula will
158 guarantee that the Volume is not reused counting  from the time the last job
159 stored on the Volume terminated.  
160
161 When this time period expires, and if {\bf AutoPrune} is set to  {\bf yes},
162 and a new Volume is needed, but no appendable Volume  is available, Bacula
163 will prune (remove) Job records that  are older than the specified Volume
164 Retention period.  
165
166 The Volume Retention period takes precedence  over any Job Retention period
167 you have specified in the  Client resource. It should also be noted, that the
168 Volume  Retention period is obtained by reading the Catalog Database Media 
169 record rather than the Pool resource record. This means that  if you change
170 the VolumeRetention in the Pool resource record,  you must ensure that the
171 corresponding change is made in the  catalog by using the {\bf update pool}
172 command. Doing so  will insure that any new Volumes will be created with the 
173 changed Volume Retention period. Any existing Volumes will  have their own
174 copy of the Volume Retention period that can  only be changed on a Volume by
175 Volume basis using the  {\bf update volume} command.  
176
177 When all file catalog entries are removed from the volume,  its VolStatus is
178 set to {\bf Purged}. The files remain physically  on the Volume until the
179 volume is overwritten.  
180
181 Retention periods are specified in seconds,  minutes, hours, days, weeks,
182 months,  quarters, or years on the record. See the  
183 \ilink{Configuration chapter}{Time} of this  manual for
184 additional details of time specification.  
185
186 The default is 1 year. 
187
188 \item [Recycle = \lt{}yes|no\gt{}]
189    \index[fd]{Recycle  }
190    This statement tells Bacula  whether or not the particular Volume can be
191 recycled (i.e.  rewritten). If Recycle is set to {\bf no}  (the default), then
192 even if Bacula prunes all the Jobs  on the volume and it is marked {\bf
193 Purged}, it will not  consider the tape for recycling. If Recycle is set to
194 {\bf yes}  and all Jobs have been pruned, the volume status will be set to 
195 {\bf Purged} and the volume may then be reused when another  volume is needed.
196 If the volume is reused, it is relabeled with  the same Volume Name, however
197 all previous data will be lost. 
198 \end{description}
199
200 Note, it is also possible to "force" pruning of all Volumes in the Pool
201 associated with a Job by adding {\bf Prune Files = yes} to the Job resource. 
202 \label{Recycling}
203
204 \subsection*{Recycling Algorithm}
205 \index[general]{Algorithm!Recycling }
206 \index[general]{Recycling Algorithm }
207 \addcontentsline{toc}{subsection}{Recycling Algorithm}
208
209 After all Volumes of a Pool have been pruned (as mentioned above, this happens
210 when a Job needs a new Volume and no appendable Volumes are available), Bacula
211 will look for the oldest Volume that is Purged (all Jobs and Files expired),
212 and if the {\bf Recycle} flag is on (Recycle=yes) for that Volume, Bacula will
213 relabel it and write new data on it. 
214
215 The full recycling algorithm that Bacula uses when it needs a new Volume is: 
216
217 \begin{itemize}
218 \item Search the Pool for a Volume with VolStatus=Append (if there is  more
219    than one, the Volume with the oldest date last written is  chosen. If two have
220    the same date then the one with  the lowest MediaId is chosen). 
221 \item Search the Pool for a Volume with VolStatus=Recycle (if there is  more
222    than one, the Volume with the oldest date last written is  chosen. If two have
223    the same date then the one with  the lowest MediaId is chosen). 
224 \item Try recycling any purged Volumes.
225 \item Prune volumes applying Volume retention period (Volumes with VolStatus 
226    Full, Used, or Append are pruned). 
227 \item Search the Pool for a Volume with VolStatus=Purged 
228 \item Attempt to create a new Volume if automatic labeling enabled 
229 \item If a Pool named "Scratch" exists, search for a Volume and if found
230    move it to the current Pool for the Job and use it.
231 \item Prune the oldest Volume if RecycleOldestVolume=yes (the Volume  with the
232    oldest LastWritten date and VolStatus equal to  Full, Recycle, Purged, Used,
233    or Append is chosen). This  record ensures that all retention periods are
234    properly  respected. 
235 \item Purge the oldest Volume if PurgeOldestVolume=yes (the Volume  with the
236    oldest LastWritten date and VolStatus equal to  Full, Recycle, Purged, Used,
237    or Append is chosen). We strongly  recommend against the use of {\bf
238    PurgeOldestVolume} as it  can quite easily lead to loss of current backup
239    data. 
240 \item Give up and ask operator. 
241    \end{itemize}
242
243 The above occurs when Bacula has finished writing a Volume or when no Volume
244 is present in the drive. 
245
246 On the other hand, if you have inserted a different Volume after the last job,
247 and Bacula recognizes the Volume as valid, it will request authorization from
248 the Director to use this Volume. In this case, if you have set {\bf Recycle
249 Current Volume = yes} and the Volume is marked as Used or Full, Bacula will
250 prune the volume and if all jobs were removed during the pruning (respecting
251 the retention periods), the Volume will be recycled and used. For this to
252 work, you must have {\bf Accept Any Volume = yes} in the Pool. The recycling
253 algorithm in this case is: 
254
255 \begin{itemize}
256 \item If the VolStatus is {\bf Append} or {\bf Recycle}  and {\bf Accept Any
257    Volume} is set, the volume  will be used.  
258 \item If {\bf Recycle Current Volume} is set and the  volume is marked {\bf
259    Full} or {\bf Used}, Bacula  will prune the volume (applying the retention
260    period).  If all Jobs are pruned from the volume, it will be  recycled. 
261 \end{itemize}
262
263 This permits users to manually change the Volume every day and load tapes in
264 an order different from what is in the catalog, and if the volume does not
265 contain a current copy of your backup data, it will be used. 
266
267 \subsection*{Recycle Status}
268 \index[general]{Status!Recycle }
269 \index[general]{Recycle Status }
270 \addcontentsline{toc}{subsection}{Recycle Status}
271
272 Each Volume inherits the Recycle status (yes or no) from the Pool resource
273 record when the Media record is created (normally when the Volume is labeled).
274 This Recycle status is stored in the Media record of the Catalog. Using
275 the Console program, you may subsequently change the Recycle status for each
276 Volume. For example in the following output from {\bf list volumes}: 
277
278 \footnotesize
279 \begin{verbatim}
280 +----------+-------+--------+---------+------------+--------+-----+
281 | VolumeNa | Media | VolSta | VolByte | LastWritte | VolRet | Rec |
282 +----------+-------+--------+---------+------------+--------+-----+
283 | File0001 | File  | Full   | 4190055 | 2002-05-25 | 14400  | 1   |
284 | File0002 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
285 | File0003 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
286 | File0004 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
287 | File0005 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
288 | File0006 | File  | Full   | 1896460 | 2002-05-26 | 14400  | 1   |
289 | File0007 | File  | Purged | 1896466 | 2002-05-26 | 14400  | 1   |
290 +----------+-------+--------+---------+------------+--------+-----+
291 \end{verbatim}
292 \normalsize
293
294 all the volumes are marked as recyclable, and the last Volume, {\bf File0007}
295 has been purged, so it may be immediately recycled. The other volumes are all
296 marked recyclable and when their Volume Retention period (14400 seconds or 4
297 hours) expires, they will be eligible for pruning, and possibly recycling.
298 Even though Volume {\bf File0007} has been purged, all the data on the Volume
299 is still recoverable. A purged Volume simply means that there are no entries
300 in the Catalog. Even if the Volume Status is changed to {\bf Recycle}, the
301 data on the Volume will be recoverable. The data is lost only when the Volume
302 is re-labeled and re-written. 
303
304 To modify Volume {\bf File0001} so that it cannot be recycled, you use the
305 {\bf update volume pool=File} command in the console program, or simply {\bf
306 update} and Bacula will prompt you for the information. 
307
308 \footnotesize
309 \begin{verbatim}
310 +----------+------+-------+---------+-------------+-------+-----+
311 | VolumeNa | Media| VolSta| VolByte | LastWritten | VolRet| Rec |
312 +----------+------+-------+---------+-------------+-------+-----+
313 | File0001 | File | Full  | 4190055 | 2002-05-25  | 14400 | 0   |
314 | File0002 | File | Full  | 1897236 | 2002-05-26  | 14400 | 1   |
315 | File0003 | File | Full  | 1896460 | 2002-05-26  | 14400 | 1   |
316 | File0004 | File | Full  | 1896460 | 2002-05-26  | 14400 | 1   |
317 | File0005 | File | Full  | 1896460 | 2002-05-26  | 14400 | 1   |
318 | File0006 | File | Full  | 1896460 | 2002-05-26  | 14400 | 1   |
319 | File0007 | File | Purged| 1896466 | 2002-05-26  | 14400 | 1   |
320 +----------+------+-------+---------+-------------+-------+-----+
321 \end{verbatim}
322 \normalsize
323
324 In this case, {\bf File0001} will never be automatically recycled. The same
325 effect can be achieved by setting the Volume Status to Read-Only. 
326
327 \subsection*{Making Bacula Use a Single Tape}
328 \label{singletape}
329 \index[general]{Tape!Making Bacula Use a Single }
330 \index[general]{Making Bacula Use a Single Tape }
331 \addcontentsline{toc}{subsection}{Making Bacula Use a Single Tape}
332
333 Most people will want Bacula to fill a tape and when it is full, a new tape
334 will be mounted, and so on. However, as an extreme example, it is possible for
335 Bacula to write on a single tape, and every night to rewrite it. To get this
336 to work, you must do two things: first, set the VolumeRetention to less than
337 your save period (one day), and the second item is to make Bacula mark the
338 tape as full after using it once. This is done using {\bf UseVolumeOnce =
339 yes}. If this latter record is not used and the tape is not full after the
340 first time it is written, Bacula will simply append to the tape and eventually
341 request another volume. Using the tape only once, forces the tape to be marked
342 {\bf Full} after each use, and the next time {\bf Bacula} runs, it will
343 recycle the tape. 
344
345 An example Pool resource that does this is: 
346
347 \footnotesize
348 \begin{verbatim}
349 Pool {
350   Name = DDS-4
351   Use Volume Once = yes
352   Pool Type = Backup
353   AutoPrune = yes
354   VolumeRetention = 12h # expire after 12 hours
355   Recycle = yes
356 }
357 \end{verbatim}
358 \normalsize
359
360 \subsection*{A Daily, Weekly, Monthly Tape Usage Example}
361 \label{usageexample}
362 \index[general]{Daily, Weekly, Monthly Tape Usage Example }
363 \index[general]{Example!Daily Weekly Monthly Tape Usage }
364 \addcontentsline{toc}{subsection}{Daily, Weekly, Monthly Tape Usage Example}
365
366 This example is meant to show you how one could define a fixed set of volumes
367 that Bacula will rotate through on a regular schedule. There are an infinite
368 number of such schemes, all of which have various advantages and
369 disadvantages. 
370
371 We start with the following assumptions: 
372
373 \begin{itemize}
374 \item A single tape has more than enough capacity to do  a full save.  
375 \item There are 10 tapes that are used on a daily basis  for incremental
376    backups. They are prelabeled Daily1 ...  Daily10.  
377 \item There are 4 tapes that are used on a weekly basis  for full backups.
378    They are labeled Week1 ... Week4.  
379 \item There are 12 tapes that are used on a monthly basis  for full backups.
380    They are numbered Month1 ... Month12  
381 \item A full backup is done every Saturday evening (tape inserted  Friday
382    evening before leaving work).  
383 \item No backups are done over the weekend (this is easy to  change).  
384 \item The first Friday of each month, a Monthly tape is used for  the Full
385    backup.  
386 \item Incremental backups are done Monday - Friday (actually  Tue-Fri
387    mornings). 
388    \end{itemize}
389
390 We start the system by doing a Full save to one of the weekly volumes or one
391 of the monthly volumes. The next morning, we remove the tape and insert a
392 Daily tape. Friday evening, we remove the Daily tape and insert the next tape
393 in the Weekly series. Monday, we remove the Weekly tape and re-insert the
394 Daily tape. On the first Friday of the next month, we insert the next Monthly
395 tape in the series rather than a Weekly tape, then continue. When a Daily tape
396 finally fills up, {\bf Bacula} will request the next one in the series, and
397 the next day when you notice the email message, you will mount it and {\bf
398 Bacula} will finish the unfinished incremental backup. 
399
400 What does this give? Well, at any point, you will have the last complete
401 Full save plus several Incremental saves. For any given file you want to
402 recover (or your whole system), you will have a copy of that file every day
403 for at least the last 14 days. For older versions, you will have at least 3
404 and probably 4 Friday full saves of that file, and going back further, you
405 will have a copy of that file made on the beginning of the month for at least
406 a year. 
407
408 So you have copies of any file (or your whole system) for at least a year, but
409 as you go back in time, the time between copies increases from daily to weekly
410 to monthly. 
411
412 What would the Bacula configuration look like to implement such a scheme? 
413
414 \footnotesize
415 \begin{verbatim}
416 Schedule {
417   Name = "NightlySave"
418   Run = Level=Full Pool=Monthly 1st sat at 03:05
419   Run = Level=Full Pool=Weekly 2nd-5th sat at 03:05
420   Run = Level=Incremental Pool=Daily tue-fri at 03:05
421 }
422 Job {
423   Name = "NightlySave"
424   Type = Backup
425   Level = Full
426   Client = LocalMachine
427   FileSet = "File Set"
428   Messages = Standard
429   Storage = DDS-4
430   Pool = Daily
431   Schedule = "NightlySave"
432 }
433 # Definition of file storage device
434 Storage {
435   Name = DDS-4
436   Address = localhost
437   SDPort = 9103
438   Password = XXXXXXXXXXXXX
439   Device = FileStorage
440   Media Type = 8mm
441 }
442 FileSet {
443   Name = "File Set"
444   Include = signature=MD5 {
445     fffffffffffffffff
446   }
447   Exclude = { *.o }
448 }
449 Pool {
450   Name = Daily
451   Pool Type = Backup
452   AutoPrune = yes
453   VolumeRetention = 10d   # recycle in 10 days
454   Maximum Volumes = 10
455   Recycle = yes
456 }
457 Pool {
458   Name = Weekly
459   Use Volume Once = yes
460   Pool Type = Backup
461   AutoPrune = yes
462   VolumeRetention = 30d  # recycle in 30 days (default)
463   Recycle = yes
464 }
465 Pool {
466   Name = Monthly
467   Use Volume Once = yes
468   Pool Type = Backup
469   AutoPrune = yes
470   VolumeRetention = 365d  # recycle in 1 year
471   Recycle = yes
472 }
473 \end{verbatim}
474 \normalsize
475
476 \subsection*{ Automatic Pruning and Recycling Example}
477 \label{PruningExample}
478 \index[general]{Automatic Pruning and Recycling Example }
479 \index[general]{Example!Automatic Pruning and Recycling }
480 \addcontentsline{toc}{subsection}{Automatic Pruning and Recycling Example}
481
482 Perhaps the best way to understand the various resource records that come into
483 play during automatic pruning and recycling is to run a Job that goes through
484 the whole cycle. If you add the following resources to your Director's
485 configuration file: 
486
487 \footnotesize
488 \begin{verbatim}
489 Schedule {
490   Name = "30 minute cycle"
491   Run = Level=Full Pool=File Messages=Standard Storage=File
492          hourly at 0:05
493   Run = Level=Full Pool=File Messages=Standard Storage=File
494          hourly at 0:35
495 }
496 Job {
497   Name = "Filetest"
498   Type = Backup
499   Level = Full
500   Client=XXXXXXXXXX
501   FileSet="Test Files"
502   Messages = Standard
503   Storage = File
504   Pool = File
505   Schedule = "30 minute cycle"
506 }
507 # Definition of file storage device
508 Storage {
509   Name = File
510   Address = XXXXXXXXXXX
511   SDPort = 9103
512   Password = XXXXXXXXXXXXX
513   Device = FileStorage
514   Media Type = File
515 }
516 FileSet {
517   Name = "Test Files"
518   Include = signature=MD5 {
519     fffffffffffffffff
520   }
521   Exclude = { *.o }
522 }
523 Pool {
524   Name = File
525   Use Volume Once = yes
526   Pool Type = Backup
527   LabelFormat = "File"
528   AutoPrune = yes
529   VolumeRetention = 4h
530   Maximum Volumes = 12
531   Recycle = yes
532 }
533 \end{verbatim}
534 \normalsize
535
536 Where you will need to replace the {\bf ffffffffff}'s by the appropriate files
537 to be saved for your configuration. For the FileSet Include, choose a
538 directory that has one or two megabytes maximum since there will probably be
539 approximately 8 copies of the directory that {\bf Bacula} will cycle through. 
540
541 In addition, you will need to add the following to your Storage daemon's
542 configuration file: 
543
544 \footnotesize
545 \begin{verbatim}
546 Device {
547   Name = FileStorage
548   Media Type = File
549   Archive Device = /tmp
550   LabelMedia = yes;
551   Random Access = Yes;
552   AutomaticMount = yes;
553   RemovableMedia = no;
554   AlwaysOpen = no;
555 }
556 \end{verbatim}
557 \normalsize
558
559 With the above resources, Bacula will start a Job every half hour that saves a
560 copy of the directory you chose to /tmp/File0001 ... /tmp/File0012. After 4
561 hours, Bacula will start recycling the backup Volumes (/tmp/File0001 ...). You
562 should see this happening in the output produced. Bacula will automatically
563 create the Volumes (Files) the first time it uses them. 
564
565 To turn it off, either delete all the resources you've added, or simply
566 comment out the {\bf Schedule} record in the {\bf Job} resource. 
567
568 \subsection*{Manually Recycling Volumes}
569 \label{manualrecycling}
570 \index[general]{Volumes!Manually Recycling }
571 \index[general]{Manually Recycling Volumes }
572 \addcontentsline{toc}{subsection}{Manually Recycling Volumes}
573
574 Although automatic recycling of Volumes is implemented in version 1.20 and
575 later (see the 
576 \ilink{Automatic Recycling of Volumes}{_ChapterStart22} chapter of
577 this manual), you may want to manually force reuse (recycling) of a Volume. 
578
579 Assuming that you want to keep the Volume name, but you simply want to write
580 new data on the tape, the steps to take are: 
581
582 \begin{itemize}
583 \item Use the {\bf update volume} command in the Console to  ensure that the
584    {\bf Recycle} field is set to {\bf 1}  
585 \item Use the {\bf purge jobs volume} command in the Console  to mark the
586    Volume as {\bf Purged}. Check by using  {\bf list volumes}. 
587    \end{itemize}
588
589 Once the Volume is marked Purged, it will be recycled the next time a Volume
590 is needed. 
591
592 If you wish to reuse the tape by giving it a new name, follow the following
593 steps: 
594
595 \begin{itemize}
596 \item Use the {\bf purge jobs volume} command in the Console  to mark the
597    Volume as {\bf Purged}. Check by using  {\bf list volumes}.  
598 \item In Bacula version 1.30 or greater, use the Console  {\bf relabel}
599    command to relabel the Volume. 
600    \end{itemize}
601
602 Please note that the relabel command applies only to tape Volumes. 
603
604 For Bacula versions prior to 1.30 or to manually relabel the Volume, use the
605 instructions below: 
606
607 \begin{itemize}
608 \item Use the {\bf delete volume} command in the Console  to delete the Volume
609    from the Catalog.  
610 \item If a different tape is mounted, use the {\bf unmount}  command,
611    remove the tape, and insert the tape to be  renamed.  
612 \item Write an EOF mark in the tape using the following  commands: 
613
614    \footnotesize
615 \begin{verbatim}
616   mt -f /dev/nst0 rewind
617   mt -f /dev/nst0 weof
618 \end{verbatim}
619 \normalsize
620
621 where you replace {\bf /dev/nst0} with the appropriate  device name on your
622 system.  
623 \item Use the {\bf label} command to write a new label to  the tape and to
624    enter it in the catalog. 
625    \end{itemize}
626
627 Please be aware that the {\bf delete} command can be dangerous. Once it is
628 done, to recover the File records, you must either restore your database as it
629 was before the {\bf delete} command, or use the {\bf bscan} utility program to
630 scan the tape and recreate the database entries.