Hello Heitor,
Am 15.12.2017 um 15:41 schrieb Heitor Faria:
running Bacula 7.4.4 (same problem with version 5.2.13) on openSUSE Leap
42.3 with a standalone LTO tape drive.
Note: Meanwhile upgraded to 9.0.6.
[Sometimes Bacula requests] a tape that for some
reason cannot or should not be used for that job.
Then if I mount a different tape, Bacula will immediately eject it
again, claiming that it is in the wrong state ("Used" instead of
"Recycle") and insisting I mount the one it requested.
How can I convince Bacula to recycle and use the tape I give it?
You can forccefully recycle this tape with the purge command.
Ok, that worked, but I'm not quite happy with that solution yet.
* The situation has occurred again today, Bacula requesting volume
"Mai-2" instead of "Januar" which I wanted it to use.
* I first checked volume "Januar" which had not been in use for way
beyond its retention period of 91 days, and was listed in the catalog
with VolFiles=0, so it should be available for recycling:
*llist volume=Januar
MediaId: 52
VolumeName: Januar
Slot: 0
PoolId: 1
MediaType: LTO-2
MediaTypeId: 0
FirstWritten: 1970-01-01 01:00:00
LastWritten: 2017-01-30 00:39:15
LabelDate: 2017-01-02 20:49:20
VolJobs: 0
VolFiles: 0
VolBlocks: 0
VolParts: 0
VolCloudParts: 0
CacheRetention: 0
VolMounts: 25
VolBytes: 1
VolABytes: 0
VolAPadding: 0
VolHoleBytes: 0
VolHoles: 0
LastPartBytes: 0
VolErrors: 0
VolWrites: 20,112,985
VolCapacityBytes: 0
VolStatus: Used
Enabled: 1
Recycle: 1
VolRetention: 7,862,400
VolUseDuration: 2,678,400
MaxVolJobs: 0
MaxVolFiles: 0
MaxVolBytes: 0
InChanger: 0
EndFile: 92
EndBlock: 5,628
VolType: 0
LabelType: 0
StorageId: 4
DeviceId: 0
MediaAddressing: 0
VolReadTime: 0
VolWriteTime: 39,796,045,456
LocationId: 0
RecycleCount: 6
InitialWrite: 0000-00-00 00:00:00
ScratchPoolId: 0
RecyclePoolId: 0
ActionOnPurge: 0
ExpiresIn: 0
Comment: NULL
* I tried to prune the volume. Bacula asked me whether I was sure, then
told me there was nothing to do:
*prune volume=Januar
The current Volume retention period is: 3 months 1 day
Continue? (yes/mod/no): yes
Found no Job associated with the Volume "Januar" to prune
After that, Bacula would still eject the volume, asking I insert volume
"Mai-2" instead.
* Only when I actually purged the volume Bacula marked it as purged and
subsequently accepted to use it:
*purge volume=Januar
This command can be DANGEROUS!!!
It purges (deletes) all Files from a Job,
JobId, Client or Volume; or it purges (deletes)
all Jobs from a Client or Volume without regard
to retention periods. Normally you should use the
PRUNE command, which respects retention periods.
There are no more Jobs associated with Volume "Januar". Marking it purged.
*llist volume=Januar
MediaId: 52
VolumeName: Januar
Slot: 0
PoolId: 1
MediaType: LTO-2
MediaTypeId: 0
FirstWritten: 1970-01-01 01:00:00
LastWritten: 2017-01-30 00:39:15
LabelDate: 2017-01-02 20:49:20
VolJobs: 0
VolFiles: 0
VolBlocks: 0
VolParts: 0
VolCloudParts: 0
CacheRetention: 0
VolMounts: 25
VolBytes: 1
VolABytes: 0
VolAPadding: 0
VolHoleBytes: 0
VolHoles: 0
LastPartBytes: 0
VolErrors: 0
VolWrites: 20,112,985
VolCapacityBytes: 0
VolStatus: Purged
Enabled: 1
Recycle: 1
VolRetention: 7,862,400
VolUseDuration: 2,678,400
MaxVolJobs: 0
MaxVolFiles: 0
MaxVolBytes: 0
InChanger: 0
EndFile: 92
EndBlock: 5,628
VolType: 0
LabelType: 0
StorageId: 4
DeviceId: 0
MediaAddressing: 0
VolReadTime: 0
VolWriteTime: 39,796,045,456
LocationId: 0
RecycleCount: 6
InitialWrite: 0000-00-00 00:00:00
ScratchPoolId: 0
RecyclePoolId: 0
ActionOnPurge: 0
ExpiresIn: 0
Comment: NULL
Isn't that the wrong way around?
Shouldn't Bacula ask for confirmation on the *dangerous* command, and
execute the *safe* one without asking?
And shouldn't there be a non-dangerous way to promote a volume that
*already* has no more jobs associated with it from status Used to Purged?
Thanks,
Tilman