Volume Management
CommunityEnterpriseLimiting Volume Size
When Bacula writes to a disk, Bacula treats that disk much like a tape. For example, unless you have either defined some limitation to writing into a disk Volume, Bacula will continue writing until the Volume totally fills the space on the disk partition that contains that Volume, which is not very desirable, as it effectively prevents Bacula from reusing volumes when the data on them is older than the configured retention time.
There are a number of different ways to limit the size of a given disk Volume: by the number of Jobs, by the time the Volume is used, by the Volume size, or by some other criteria. In this design document we will generally either restrict a Volume size by the number of Jobs written to the Volume or by the Volume Size.
Most of the different ways to limit the Volume size are defined in the Pool resource of the bacula-dir.conf file. There are many options, but the most commonly used ones are:
Volume Use Duration
Maximum Volume Jobs
Maximum Volume Bytes
Setting Volume Use Duration to 12 or 23 hours, and
Maximum Volume Bytes to between 10 and 50 GB is probably a
reasonable choice for most sites, as in the example below:
Pool {
Name = Default
Pool Type = Backup
Recycle = yes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365d # one year
Label Format = Vol- # Allow to auto label
Action On Purge = Truncate # Allow to volume truncation
Volume Use Duration = 14h # Force volume switch
Maximum Volume Bytes = 50GB # Limit volume size
Maximum Volumes = 100 # allow 5TB for this Pool
Maximum Volume Jobs = 100 # Force a Volume switch after 100 Jobs
}
If you change the values in the Pool definition the new values will apply to any new Volumes that you create. If you want your old existing Volumes to use the new values, you must explicitly do so with the:
update volume FromAllPools
As mentioned above, each of those directives is specified in the Pool or Pools that you use for your Volumes. In the case of Maximum Volume Job, Maximum Volume Bytes, and Volume Use Duration, you can actually specify the desired value on a Volume by Volume basis. The value specified in the Pool record becomes the default when labeling new Volumes. Once a Volume has been created, it gets its own copy of the Pool defaults, and subsequently changing the Pool will have no effect on existing Volumes. You can either manually change the Volume values, or refresh them from the Pool defaults using the update volume command in the Console. As an example of the use of one of the above, suppose your Pool resource contains:
Pool {
Name = Disk-pool
Pool Type = Backup
Volume Use Duration = 23h
}
then if you run a backup once a day (every 24 hours), Bacula will use a new Volume for each backup, because each Volume it writes can only be used for 23 hours after the first write.
Creating New Volumes
In disk based backup configurations, you may want to let Bacula create
new volumes when needed. For that, you can add the Label Format
option to all your Pool resources in the bacula-dir.conf file, and
configure your Storage daemon (SD) devices in the file bacula-sd.conf to
label new volumes automatically (Label Media = Yes). When using
these directives, you may also want to limit the number of Volumes that
can be created with the Maximum Volumes Pool option to avoid
creating too many Volumes if something goes wrong with pruning (not
mandatory if you schedule a pruning job).
Automatic Volume Labeling
For automated disk backup, you can either manually label each of your Volumes, or you can have Bacula automatically label new Volumes when they are needed. Automatic Volume labeling permit automatic creation of a wide variety of labels including information from environment variables and special Bacula Counter variables.
Please note that automatic Volume labeling can also be used with tapes, but it is not nearly so practical since the tapes must be pre-mounted. This 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, read the section about Autochanger Support.
Automatic Volume labeling is enabled by making a change to both the Pool resource (Director) and to the Device resource (Storage daemon) shown below. In the case of the Pool resource, you must provide Bacula with a label format that it will use to create new names. In the simplest form, the label format is simply the Volume name, to which Bacula will append a four digit number. This number starts at 0001 and is incremented for each Volume the catalog contains. Thus if you modify your Pool resource to be:
Pool {
Name = Disk-pool
Pool Type = Backup
Volume Use Duration = 23h
LabelFormat = "Vol-"
}
Bacula will create Volume names Vol-0001, Vol-0002, and so on when new Volumes are needed. Much more complex and elaborate labels can be created using variable expansion defined in the of the Variable Expansion chapter of the Bacula Enterprise Miscellaneous Guide.
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 LabelMedia = yes to the Device resource as follows:
Device {
Name = DiskDevice_Dev0
DriveIndex = 0
Media Type = DiskStorage-mnt-bacula
Archive Device = /mnt/bacula/backups
Random Access = Yes;
AutomaticMount = yes;
RemovableMedia = no;
AlwaysOpen = no;
LabelMedia = yes
}
You can find more details of the Label Format Pool record in Label Format description of the Pool resource records.
See also
Next articles:
Go back to: Backup Policy Configuration.