]> git.sur5r.net Git - bacula/docs/blobdiff - docs/manual/disk.tex
Update
[bacula/docs] / docs / manual / disk.tex
index 90495327d1f1db11499ce594d9b23c73a728296c..07232ab4eef0b331f22eeb05abec9bf47c958fcb 100644 (file)
@@ -1,12 +1,11 @@
 %%
 %%
 
-\section*{Basic Volume Management}
-\label{_ChapterStart39}
+\chapter{Basic Volume Management}
+\label{DiskChapter}
 \index[general]{Basic Volume Management}
 \index[general]{Management!Basic Volume}
 \index[general]{Disk Volumes}
-\addcontentsline{toc}{section}{Basic Volume Management}
 
 This chapter presents most all the features needed to do Volume management.
 Most of the concepts apply equally well to both tape and disk Volumes.
@@ -21,10 +20,9 @@ give you some of the options that are available to you so that you can manage
 either disk or tape volumes. 
 
 \label{Concepts}
-\subsection*{Key Concepts and Resource Records}
+\section{Key Concepts and Resource Records}
 \index[general]{Key Concepts and Resource Records }
 \index[general]{Records!Key Concepts and Resource }
-\addcontentsline{toc}{subsection}{Key Concepts and Resource Records}
 
 Getting Bacula to write to disk rather than tape in the simplest case is
 rather easy. In the Storage daemon's configuration file, you simply define an
@@ -75,10 +73,15 @@ Although this is quite simple, there are a number of problems. The first is
 that unless you specify otherwise, Bacula will always write to the same volume
 until you run out of disk space. This problem is addressed below.
 
-\subsubsection*{Pool Options to Limit the Volume Usage}
+In addition, if you want to use concurrent jobs that write to several
+different volumes at the same time, you will need to understand a number
+of other details. An example of such a configuration is given
+at the end of this chapter under \ilink{Concurrent Disk
+Jobs}{ConcurrentDiskJobs}.
+
+\subsection{Pool Options to Limit the Volume Usage}
 \index[general]{Usage!Pool Options to Limit the Volume }
 \index[general]{Pool Options to Limit the Volume Usage }
-\addcontentsline{toc}{subsubsection}{Pool Options to Limit the Volume Usage}
 
 Some of the options you have, all of which are specified in the Pool record,
 are: 
@@ -88,13 +91,26 @@ are:
    case), use:
 
 {\bf UseVolumeOnce = yes}. 
+
 \item To write nnn Jobs to each Volume, use:
 
    {\bf Maximum Volume Jobs = nnn}.  
+
 \item To limit the maximum size of each Volume, use:
 
    {\bf Maximum Volume Bytes = mmmm}.  
-\item To limit the use time (i.e. write the Volume for  a maximum of 5 days),
+
+   Note, if you use disk volumes, with all versions up to and including
+   1.39.28, you should probably limit the Volume size to some reasonable 
+   value such as say 5GB. This is because during a restore, Bacula is
+   currently unable to seek to the proper place in a disk volume to restore
+   a file, which means that it must read all records up to where the
+   restore begins. If your Volumes are 50GB, reading half or more of the
+   volume could take quite a bit of time.  Also, if you ever have a partial
+   hard disk failure, you are more likely to be able to recover more data
+   if they are in smaller Volumes.
+
+\item To limit the use time (i.e. write the Volume for a maximum of five days),
    use:
 
 {\bf Volume Use Duration = ttt}. 
@@ -135,10 +151,9 @@ because Bacula will want a new Volume and no one will be present to mount it,
 so no weekend backups will be done until Monday morning.
 
 \label{AutomaticLabeling}
-\subsubsection*{Automatic Volume Labeling}
+\subsection{Automatic Volume Labeling}
 \index[general]{Automatic Volume Labeling }
 \index[general]{Labeling!Automatic Volume }
-\addcontentsline{toc}{subsubsection}{Automatic Volume Labeling}
 
 Use of the above records brings up another problem -- that of labeling your
 Volumes. For automated disk backup, you can either manually label each of your
@@ -150,7 +165,7 @@ information from environment variables and special Bacula Counter variables.
 In version 1.37 and later, it is probably much better to use Python scripting 
 and the NewVolume event since generating Volume labels in a Python script is
 much easier than trying to figure out Counter variables. See the
