I use Bacula. To be clear, I wrote part of Bacula (the PostgreSQL part). Today I need to find out what jobs are on each of three tapes. Why? I just happened to cancel a 1.5TB job a few hours before it was to finish. By this time it had written to three tapes. I am guessing that the last two tapes can be reused. I’m also guessing that the first one cannot be.

I will eventually purge this job from the Catalog database, but first, I’ll use the database to locate the information I need.

*purge files jobid=66
This command is 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
for retention periods. Normally you should use the
PRUNE command, which respects retention periods.
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"

Now I can wipe things out for the two Volumes:

*purge volume=PEQ956L4
This command is 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
for retention periods. Normally you should use the
PRUNE command, which respects retention periods.
1 File on Volume "AAM266L4" purged from catalog.
There are no more Jobs associated with Volume "PEQ956L4". Marking it purged.
*purge volume=PEQ957L4
This command is 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
for retention periods. Normally you should use the
PRUNE command, which respects retention periods.
0 Files on Volume "PEQ957L4" purged from catalog.
There are no more Jobs associated with Volume "PEQ957L4". Marking it purged.
*

The key point with the purge is that it removes Jobs (associated with that Volume) from the Catalog. It does not remove data from the Volume. This process also sets the Volume status to Purged.

From the Bacula documentation:

Automatic recycling of Volumes is performed by Bacula only when it wants a new Volume and no appendable Volumes are available in the Pool. It will then search the Pool for any Volumes with the Recycle flag set and the Volume Status is Purged. At that point, it will choose the oldest purged volume and recycle it.

Thus, these two Purged Volumes will be used after all the Volumes with status Append have been used.

5 Responses to “What jobs are on these tapes?”

With the latest version of Bat, you can see the list of jobs using a specific Volume in the Media Info view (try
to double click on the volume name or in the volume list of a given Job view). It should avoid playing with SQL
queries.

For the list of files on a tape: what I would do is find out the Jobs on the Volumes, as shown above, then start a restore within bconsole. ‘Then use this option: Enter list of comma separated JobIds to select’

Strictly speaking, this won’t be only Files on this Volume. If a Job spans Volumes, then a given file in that Job may be on a different Volume.