%20%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%9B%E3%82%93.png)
私は、単一の LTO ドライブに挿入したランダムなテープを自動的にリサイクルして使用するように Bacula を設定しようとしていますが、ドライブに挿入されていないにもかかわらず、最も古いバックアップ テープが優先されるようです。すでにすべてのテープを「使用済み」としてマークし、保持期間が終了していることを確認しています。
ストレージconfとディレクトリconf 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
この方法では、ジョブまたはボリュームの保持期間に関係なく、常にパージされたテープが使用されます。