I have come across a problem with this script in that it has deleted some 
volumes that have an associated job. To test this out I ran the query and list 
media commands on a volume that the script reports as obsolete. From this I can 
see that 'query 14' reports the volume has no associated job. However 'list 
media pool=…' shows the volume is in the pool and the job log shows the volume 
is on the job.

This has me stumped as query reports that there is no associated job, yet the 
evidence is that there is an associated job. This is the reason for the 
erroneous deletion of the volume.

The implication of all this is that ‘query’ is not producing correct results.

Are there some other tests you could suggest to verify ‘query’?

pi@raspberrypi:~ $ bconsole
Connecting to Director raspberrypi.fritz.box:9101
1000 OK: 10002 raspberrypi-dir Version: 11.0.6 (10 March 2022)
Enter a period to cancel a command.

*query 14
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Enter Volume name: archiveusb2-incr1798
No results to list.

*list media pool=archiveusb2-incr
Using Catalog "MyCatalog"
+---------+----------------------+-----------+---------+----------+----------+--------------+---------+------+-----------+-----------+---------+----------+---------------------+-----------+
| mediaid | volumename           | volstatus | enabled | volbytes | volfiles | 
volretention | recycle | slot | inchanger | mediatype | voltype | volparts | 
lastwritten         | expiresin |
+---------+----------------------+-----------+---------+----------+----------+--------------+---------+------+-----------+-----------+---------+----------+---------------------+-----------+
|   1,798 | archiveusb2-incr1798 | Append    |       1 |      667 |        0 |  
    604,800 |       1 |    0 |         0 | File      |       1 |        0 | 
2023-04-13 17:42:41 |   590,791 |
+---------+----------------------+-----------+---------+----------+----------+--------------+---------+------+-----------+-----------+---------+----------+---------------------+-----------+
*

*list joblog jobid=2371
+----------------------------------------------------------------------------------------------------+
| logtext                                                                       
                       |
+----------------------------------------------------------------------------------------------------+
| raspberrypi-dir JobId 2371: Start Backup JobId 2371, 
Job=archive-usb2.2023-04-13_17.42.36_25         |
| raspberrypi-dir JobId 2371: Created new Volume="archiveusb2-incr1798", 
Pool="archiveusb2-incr", MediaType="File" in catalog. |
| raspberrypi-dir JobId 2371: Using Device "usb2" to write.                     
                       |
| raspberrypi-sd JobId 2371: Labeled new Volume "archiveusb2-incr1798" on File 
device "usb2" (/mnt/usb2/bacula). |
| raspberrypi-sd JobId 2371: Wrote label to prelabeled Volume 
"archiveusb2-incr1798" on File device "usb2" (/mnt/usb2/bacula) |
| raspberrypi-sd JobId 2371: Elapsed time=00:00:02, Transfer rate=0  
Bytes/second                      |
| raspberrypi-sd JobId 2371: Sending spooled attrs to the Director. Despooling 
0 bytes ...             |
| raspberrypi-dir JobId 2371: Bacula raspberrypi-dir 11.0.6 (10Mar22):
  Build OS:               aarch64-unknown-linux-gnu debian 11.3
  JobId:                  2371
  Job:                    archive-usb2.2023-04-13_17.42.36_25
  Backup Level:           Incremental, since=2023-04-13 17:40:41
  Client:                 "archive-fd" 11.0.6 (10Mar22) 
aarch64-unknown-linux-gnu,debian,11.3
  FileSet:                "archive" 2022-09-10 03:30:00
  Pool:                   "archiveusb2-incr" (From Job IncPool override)
  Catalog:                "MyCatalog" (From Pool resource)
  Storage:                "usb2" (From Pool resource)
  Scheduled time:         13-Apr-2023 17:42:36
  Start time:             13-Apr-2023 17:42:39
  End time:               13-Apr-2023 17:42:41
  Elapsed time:           2 secs
  Priority:               10
  FD Files Written:       0
  SD Files Written:       0
  FD Bytes Written:       0 (0 B)
  SD Bytes Written:       0 (0 B)
  Rate:                   0.0 KB/s
  Software Compression:   None
  Comm Line Compression:  None
  Snapshot/VSS:           no
  Encryption:             no
  Accurate:               no
  Volume name(s):         
  Volume Session Id:      20
  Volume Session Time:    1681209840
  Last Volume Bytes:      667 (667 B)
  Non-fatal FD errors:    0
  SD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Backup OK |
| raspberrypi-dir JobId 2371: Begin pruning Jobs older than 7 days .            
                       |
| raspberrypi-dir JobId 2371: Pruned 1 Job for client archive-fd from catalog.  
                       |
| raspberrypi-dir JobId 2371: Begin pruning Files.                              
                       |
| raspberrypi-dir JobId 2371: No Files found to prune.                          
                       |
| raspberrypi-dir JobId 2371: End auto prune.                                   
                       |
+----------------------------------------------------------------------------------------------------+
+-------+--------------+---------------------+------+-------+----------+----------+-----------+
| jobid | name         | starttime           | type | level | jobfiles | 
jobbytes | jobstatus |
+-------+--------------+---------------------+------+-------+----------+----------+-----------+
| 2,371 | archive-usb2 | 2023-04-13 17:42:39 | B    | I     |        0 |        
0 | T         |
+-------+--------------+---------------------+------+-------+----------+----------+-----------+
*

Best
-Chris-




> On 13 Apr 2023, at 15:06, Bill Arlofski <w...@protonmail.com> wrote:
> 
> On 4/13/23 02:51, Chris Wilkinson wrote:
>> This is the final mods to Bill's script. It scans the catalog for volumes 
>> without a job, deletes them from the catalog and disk. There were a lot of 
>> orphaned volumes and this recovered ~1TB from my storage.
>> In my setup, all volumes are in one directory and therefore have unique 
>> names e.g. poolname-full1234
> [...snip...]> Thank you to Bill 👍
> 
> You're welcome, glad I could help. :v:
> 
> 
> Best regards,
> Bill
> 
> -- 
> Bill Arlofski
> w...@protonmail.com
> 

_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to