\index[general]{New Volume Algorithm}
\index[general]{Algorithm!New Volume}
+The algorithm described below assumes that AutoPrune is enabled,
+that Recycling is turned on, and that you have defined
+appropriate Retention periods, or used the defaults for all these
+items.
+
\begin{itemize}
+\item If the request is for an Autochanger device, look only
+ for Volumes in the Autochanger (i.e. with InChanger set and that have
+ the correct Storage device).
\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 If the current device is an Autochanger, search the Scratch
- Pool for a Volume that is in the Autochanger. If found, move
- it to the correct Pool.
\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).
+ 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 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.
+ move it to the current Pool for the Job and use it. Note, when
+ the Scratch Volume is moved into the current Pool, the basic
+ Pool defaults are applied as if it is a newly labeled Volume
+ (equivalent to an {\bf update volume from pool} command).
+\item If we were looking for Volumes in the Autochanger, go back to
+ step 2 above, but this time, look for any Volume whether or not
+ it is in the Autochanger.
\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.
+ If Python is enabled, a Python NewVolume event is generated before
+ the Label Format directve is used.
\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
In this case, {\bf File0001} will never be automatically recycled. The same
effect can be achieved by setting the Volume Status to Read-Only.
+As you have noted, the Volume Status (VolStatus) colume in the
+catalog database contains the current status of the Volume, which
+is normally maintained automatically by Bacula. To give you an
+idea of some of the values it can take during the life cycle of
+a Volume, here is a picture created by Arno Lehmann:
+
+\footnotesize
+\begin{verbatim}
+A typical volume life cycle is like this:
+
+ because job count or size limit exceeded
+ Append ----------------------------------------> Used
+ ^ |
+ | First Job writes to Retention time passed |
+ | the volume and recycling takes |
+ | place |
+ | v
+ Recycled <-------------------------------------- Purged
+ Volume is selected for reuse
+
+\end{verbatim}
+\normalsize
+
+
\subsection*{Making Bacula Use a Single Tape}
\label{singletape}
\index[general]{Tape!Making Bacula Use a Single}