Bacula 不使用当前的 In-Drive LTO 磁带(但使用最古老的磁带)

Bacula 不使用当前的 In-Drive LTO 磁带(但使用最古老的磁带)

我正在尝试配置 Bacula 以自动回收并使用我放入单个 LTO 驱动器的随机磁带,但它似乎更喜欢最旧的备份磁带,尽管它不在驱动器中。我已经将所有磁带标记为“已使用”,并确保保留期已结束。

存储配置和目录配置 SD.conf

Device {
Name = LTO5
Archive Device = /dev/nst0
Device Type = Tape
Media Type = LTO-5
LabelMedia = yes
Random Access = no
#AutoChanger = yes
AutomaticMount = yes
AlwaysOpen = yes
RemovableMedia = yes
Maximum Concurrent Jobs = 1
LabelMedia = yes
Maximum File Size = 12G

目录

Pool {
  Name = Default
  Pool Type = Backup
  Recycle = yes                       # Bacula can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 15 days  

我一直在阅读文档,它似乎说存储算法将优先使用驱动器磁带,但我认为我理解得不正确。

有什么方法可以强制 bacula 使用当前驱动器内的磁带?

答案1

因此我找到了一个使用作业前脚本的解决方案。

我修改了 dir.conf,将这一行添加到作业中

Run Before Job = "/etc/bacula/scripts/purgecurrenttape" 

purgecurrenttape 是这样的。

#!/bin/bash
#mount the inside-drive tape
echo "mount storage=LTO5" |bconsole| grep " " >> /var/log/scrcintas.log
sleep 5
#get the name of the mounted tape.
cinta=$(echo "status storage=LTO5" | bconsole  |grep Volume: |awk '{print $2}')
if [[ $cinta == CINTA* ]]; #check things.... 
then
#purge tape. 
echo "purge volume=$cinta" | bconsole | grep " " >> /var/log/scrcintas.log
sleep
else
echo error >> /var/log/scrcintas.log
fi

这样,无论作业或卷的保留期如何,它始终使用已清除的磁带。

相关内容