Hello there, I often use mysql directly on the bacula catalog to check for old volumes that haven't been used for a while for whatever reason. It's quite simple if you take a look at the "Media" table structure:
# Select all volumes where LastWritten is older than Jan 1st, 2021: echo 'select VolumeName, LastWritten, VolBytes from Media where LastWritten < "2021-01-01";' | mysql -pXXXXXXX bacula VolumeName LastWritten VolBytes client0298-0206 2020-12-31 10:37:13 45526845926 You can then pipe that through awk or some other tool to create a bconsole "script": for v in $(echo 'select VolumeName, LastWritten, VolBytes from Media where LastWritten < "2021-01-01";' | mysql -s -pXXXXXXXXXXXX bacula | awk '{print $1}' ) ; do echo purge volume="$v"; done purge volume=client0298-0206 and then pipe that directly to bacula / bconsole if you're feeling adventurous like so: ( for v in $(echo 'select VolumeName, LastWritten, VolBytes from Media where LastWritten < "2021-01-01";' | mysql -s -pXXXXXXXXXXXX bacula | awk '{print $1}' ) ; do echo purge volume="$v"; done ) | bconsole That's most likely not the most elegant scripting you've ever seen, but it works and will let you review the consequences of your actions before actually committing them. You can also use the sql statement above to restrict the search to volumes of a certain name pattern ("AND VolumeName LIKE 'OFFLINE%'" for instance) or that are in a certain pool and so on. All the best, Uwe -- Uwe Schürkamp | email: <uwe.schuerk...@nionex.net> _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users