我试图configurationBacula自动回收,并使用一个随机磁带放入单个LTO驱动器,但它似乎更喜欢最老的备份磁带,尽pipe它不在驱动器中。 我已经将所有磁带标记为“已用”,并确保保留期限结束。
存储conf和目录conf.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
DIR
Pool { Name = Default Pool Type = Backup Recycle = yes # Bacula can automatically recycle Volumes AutoPrune = yes # Prune expired volumes Volume Retention = 15 days
我一直在阅读文档,似乎说存储algorithm会喜欢在磁带驱动器,但我不认为我的理解是正确的。
有什么办法强制bacula用户目前磁带内的磁带?
所以我find了一个使用before-job脚本的解决scheme。
我修改了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
这样,尽pipe作业或卷的保留期限总是使用清除的磁带。