Bacula-users

Re: [Bacula-users] Purge all volumes in a pool

2016-04-03 19:26:41
Subject: Re: [Bacula-users] Purge all volumes in a pool
From: Heitor Faria <heitor AT bacula.com DOT br>
To: bacula-users AT lists.sourceforge DOT net
Date: Sun, 3 Apr 2016 20:23:57 -0300 (BRT)
Sorry, Bill!
I was going to the hospital and imagined it could happen. There it goes (just 
add a -e VolStatus in the grep -v if you have any other status that can't be 
purged):

for volname in $(echo "list media pool=File" |bconsole | grep -v -e Purged -e 
Recycled -e messages | cut -f 3 -d '|' | tail -3 | tr -d " " | grep -v -e 
"+-----"); do echo purge volume=$volname |bconsole; done

----- Original Message -----
> From: "bdam" <bacula-forum AT backupcentral DOT com>
> To: bacula-users AT lists.sourceforge DOT net
> Sent: Sunday, April 3, 2016 7:54:09 PM
> Subject: [Bacula-users]  Purge all volumes in a pool

> Connecting to Director tiger:9101
> 1000 OK: 102 tiger-dir Version: 7.4.0 (16 January 2016)
> Enter a period to cancel a command.
> purge volume=001-012-000060
> 
> 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.
> Automatically selected Catalog: MyCatalog
> Using Catalog "MyCatalog"
> 0 File on Volume "001-012-000060" purged from catalog.
> There are no more Jobs associated with Volume "001-012-000060". Marking it
> purged.
> 
> Connecting to Director tiger:9101
> 1000 OK: 102 tiger-dir Version: 7.4.0 (16 January 2016)
> Enter a period to cancel a command.
> purge volume=001-013-000059
> 
> 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.
> Automatically selected Catalog: MyCatalog
> Using Catalog "MyCatalog"
> 
> Volume "001-013-000059" has VolStatus "Recycle" and cannot be purged.
> The VolStatus must be: Append, Full, Used, or Error to be purged.
> 
> Here is the pool:
> 
> 
> Pool: 001-BHST-LTO3-CCTV-Vault
> +---------+----------------+-----------+---------+-----------------+----------+-----------------+---------+------+-----------+-----------+---------------------+-----------------+
>| MediaId | VolumeName     | VolStatus | Enabled | VolBytes        | VolFiles |
>| VolRetention    | Recycle | Slot | InChanger | MediaType | LastWritten
>| | ExpiresIn       |
> +---------+----------------+-----------+---------+-----------------+----------+-----------------+---------+------+-----------+-----------+---------------------+-----------------+
>|     253 | 001-001        | Purged    |       1 | 407,466,888,192 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-27 
>16:57:02
>|     | 315,327,834,216 |
>|     254 | 001-002        | Purged    |       1 | 407,272,642,560 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-27 
>21:30:12
>|     | 315,327,850,606 |
>|     255 | 001-003        | Purged    |       1 | 406,864,217,088 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-28 
>01:52:24
>|     | 315,327,866,338 |
>|     256 | 001-004        | Purged    |       1 | 406,834,025,472 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-28 
>06:13:37
>|     | 315,327,882,011 |
>|     257 | 001-005        | Purged    |       1 | 406,360,958,976 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-28 
>16:14:00
>|     | 315,327,918,034 |
>|     258 | 001-006        | Purged    |       1 | 406,236,966,912 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-28 
>20:46:44
>|     | 315,327,934,398 |
>|     259 | 001-007        | Purged    |       1 | 406,174,777,344 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-29 
>01:21:55
>|     | 315,327,950,909 |
>|     260 | 001-008-000062 | Purged    |       1 | 406,780,609,536 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-29 
>13:39:00
>|     | 315,327,995,134 |
>|     261 | 001-009-000063 | Purged    |       1 | 406,791,189,504 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-29 
>18:01:58
>|     | 315,328,010,912 |
>|     262 | 001-010-000064 | Full      |       1 | 407,274,642,432 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-04-02 
>22:07:22
>|     | 315,328,371,236 |
>|     263 | 001-011-000061 | Full      |       1 | 406,858,023,936 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-04-03 
>02:36:12
>|     | 315,328,387,366 |
>|     264 | 001-012-000060 | Purged    |       1 | 406,840,025,088 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-04-03 
>15:50:53
>|     | 315,328,435,047 |
>|     265 | 001-013-000059 | Recycle   |       1 |               1 |        0 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-22 
>04:40:01
>|     | 315,314,225,195 |
>|     266 | 001-014-000058 | Purged    |       1 | 407,662,811,136 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-22 
>13:56:05
>|     | 315,314,258,559 |
>|     267 | 001-015-000057 | Purged    |       1 | 408,138,651,648 |      408 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-22 
>18:25:54
>|     | 315,314,274,748 |
>|     268 | 001-016-000056 | Purged    |       1 | 406,942,986,240 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-23 
>00:33:53
>|     | 315,314,296,827 |
>|     269 | 001-017-000055 | Purged    |       1 | 406,837,509,120 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-23 
>05:04:58
>|     | 315,314,313,092 |
>|     270 | 001-018-000054 | Purged    |       1 | 406,823,510,016 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-23 
>13:58:57
>|     | 315,314,345,131 |
>|     271 | 001-019-000053 | Purged    |       1 | 406,814,284,800 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-23 
>18:46:11
>|     | 315,314,362,365 |
>|     272 | 001-020-000052 | Purged    |       1 | 407,549,850,624 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-24 
>02:06:27
>|     | 315,314,388,781 |
>|     273 | 001-021-000051 | Purged    |       1 | 407,900,473,344 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-24 
>14:53:51
>|     | 315,314,434,825 |
>|     274 | 001-022-000050 | Purged    |       1 | 408,358,960,128 |      408 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-24 
>23:04:47
>|     | 315,314,464,281 |
>|     275 | 001-023-000025 | Purged    |       1 | 407,404,311,552 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-25 
>03:52:57
>|     | 315,314,485,171 |
>|     276 | 001-024-000024 | Purged    |       1 | 407,635,200,000 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-25 
>13:11:15
>|     | 315,314,518,669 |
>|     277 | 001-025-000030 | Purged    |       1 | 407,973,952,512 |      408 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-25 
>17:44:18
>|     | 315,314,535,052 |
>|     278 | 001-026-000031 | Purged    |       1 | 408,420,504,576 |      408 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-25 
>23:10:20
>|     | 315,314,554,614 |
>|     279 | 001-027-000049 | Purged    |       1 | 408,559,656,960 |      408 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-10-26 
>05:32:14
>|     | 315,314,577,528 |
>|     280 | 001-029-000032 | Purged    |       1 | 407,465,662,464 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-04-02 
>15:43:57
>|     | 315,328,348,231 |
>|     281 | 001-028-000005 | Purged    |       1 | 408,183,681,024 |      419 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2015-11-25 
>14:08:37
>|     | 315,317,200,511 |
>|     290 | 001-030-000007 | Purged    |       1 | 408,004,402,176 |      408 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-21 
>16:12:22
>|     | 315,327,316,736 |
>|     291 | 001-031        | Purged    |       1 | 407,476,758,528 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-22 
>00:01:43
>|     | 315,327,344,897 |
>|     292 | 001-032        | Purged    |       1 | 407,454,501,888 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-22 
>11:45:24
>|     | 315,327,387,118 |
>|     293 | 001-033        | Purged    |       1 | 408,126,845,952 |      408 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-22 
>17:33:48
>|     | 315,327,408,022 |
>|     294 | 001-034        | Purged    |       1 | 407,751,837,696 |      407 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-23 
>18:20:10
>|     | 315,327,497,204 |
>|     295 | 001-035        | Purged    |       1 | 406,832,864,256 |      406 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-24 
>12:44:29
>|     | 315,327,563,463 |
>|     296 | 001-036        | Purged    |       1 |  22,998,528,000 |       23 |
>|     315,328,464,000 |       1 |    0 |         0 | LTO3      | 2016-03-25 
>13:43:33
>|     | 315,327,653,407 |
> +---------+----------------+-----------+---------+-----------------+----------+-----------------+---------+------+-----------+-----------+---------------------+-----------------+
> 


-- 
======================================================================= 
Heitor Medrado de Faria - LPIC-III | ITIL-F | Bacula Systems Certified 
Administrator II 
Próximas aulas telepresencial ao-vivo - 15 de fevereiro: 
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/ 
61 8268-4220 
Site: www.bacula.com.br | Facebook: heitor.faria 
========================================================================

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users