-\ilink{Python Scripting}{_ChapterStart60} chapter of this manual for more
+\ilink{Python Scripting}{PythonChapter} chapter of this manual for more
 details.
 
 Please note that automatic Volume labeling can also be used with tapes, but
@@ -159,7 +174,7 @@ requires some user interaction.  Automatic labeling from templates does NOT
 work with autochangers since Bacula will not access unknown slots.  There
 are several methods of labeling all volumes in an autochanger magazine.
 For more information on this, please see the \ilink{
-Autochanger}{_ChapterStart18} chapter of this manual.
+Autochanger}{AutochangersChapter} chapter of this manual.
 
 Automatic Volume labeling is enabled by making a change to both the Pool
 resource (Director) and to the Device resource (Storage daemon) shown above.
@@ -183,7 +198,7 @@ Pool {
 Bacula will create Volume names Vol0001, Vol0002, and so on when new Volumes
 are needed. Much more complex and elaborate labels can be created using
 variable expansion defined in the 
-\ilink{Variable Expansion}{_ChapterStart50} chapter of this manual. 
+\ilink{Variable Expansion}{VarsChapter} chapter of this manual. 
 
 The second change that is necessary to make automatic labeling work is to give
 the Storage daemon permission to automatically label Volumes. Do so by adding
@@ -209,11 +224,9 @@ You can find more details of the {\bf Label Format} Pool record in
 records. 
 
 \label{Recycling1}
-\subsubsection*{Restricting the Number of Volumes and Recycling}
-\index[general]{Recycling!Restricting the Number of Volumes and }
-\index[general]{Restricting the Number of Volumes and Recycling }
-\addcontentsline{toc}{subsubsection}{Restricting the Number of Volumes and
-Recycling}
+\subsection{Restricting the Number of Volumes and Recycling}
+\index[general]{Recycling!Restricting the Number of Volumes and Recycling}
+\index[general]{Restricting the Number of Volumes and Recycling}
 
 Automatic labeling discussed above brings up the problem of Volume management.
 With the above scheme, a new Volume will be created every day. If you have not
@@ -265,12 +278,12 @@ following:
 The first three records (File Retention, Job Retention, and AutoPrune)
 determine the amount of time that Job and File records will remain in your
 Catalog, and they are discussed in detail in the 
-\ilink{Automatic Volume Recycling}{_ChapterStart22} chapter of
+\ilink{Automatic Volume Recycling}{RecyclingChapter} chapter of
 this manual. 
 
 Volume Retention, AutoPrune, and Recycle determine how long Bacula will keep
 your Volumes before reusing them, and they are also discussed in detail in the
-\ilink{Automatic Volume Recycling}{_ChapterStart22} chapter of
+\ilink{Automatic Volume Recycling}{RecyclingChapter} chapter of
 this manual. 
 
 The Maximum Volumes record can also be used in conjunction with the Volume
@@ -282,16 +295,61 @@ also be done by setting {\bf Recycle Oldest Volume = yes} or {\bf Recycle
 Current Volume = yes}. In this case, when Bacula needs a new Volume, it will
 prune the specified volume. 
 
+\label{ConcurrentDiskJobs}
+\section{Concurrent Disk Jobs}
+\index[general]{Concurrent Disk Jobs}
+Above, we discussed how you could have a single device named {\bf
+FileBackup} that writes to volumes in {\bf /home/bacula/backups}. 
+You can, in fact, run multiple concurrent jobs using the 
+Storage definition given with this example, and all the jobs will
+simultaneously write into the Volume that is being written.
+
+Now suppose you want to use multiple Pools, which means multiple
+Volumes, or suppose you want each client to have its own Volume
+and perhaps its own directory such as {\bf /home/bacula/client1}
+and {\bf /home/bacula/client2} ... With the single Storage and Device
+definition above, neither of these two is possible.  Why?  Because
+Bacula disk storage follows the same rules as tape devices. Only
+one Volume can be mounted on any Device at any time. If you want
+to simultaneously write multiple Volumes, you will need multiple
+Device resources in your bacula-sd.conf file, and thus multiple
+Storage resources in your bacula-dir.conf.
+
+OK, so now you should understand that you need multiple Device definitions
+in the case of different directories or different Pools, but you also 
+need to know that the catalog data that Bacula keeps contains only
+the Media Type and not the specific storage device.  This permits a tape 
+for example to be re-read on any compatible tape drive.  The compatibility
+being determined by the Media Type.  The same applies to disk storage.
+Since a volume that is written by a Device in say directory {\bf
+/home/bacula/backups}  cannot be read by a Device with an Archive Device
+definition of {\bf /home/bacula/client1}, you will not be able to
+restore all your files if you give both those devices 
+{\bf Media Type = File}. During the restore, Bacula will simply choose 
+the first available device, which may not be the correct one.  If this
+is confusing, just remember that the Directory has only the Media Type
+and the Volume name.  It does not know the {\bf Archive Device} (or the
+full path) that is specified in the Storage daemon.  Thus you must
+explicitly tie your Volumes to the correct Device by using the Media Type.
+
+The example shown below shows a case where there are two clients, each
+using its own Pool and storing their Volumes in different directories.
+
 \label{Example2}
-\subsection*{An Example}
+\section{An Example}
 \index[general]{Example }
-\addcontentsline{toc}{subsection}{Example}
 
 The following example is not very practical, but can be used to demonstrate
 the proof of concept in a relatively short period of time. The example
-consists of a single client that is backed up to a set of 12 archive files
-(Volumes). Each Volume is used (written) only once, and there are four Full
-saves done every hour (so the whole thing cycles around after three hours). 
+consists of a two clients that are backed up to a set of 12 archive files
+(Volumes) for each client into different directories on the Storage
+machine.  Each Volume is used (written) only once, and there are four Full
+saves done every hour (so the whole thing cycles around after three hours).
+
+What is key here is that each physical device on the Storage daemon 
+has a different Media Type. This allows the Director to choose the
+correct device for restores ...
 
 The Director's configuration file is as follows: 
 
@@ -306,10 +364,10 @@ Director {
 }
 Schedule {
   Name = "FourPerHour"
-  Run = Level=Full Pool=Recycle Storage=FileStorage hourly at 0:05
-  Run = Level=Full Pool=Recycle Storage=FileStorage hourly at 0:20
-  Run = Level=Full Pool=Recycle Storage=FileStorage hourly at 0:35
-  Run = Level=Full Pool=Recycle Storage=FileStorage hourly at 0:50
+  Run = Level=Full hourly at 0:05
+  Run = Level=Full hourly at 0:20
+  Run = Level=Full hourly at 0:35
+  Run = Level=Full hourly at 0:50
 }
 Job {
   Name = "RecycleExample"
@@ -322,6 +380,19 @@ Job {
   Pool = Recycle
   Schedule = FourPerHour
 }
+
+Job {
+  Name = "RecycleExample2"
+  Type = Backup
+  Level = Full
+  Client = Roxie
+  FileSet= "Example FileSet"
+  Messages = Standard
+  Storage = FileStorage1
+  Pool = Recycle1
+  Schedule = FourPerHour
+}
+
 FileSet {
   Name = "Example FileSet"
   Include = compression=GZIP signature=SHA1 {
@@ -334,6 +405,14 @@ Client {
   Catalog = BackupDB
   Password = client_password
 }
+
+Client {
+  Name = Roxie
+  Address = roxie
+  Catalog = BackupDB
+  Password = client1_password
+}
+
 Storage {
   Name = FileStorage
   Address = rufus
@@ -341,6 +420,15 @@ Storage {
   Device = RecycleDir
   Media Type = File
 }
+
+Storage {
+  Name = FileStorage1
+  Address = rufus
+  Password = local_storage_password
+  Device = RecycleDir1
+  Media Type = File1
+}
+
 Catalog {
   Name = BackupDB
   dbname = bacula; user = bacula; password = ""
@@ -353,12 +441,24 @@ Pool {
   Name = Recycle
   Use Volume Once = yes
   Pool Type = Backup
-  LabelFormat = "Vol"
+  LabelFormat = "Recycle-"
   AutoPrune = yes
   VolumeRetention = 2h
   Maximum Volumes = 12
   Recycle = yes
 }
+
+Pool {
+  Name = Recycle1
+  Use Volume Once = yes
+  Pool Type = Backup
+  LabelFormat = "Recycle1-"
+  AutoPrune = yes
+  VolumeRetention = 2h
+  Maximum Volumes = 12
+  Recycle = yes
+}
+
 \end{verbatim}
 \normalsize
 
@@ -386,6 +486,18 @@ Device {
   RemovableMedia = no;
   AlwaysOpen = no;
 }
+
+Device {
+  Name = RecycleDir1
+  Media Type = File1
+  Archive Device = /home/bacula/backups1
+  LabelMedia = yes;
+  Random Access = Yes;
+  AutomaticMount = yes;
+  RemovableMedia = no;
+  AlwaysOpen = no;
+}
+
 Messages {
   Name = Standard
   director = my-dir = all
@@ -393,20 +505,13 @@ Messages {
 \end{verbatim}
 \normalsize
 
-In this example, the Jobs will be backed up to directory {\bf
-/home/bacula/backups} with Volume names Vol0001, Vol0002, ... Vol0012. Every
-backup Job will write a new volume cycling through the volume numbers, and two
-hours after a job has started, the volume will be pruned {\bf Volume Retention
-= 2h}. 
-
 With a little bit of work, you can change the above example into a weekly or
 monthly cycle (take care about the amount of archive disk space used). 
 
 \label{MultipleDisks}
-\subsection*{Backing up to Multiple Disks}
+\section{Backing up to Multiple Disks}
 \index[general]{Disks!Backing up to Multiple }
 \index[general]{Backing up to Multiple Disks }
-\addcontentsline{toc}{subsection}{Backing up to Multiple Disks}
 
 Bacula can, of course, use multiple disks, but in general, each disk must be a
 separate Device specification in the Storage daemon's conf file, and you must
@@ -464,11 +569,11 @@ as much as it can. This means that you can only have a single Volume
 mounted at one time on a disk as defined in your Device resource in
 the Storage daemon's conf file.  You can have multiple concurrent 
 jobs running that all write to the one Volume that is being used, but
-if you want to have multiple concurrent jobs that are writting to
+if you want to have multiple concurrent jobs that are writing to
 separate disks drives (or partitions), you will need to define 
 separate Device resources for each one, exactly as you would do for
 two different tape drives.  There is one fundamental difference, however.
-The Volumes that you creat on the two drives cannot be easily exchanged
+The Volumes that you create on the two drives cannot be easily exchanged
 as they can for a tape drive, because they are physically resident (already
 mounted in a sense) on the particular drive.  As a consequence, you will
 probably want to give them different Media Types so that Bacula can
@@ -508,10 +613,9 @@ Media Types will allow Bacula to quickly choose the correct
 Storage resource in the Director when doing a restore.
 
 \label{MultipleClients}
-\subsection*{Considerations for Multiple Clients}
+\section{Considerations for Multiple Clients}
 \index[general]{Clients!Considerations for Multiple }
-\index[general]{Considerations for Multiple Clients }
-\addcontentsline{toc}{subsection}{Considerations for Multiple Clients}
+\index[general]{Multiple Clients}
 
 If we take the above example and add a second Client, here are a few
 considerations: 
@@ -591,20 +695,21 @@ Client {
   Catalog = BackupDB
   Password = client2_password
 }
-# Two Storage definitions permits different directories
+# Two Storage definitions with different Media Types
+#  permits different directories
 Storage {
   Name = File1
   Address = rufus
   Password = local_storage_password
   Device = client1
-  Media Type = File
+  Media Type = File1
 }
 Storage {
   Name = File2
   Address = rufus
   Password = local_storage_password
   Device = client2
-  Media Type = File
+  Media Type = File2
 }
 Catalog {
   Name = BackupDB
@@ -657,7 +762,7 @@ Director {
 # Archive directory for Client1
 Device {
   Name = client1
-  Media Type = File
+  Media Type = File1
   Archive Device = /home/bacula/client1
   LabelMedia = yes;
   Random Access = Yes;
@@ -668,7 +773,7 @@ Device {
 # Archive directory for Client2
 Device {
   Name = client2
-  Media Type = File
+  Media Type = File2
   Archive Device = /home/bacula/client2
   LabelMedia = yes;
   Random Access = Yes;