Bacula-users

Re: [Bacula-users] Recycle all volumes via bconsole

2016-05-08 09:43:24
Subject: Re: [Bacula-users] Recycle all volumes via bconsole
From: Heitor Faria <heitor AT bacula.com DOT br>
To: Elias Pereira <empbilly AT gmail DOT com>
Date: Sun, 8 May 2016 10:41:41 -0300 (BRT)
Thanks Heitor for the asnwer!!
In the "cut -f 3 -d '|'" from what I understand, this only catching the last 3 lines. I adapted to catch the last 20 lines for now. After that it was faster to purge volumes with errors.
Hello, Elias. Actually cut -f 3 -d '|' is necessary to fetch the volume name from list media. There was, however, an unnecessary tail since I adapted it from another prior script that I posted here before. 

a) I think the bellow is better, and should purge all error volumes from a selected pool:

clear && echo "list pools" |bconsole && read -p "Enter the Pool Name you want to purge all error volumes: " pool && for volname in $(echo "list media pool=$pool" |bconsole | grep -e Error | cut -f 3 -d '|' | tr -d " "); do echo purge volume=$volname |bconsole; done

b) Special requests are more expensive =). But with this you can purge all Error volumes:

clear && for volname in $(echo "list media" |bconsole | grep -e Error | cut -f 3 -d '|' | tr -d " "); do echo purge volume=$volname |bconsole; done

c) Just in time: in don't agree with any of this. Probably it would be more prudent to verify reason volumes are turning to error status and fix it. Or, in last case, just change error volumes to Used and then wait retention time expiration.

Regards,
How could I adapt the script to pick up all the volumes with error? This way I can create a cron job to regularly check for the wrong volumes.

On Thu, May 5, 2016 at 11:59 PM, Heitor Faria <heitor AT bacula.com DOT br> wrote:
Hi Ana,

Thanks for the answer. Have a command that I can delete all volumes with error in one shot?

Hello, Elias: if you want to recycle like you said in original post you can try this script or something similar:

# Shell script to purge all Error volumes from a pool.
clear && echo "list pools" |bconsole && read -p "Enter the Pool Name you want to purge all error volumes: " pool && for volname in $(echo "list media pool=$pool" |bconsole | grep -e Error | cut -f 3 -d '|' | tail -3 | tr -d " "); do echo purge volume=$volname |bconsole; done

Regards,
Em 05/05/2016 7:14 PM, "Ana Emília M. Arruda" <emiliaarruda AT gmail DOT com> escreveu:
Hello Elias,

Yes, you can directly update the database. If using MySQL, something like the bellow:

update Media set VolStatus="Used" where VolStatus="Error";

If you're going to do this, set the status to "Used" or "Full" and then bacula will recycle the volumes when its retention periods expires.

Nevertheless, I would recommend you to delete these volumes, because they could have entered this error status caused by a label corruption. And If this is the case, when Bacula would try to reuse them, they will enter again into this error status.

Best regards,
Ana


On Thu, May 5, 2016 at 3:18 PM, Elias Pereira <empbilly AT gmail DOT com> wrote:
Hello guys,
I have many volumes with errors and would like to recycle them. I can do this in one command?

--
Elias Pereira

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users



------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

--
=======================================================================
Heitor Medrado de Faria  - LPIC-III | ITIL-F |  Bacula Systems Certified Administrator II
Próximas aulas telepresencial ao-vivo - 02 de maio: http://www.bacula.com.br/agenda/
Ministro treinamento e implementação in-company Bacula: http://www.bacula.com.br/in-company/
Ou assista minhas videoaulas on-line: http://www.bacula.com.br/treinamento-bacula-ed/
Site: www.bacula.com.br | Facebook: heitor.faria
========================================================================



--
Elias Pereira


--
=======================================================================
Heitor Medrado de Faria  - LPIC-III | ITIL-F |  Bacula Systems Certified Administrator II
Próximas aulas telepresencial ao-vivo - 02 de maio: http://www.bacula.com.br/agenda/
Ministro treinamento e implementação in-company Bacula: http://www.bacula.com.br/in-company/
Ou assista minhas videoaulas on-line: http://www.bacula.com.br/treinamento-bacula-ed/
Site: www.bacula.com.br | Facebook: heitor.faria
========================================================================
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
<Prev in Thread] Current Thread [Next in Thread>