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