| 1 |
\chapter{Volumes}\label{chap:volumes} |
| 2 |
|
| 3 |
Bacula manages all its storage compartments -- Volumes in our terminology -- in Pools. In particular, a Job is not configured to write to any particular Volume, but to a set of Volumes called a Pool. |
| 4 |
Volumes of Bacula are always members of only one Pool. There can however be multiple pools. |
| 5 |
Accordingly, we present the conceptual overview here starting with the higher-level Pool view. |
| 6 |
|
| 7 |
\section{The ``Pool''} |
| 8 |
\subsection{The Concept} |
| 9 |
Pools in Bacula are just a way to manage volumes and to manage collections of similar volumes. The following are just examples and you might have either different requirements or even no requirement to separate volumes into several pools: |
| 10 |
\begin{bitemize} |
| 11 |
\item Pools ``short-term'' and ``long-term'' to handle short and long retention periods. |
| 12 |
\item Pools ``big-customer'' and ``usual-customers'' to keep all the backup jobs from your client ``Big Customer'' in a specific pool while putting all ``usual'' customers into another one. |
| 13 |
\item Pools ``r-and-d'' and ``accounting'' to keep R\&D backups together and the Accounting ones in another pool, separated from each other. |
| 14 |
\end{bitemize} |
| 15 |
There can be many reasons to use or not use several pools; the Bacula configuration gives the Backup Administrator the ability to match the defined requirements. |
| 16 |
|
| 17 |
Due to how Bacula manages Volume Retention periods, the jobs put into the same pool should have the same retention periods. |
| 18 |
|
| 19 |
\subsection{Pool Types} |
| 20 |
Bacula allows several kinds of pools including\footnote{Listed in the logical order}: |
| 21 |
\begin{bitemize} |
| 22 |
\item Scratch |
| 23 |
\item Backup |
| 24 |
\item Recycle |
| 25 |
\end{bitemize} |
| 26 |
A \emph{Scratch} pool contains volumes that may be with any pool. If no volumes are available for a particular pool Bacula will look in the Scratch pool and move the volume to the pool in question. |
| 27 |
|
| 28 |
A \emph{Backup} pool contains volumes intended to keep data from backups for a defined retention period. It can also include Recycled or Purged volumes, i.\,e. Volumes that are eligible to be overwritten. |
| 29 |
|
| 30 |
A \emph{Recycle} pool contains volumes after the purging process freed them, \textbf{after} they have been used in a \emph{Backup} pool. |
| 31 |
|
| 32 |
The Bacula configuration allows the Administrator to attach a \emph{Scratch} Pool and a \emph{Recycle} Pool to a \emph{Backup} pool. The volume cycle management process is described by the figure~\vref{fig:volume-cycle}. |
| 33 |
|
| 34 |
\bimageH[\linewidth]{bee8-volume-cycling}{Volume Cycling Process}{fig:volume-cycle} |
| 35 |
%% \begin{figure} |
| 36 |
%% \begin{center} |
| 37 |
%% \includegraphics[width=\linewidth]{bee8-volume-cycling} |
| 38 |
%% \caption{Volume Cycling Process}\label{fig:volume-cycle} |
| 39 |
%% \end{center} |
| 40 |
%% \end{figure} |
| 41 |
The following example is a pool definition to manage Volumes for day-to-day incremental backup jobs: |
| 42 |
\begin{bVerbatim} |
| 43 |
# Pool to handle day-to-day backup jobs |
| 44 |
Pool { |
| 45 |
Name = PoolFile |
| 46 |
Pool Type = Backup |
| 47 |
Recycle = yes |
| 48 |
AutoPrune = yes |
| 49 |
Volume Retention = 15 days |
| 50 |
Label Format = "file-" |
| 51 |
# Auto-labeling new volumes |
| 52 |
Action on Purge = Truncate |
| 53 |
# Backup to disk. We get back the space ASAP. |
| 54 |
Next Pool = PoolVFull |
| 55 |
# This is the pool where Virtual Full will take place |
| 56 |
Storage = t-disk |
| 57 |
Volume Use Duration = 23h |
| 58 |
# Low duration time, better volume retention period. |
| 59 |
Maximum Volumes = 750 |
| 60 |
Maximum Volume Bytes = 1GB |
| 61 |
# Small volumes. A lot of them. This is for incrementals. |
| 62 |
} |
| 63 |
\end{bVerbatim} |
| 64 |
In the next example you will find a pool definition to keep the Virtual Full backups for the previously described incremental backup jobs: |
| 65 |
\begin{bVerbatim} |
| 66 |
# |
| 67 |
# Virtual Full in this pool |
| 68 |
Pool { |
| 69 |
Name = PoolVFull |
| 70 |
Pool Type = Backup |
| 71 |
Recycle = yes |
| 72 |
AutoPrune = yes |
| 73 |
Volume Retention = 20 days |
| 74 |
Label Format = "file-vfull-" |
| 75 |
# Auto-labeling new volumes |
| 76 |
Action on Purge = Truncate |
| 77 |
# Backup to disk. We get back the space ASAP. |
| 78 |
Next Pool = PoolRDX |
| 79 |
# This is the pool where Copy jobs will be sent |
| 80 |
Storage = t-migrate |
| 81 |
Volume Use Duration = 23h |
| 82 |
# Low duration time, better volume retention period. |
| 83 |
Maximum Volume Bytes = 10GB |
| 84 |
Maximum Volumes = 20 |
| 85 |
# Few volumes, bigger than the incremental ones. For ``Full'' (VF) purpose. |
| 86 |
} |
| 87 |
\end{bVerbatim} |
| 88 |
And below, we show a pool definition to store the Copy volumes for the previous Full backup jobs: |
| 89 |
\begin{bVerbatim} |
| 90 |
# |
| 91 |
# Copy of Fulls in this pool |
| 92 |
Pool { |
| 93 |
Name = PoolRDX |
| 94 |
Pool Type = Backup |
| 95 |
Recycle = yes |
| 96 |
AutoPrune = yes |
| 97 |
Volume Retention = 40 days |
| 98 |
Action on Purge = Truncate |
| 99 |
# Backup to disks. We get back the space ASAP. |
| 100 |
Volume Use Duration = 20h |
| 101 |
# Low duration time, better volume retention period. |
| 102 |
Storage = t-rdx |
| 103 |
Maximum Volume Bytes = 20GB |
| 104 |
# 320GB RDX removable disk. 20GB per RDX volume. |
| 105 |
} |
| 106 |
\end{bVerbatim} |
| 107 |
% |
| 108 |
\section{Media Type} |
| 109 |
Even if Media Types may be used for several different reasons with Bacula, you must use them when dealing with several storages or several locations on the same storage.\par |
| 110 |
In particular when Bacula is searching for a volume to be used for a backup, it will go through the available volumes. A Bacula job uses a distinct Storage device and the volume selection must be restricted to the actually available volumes. For example, it is quite common to see different disk storage arrays, mounted at different mount points and used by different storage devices, where volumes located in one directory are not available through the other storage device. |
| 111 |
|
| 112 |
More obvious (and less easy to fix!) is a case of mixed media -- for example, a disk storage device will never be able to write to a physical tape. So, all storage devices that cannot share their media must use distinct Media Types. |
| 113 |
|
| 114 |
\section{Storage Capacity Management} |
| 115 |
If you want to overwrite a backup you need to overwrite the corresponding volume(s). Additionally, to be able to reuse a Volume, its retention period should first be expired. |
| 116 |
|
| 117 |
\subsection{Volume Retention}\label{par:volume-retention} |
| 118 |
The Volume retention period is defined as the time Bacula will not overwrite a Volume after it was last written to. |
| 119 |
Therefore, if you keep writing to a volume with a retention period of seven days for six months, your volume will not be overwritten for a total of 187~days -- perhaps even more: remember that Bacula will try to keep your data safe for as long as possible. |
| 120 |
|
| 121 |
\subsection{Limiting the Volume Size} |
| 122 |
\subsubsection{Tapes} |
| 123 |
On tapes, we usually don't need to explicitly limit the volume size, because the volume is identical to the tape which has a limited and defined maximum capacity. |
| 124 |
|
| 125 |
\subsubsection{Disks} |
| 126 |
On disks, on the other hand, as volumes are handled with files, there is a risk of filling the disk with only one volume, so we need to limit the volume size and number of volumes. We explained above how the volume retention periods are handled by Bacula. However, often we need to get back our volumes as soon as possible to be able to reuse the storage space they are using during their retention periods. In the previous case (see chapter~\vref{par:volume-retention}) we should have restricted the use duration of the Volume. |
| 127 |
|
| 128 |
There are several directives available to limit the occupied storage space in a Pool: |
| 129 |
\begin{bitemize} |
| 130 |
\item Maximum Volumes: the pool will contain at most this number of volumes |
| 131 |
\item Maximum Volume Bytes: a volume won't have a size above this value, even if it handles concurrent jobs |
| 132 |
\item Maximum Volume Jobs: this is a way to limit a volume usage duration. As soon as the volume contains this number of jobs, Bacula will refuse to use it and will use another one |
| 133 |
\item Maximum Use Duration: this is also a way to limit the use duration of a volume. |
| 134 |
\end{bitemize} |
| 135 |
These limitations can be managed manually (by the Administrator with console commands) or automatically (through scripts or Admin jobs, for example). |
| 136 |
|
| 137 |
\subsection{Space Management} |
| 138 |
As we already noted, Bacula will try to keep your data safe as long as possible. This means that you can be in a situation (disk backups only) where your storage space is too small even if you defined correct retention periods. In such cases, you can use the ``Action on Purge'' directive requesting Bacula to actually \texttt{truncate} the disk volumes and thus to get back the corresponding storage space freed by the truncate. |
| 139 |
%overwriting backups => overwriting volumes |
| 140 |
%same retention on ``similar'' volumes |
| 141 |
%how to limit size and number |
| 142 |
%tapes: ok by nature |
| 143 |
% |
| 144 |
%disks volumes: administrator has to prepare the configuration to limit how much data on a volume and how many volumes we want to have |
| 145 |
% |
| 146 |
%space management |
| 147 |
\section{Volumes and Pool Modifications} |
| 148 |
Because of its great flexibility, Bacula can be puzzling. Let's say you defined Maximum Volume Bytes to 10\,GB and then realize that you want to move it to 15\,GB. Then you will modify your ``Pool'' resource definition. This is correct and will work for all new volumes created into the Pool. But the existing volumes are not modified by this change. To update the existing volumes already in the Pool with the new values you must update the existing volumes' meta-data: |
| 149 |
\begin{bitemize} |
| 150 |
\item In \btool{bconsole}, enter the \bcommand{update volume} and answer the subsequent questions Bacula will ask, or |
| 151 |
\item use \bcommand{update volume allfrompool=the-pool-name}, or |
| 152 |
\item use one of the graphical interfaces. |
| 153 |
\end{bitemize} |