
我正在嘗試將 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
這樣,無論作業或磁碟區的保留期限如何,它始終使用已清除的磁帶。