\index[general]{Automatic Volume Recycling }
\addcontentsline{toc}{section}{Automatic Volume Recycling}
-Normally, Bacula will write on a volume, and once the tape is written, it can
-append to the volume, but it will never overwrite the data thus destroying it.
-When we speak of {\bf recycling} volumes, we mean that {\bf Bacula} can write
-over the previous contents of a volume. Thus all previous data will be lost.
-
-You may not want Bacula to automatically recycle (reuse) tapes. This requires
-a large number of tapes, and in such a case, it is possible to manually
-recycle tapes. For more on manual recycling, see the section entitled
-\ilink{ Manually Recycling Volumes}{manualrecycling} below in
-this chapter.
+By default, once Bacula starts writing a Volume, it can
+append to the volume, but it will not overwrite the existing
+data thus destroying it.
+However when Bacula {\bf recycles} a Volume, the Volume becomes
+available for being reused, and Bacula can at some later time
+over write the previous contents of that Volume.
+Thus all previous data will be lost. If the Volume is a tape,
+the tape will be rewritten from the beginning. If the Volume is
+a disk file, the file will be truncated before being rewritten.
+
+You may not want Bacula to automatically recycle (reuse) tapes. This would
+require a large number of tapes though, and in such a case, it is possible
+to manually recycle tapes. For more on manual recycling, see the section
+entitled \ilink{ Manually Recycling Volumes}{manualrecycling} below in this
+chapter.
Most people prefer to have a Pool of tapes that are used for daily backups and
recycled once a week, another Pool of tapes that are used for Full backups
once a week and recycled monthly, and finally a Pool of tapes that are used
-once a month and recycled after a year or two. With a scheme like this, your
-pool of tapes remains constant.
+once a month and recycled after a year or two. With a scheme like this, the
+number of tapes in your pool or pools remains constant.
By properly defining your Volume Pools with appropriate Retention periods,
Bacula can manage the recycling (such as defined above) automatically.
Automatic recycling of Volumes is controlled by three records in the {\bf
Pool} resource definition in the Director's configuration file. These three
-records are: {\bf
+records are:
\begin{itemize}
\item AutoPrune = yes
\item Recycle = yes
\end{itemize}
-} Automatic recycling of Volumes is performed by Bacula only when it wants a
+Automatic recycling of Volumes is performed by Bacula only when it wants a
new Volume and no appendable Volumes are available in the Pool. It will then
search the Pool for any Volumes with the {\bf Recycle} flag set and whose
Volume Status is {\bf Full}. At that point, the recycling occurs in two steps.
expired. When a Volume is marked as Purged, it means that no Catalog records
reference that Volume, and the Volume can be recycled. Until recycling
actually occurs, the Volume data remains intact. If no Volumes can be found
-for recycline for any of the reasons stated above, Bacula will request
+for recycling for any of the reasons stated above, Bacula will request
operator intervention (i.e. it will ask you to label a new volume).
-A key point mentioned above that can be a source of frustration is that Bacula
+A key point mentioned above, that can be a source of frustration, is that Bacula
will only recycle purged Volumes if there is no other appendable Volume
available, otherwise, it will always write to an appendable Volume before
recycling even if there are Volume marked as Purged. This preserves your data
-as long as possible. So, if you wish to ``force'' Bacula to use a purged
+as long as possible. So, if you wish to "force" Bacula to use a purged
Volume, you must first ensure that no other Volume in the Pool is marked {\bf
Append}. If necessary, you can manually set a volume to {\bf Full}. The reason
for this is that Bacula wants to preserve the data on your old tapes (even
though purged from the catalog) as long as absolutely possible before
overwriting it.
-\label{AutoPruning}
+\label{AutoPruning}
\subsection*{Automatic Pruning}
\index[general]{Automatic Pruning }
\index[general]{Pruning!Automatic }
cannot use the Console restore command to restore the files.
When a Job record is pruned, the Volume (Media record) for that Job can still
-remain in the database, and if you do a ``list volumes'', you will see the
+remain in the database, and if you do a "list volumes", you will see the
volume information, but the Job records (and its File records) will no longer
be available.
also prevents the catalog from growing to be too large. You choose the
retention periods in function of how many files you are backing up and the
time periods you want to keep those records online, and the size of the
-database.You can always re-insert the records (with 98\% of the original data)
-by using ``bscan'' to scan in a whole Volume or any part of the volume that
+database. You can always re-insert the records (with 98\% of the original data)
+by using "bscan" to scan in a whole Volume or any part of the volume that
you want.
By setting {\bf AutoPrune} to {\bf yes} you will permit {\bf Bacula} to
automatically prune all Volumes in the Pool when a Job needs another Volume.
Volume pruning means removing records from the catalog. It does not shrink the
-size of the Volume or effect the Volume data until the Volume gets
+size of the Volume or affect the Volume data until the Volume gets
overwritten. When a Job requests another volume and there are no Volumes with
Volume Status {\bf Append} available, Bacula will begin volume pruning. This
means that all Jobs that are older than the {\bf VolumeRetention} period will
\item [AutoPrune = \lt{}yes|no\gt{}]
\index[console]{AutoPrune }
- If AutoPrune is set to {\bf yes} (default), Bacula (version 1.20 or greater)
-will automatically apply the Volume retention period when running a Job and
-it needs a new Volume but no appendable volumes are available. At that point,
-Bacula will prune all Volumes that can be pruned (i.e. AutoPrune set) in an
-attempt to find a usable volume. If during the autoprune, all files are
-pruned from the Volume, it will be marked with VolStatus {\bf Purged}. The
-default is {\bf yes}.
+ If AutoPrune is set to {\bf yes} (default), Bacula
+ will automatically apply the Volume retention period when running a Job and
+ it needs a new Volume but no appendable volumes are available. At that point,
+ Bacula will prune all Volumes that can be pruned (i.e. AutoPrune set) in an
+ attempt to find a usable volume. If during the autoprune, all files are
+ pruned from the Volume, it will be marked with VolStatus {\bf Purged}. The
+ default is {\bf yes}. Note, that although the File and Job records may be
+ pruned from the catalog, a Volume will be marked Purged (and hence
+ ready for recycling) if the Volume status is Append, Full, Used, or Error.
+ If the Volume has another status, such as Archive, Read-Only, Disabled,
+ Busy, or Cleaning, the Volume status will not be changed to Purged.
\item [Volume Retention = \lt{}time-period-specification\gt{}]
\index[console]{Volume Retention }
The Volume Retention record defines the length of time that Bacula will
-guarantee that the Volume is not reused counting from the time the last job
-stored on the Volume terminated.
-
-When this time period expires, and if {\bf AutoPrune} is set to {\bf yes},
-and a new Volume is needed, but no appendable Volume is available, Bacula
-will prune (remove) Job records that are older than the specified Volume
-Retention period.
-
-The Volume Retention period takes precedence over any Job Retention period
-you have specified in the Client resource. It should also be noted, that the
-Volume Retention period is obtained by reading the Catalog Database Media
-record rather than the Pool resource record. This means that if you change
-the VolumeRetention in the Pool resource record, you must ensure that the
-corresponding change is made in the catalog by using the {\bf update pool}
-command. Doing so will insure that any new Volumes will be created with the
-changed Volume Retention period. Any existing Volumes will have their own
-copy of the Volume Retention period that can only be changed on a Volume by
-Volume basis using the {\bf update volume} command.
-
-When all file catalog entries are removed from the volume, its VolStatus is
-set to {\bf Purged}. The files remain physically on the Volume until the
-volume is overwritten.
-
-Retention periods are specified in seconds, minutes, hours, days, weeks,
-months, quarters, or years on the record. See the
-\ilink{Configuration chapter}{Time} of this manual for
-additional details of time specification.
+ guarantee that the Volume is not reused counting from the time the last job
+ stored on the Volume terminated.
+
+ When this time period expires, and if {\bf AutoPrune} is set to {\bf yes},
+ and a new Volume is needed, but no appendable Volume is available, Bacula
+ will prune (remove) Job records that are older than the specified Volume
+ Retention period.
+
+ The Volume Retention period takes precedence over any Job Retention period
+ you have specified in the Client resource. It should also be noted, that the
+ Volume Retention period is obtained by reading the Catalog Database Media
+ record rather than the Pool resource record. This means that if you change
+ the VolumeRetention in the Pool resource record, you must ensure that the
+ corresponding change is made in the catalog by using the {\bf update pool}
+ command. Doing so will insure that any new Volumes will be created with the
+ changed Volume Retention period. Any existing Volumes will have their own
+ copy of the Volume Retention period that can only be changed on a Volume by
+ Volume basis using the {\bf update volume} command.
+
+ When all file catalog entries are removed from the volume, its VolStatus is
+ set to {\bf Purged}. The files remain physically on the Volume until the
+ volume is overwritten.
+
+ Retention periods are specified in seconds, minutes, hours, days, weeks,
+ months, quarters, or years on the record. See the
+ \ilink{Configuration chapter}{Time} of this manual for
+ additional details of time specification.
The default is 1 year.
\item [Recycle = \lt{}yes|no\gt{}]
\index[fd]{Recycle }
This statement tells Bacula whether or not the particular Volume can be
-recycled (i.e. rewritten). If Recycle is set to {\bf no} (the default), then
-even if Bacula prunes all the Jobs on the volume and it is marked {\bf
-Purged}, it will not consider the tape for recycling. If Recycle is set to
-{\bf yes} and all Jobs have been pruned, the volume status will be set to
-{\bf Purged} and the volume may then be reused when another volume is needed.
-If the volume is reused, it is relabeled with the same Volume Name, however
-all previous data will be lost.
-\end{description}
-
-Note, it is also possible to ``force'' pruning of all Volumes in the Pool
-associated with a Job by adding {\bf Prune Files = yes} to the Job resource.
-\label{Recycling}
+ recycled (i.e. rewritten). If Recycle is set to {\bf no} (the default), then
+ even if Bacula prunes all the Jobs on the volume and it is marked {\bf
+ Purged}, it will not consider the tape for recycling. If Recycle is set to
+ {\bf yes} and all Jobs have been pruned, the volume status will be set to
+ {\bf Purged} and the volume may then be reused when another volume is needed.
+ If the volume is reused, it is relabeled with the same Volume Name, however
+ all previous data will be lost.
+ \end{description}
+
+ It is also possible to "force" pruning of all Volumes in the Pool
+ associated with a Job by adding {\bf Prune Files = yes} to the Job resource.
+\label{Recycling}
\subsection*{Recycling Algorithm}
\index[general]{Algorithm!Recycling }
\index[general]{Recycling Algorithm }
and if the {\bf Recycle} flag is on (Recycle=yes) for that Volume, Bacula will
relabel it and write new data on it.
-The full recycling algorithm that Bacula uses when it needs a new Volume is:
+The full algorithm that Bacula uses when it needs a new Volume is:
\begin{itemize}
-\item Search the Pool for a Volume with VolStatus=Append (if there is more
- than one, the Volume with the oldest date last written is chosen. If two have
- the same date then the one with the lowest MediaId is chosen).
-\item Search the Pool for a Volume with VolStatus=Recycle (if there is more
- than one, the Volume with the oldest date last written is chosen. If two have
- the same date then the one with the lowest MediaId is chosen).
+\item Search the Pool for a Volume with VolStatus=Append (if there is more
+ than one, the Volume with the oldest date last written is chosen. If
+ two have the same date then the one with the lowest MediaId is chosen).
+\item Search the Pool for a Volume with VolStatus=Recycle and the InChanger
+ flag is set true (if there is more than one, the Volume with the oldest
+ date last written is chosen. If two have the same date then the one
+ with the lowest MediaId is chosen).
+\item Try recycling any purged Volumes.
\item Prune volumes applying Volume retention period (Volumes with VolStatus
Full, Used, or Append are pruned).
\item Search the Pool for a Volume with VolStatus=Purged
+\item If InChanger was set, go back to the first step above, but
+ this second time, ignore the InChanger flag in step 2.
\item Attempt to create a new Volume if automatic labeling enabled
+ If Python is enabled, a Python NewVolume even is generated before
+ the Label Format check is used.
+\item If a Pool named "Scratch" exists, search for a Volume and if found
+ move it to the current Pool for the Job and use it.
\item Prune the oldest Volume if RecycleOldestVolume=yes (the Volume with the
oldest LastWritten date and VolStatus equal to Full, Recycle, Purged, Used,
or Append is chosen). This record ensures that all retention periods are
-properly respected.
+ properly respected.
\item Purge the oldest Volume if PurgeOldestVolume=yes (the Volume with the
oldest LastWritten date and VolStatus equal to Full, Recycle, Purged, Used,
or Append is chosen). We strongly recommend against the use of {\bf
-PurgeOldestVolume} as it can quite easily lead to loss of current backup
-data.
+ PurgeOldestVolume} as it can quite easily lead to loss of current backup
+ data.
\item Give up and ask operator.
- \end{itemize}
+\end{itemize}
The above occurs when Bacula has finished writing a Volume or when no Volume
is present in the drive.
the Director to use this Volume. In this case, if you have set {\bf Recycle
Current Volume = yes} and the Volume is marked as Used or Full, Bacula will
prune the volume and if all jobs were removed during the pruning (respecting
-the retention periods), the Volume will be recycled and used. For this to
-work, you must have {\bf Accept Any Volume = yes} in the Pool. The recycling
-algorithm in this case is:
+the retention periods), the Volume will be recycled and used.
+The recycling algorithm in this case is:
\begin{itemize}
\item If the VolStatus is {\bf Append} or {\bf Recycle} and {\bf Accept Any
Each Volume inherits the Recycle status (yes or no) from the Pool resource
record when the Media record is created (normally when the Volume is labeled).
-This Recycle status is stored in the Media record of the Catalog. Using the
+This Recycle status is stored in the Media record of the Catalog. Using
the Console program, you may subsequently change the Recycle status for each
Volume. For example in the following output from {\bf list volumes}:
all the volumes are marked as recyclable, and the last Volume, {\bf File0007}
has been purged, so it may be immediately recycled. The other volumes are all
marked recyclable and when their Volume Retention period (14400 seconds or 4
-hours) expires, they will be eligible for pruning, and possible recycling.
+hours) expires, they will be eligible for pruning, and possibly recycling.
Even though Volume {\bf File0007} has been purged, all the data on the Volume
is still recoverable. A purged Volume simply means that there are no entries
in the Catalog. Even if the Volume Status is changed to {\bf Recycle}, the
the next day when you notice the email message, you will mount it and {\bf
Bacula} will finish the unfinished incremental backup.
-What does this give? Well, at any point, you will have a the last complete
-Full save plus several Incremental saves. For any given file your want to
+What does this give? Well, at any point, you will have the last complete
+Full save plus several Incremental saves. For any given file you want to
recover (or your whole system), you will have a copy of that file every day
for at least the last 14 days. For older versions, you will have at least 3
and probably 4 Friday full saves of that file, and going back further, you
{\bf Recycle} field is set to {\bf 1}
\item Use the {\bf purge jobs volume} command in the Console to mark the
Volume as {\bf Purged}. Check by using {\bf list volumes}.
- \end{itemize}
+\end{itemize}
Once the Volume is marked Purged, it will be recycled the next time a Volume
is needed.
Volume as {\bf Purged}. Check by using {\bf list volumes}.
\item In Bacula version 1.30 or greater, use the Console {\bf relabel}
command to relabel the Volume.
- \end{itemize}
+\end{itemize}
Please note that the relabel command applies only to tape Volumes.
\begin{itemize}
\item Use the {\bf delete volume} command in the Console to delete the Volume
from the Catalog.
-\item If the a different tape is mounted, use the {\bf unmount} command,
+\item If a different tape is mounted, use the {\bf unmount} command,
remove the tape, and insert the tape to be renamed.
\item Write an EOF mark in the tape using the following commands:
- \footnotesize
+\footnotesize
\begin{verbatim}
mt -f /dev/nst0 rewind
mt -f /dev/nst0 weof
system.
\item Use the {\bf label} command to write a new label to the tape and to
enter it in the catalog.
- \end{itemize}
+\end{itemize}
Please be aware that the {\bf delete} command can be dangerous. Once it is
done, to recover the File records, you must either restore your database as it