Bacula-users

Re: [Bacula-users] How to properly remove volumes in regards to the catalog?

2016-05-09 07:34:59
Subject: Re: [Bacula-users] How to properly remove volumes in regards to the catalog?
From: Wanderlei Huttel <wanderleihuttel AT gmail DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 9 May 2016 08:33:43 -0300
Hello Ana and Kern

I know that migration Jobs can be used to move volumes to another Storage, but I guess is a lost of time using it if I will just replace the old disk for a new one with more capacity. 

In my previous example I said  I have 2 storages/disks, so I have volumes in both disks and I want to move all of them to just one bigger hard disk.
For this I suggested to create a command in bconsole to update volumes Storage.

I don't know how the command below works if I change volumes Pool to Another Pool that is in another storage
*update
11: Pool
 2: Daily
Enter a Volume name or *MediaId: Daily-Volume-001
Updating Volume "Daily-Volume-001"
Current Pool is: Daily
Enter new Pool name: Monthly



Best Regards

Wanderlei Hüttel

2016-05-06 4:26 GMT-03:00 Kern Sibbald <kern AT sibbald DOT com>:
Hello Wanderei,

Well, you simply:  "mv /old/path/<volumes> /new/path".
which will essentially do a cp followed by an rm if the old and new paths are on different devices, otherwise it is a sort of directory entry change.

If you start changing your bacula-dir.conf storage definition or those in the bacula-sd.conf file, then you might in some cases run into problems.

Note:
By changes by hand, I mean any kind of modification of the database.  Bacula ensures that the database is locked during database modifications, but when you do it by hand, you can, and users have had, conflicts with what Bacula was doing to the database (e.g. purging a volume while Bacula is writing it), which has for some people resulted in failed restores.  Note, even using bconsole, it is possible to interfere with proper backups.

On the other hand "reading" the database to produce reports, ... is something that I encourage.

Best regards,
Kern


On 05/05/2016 01:24 PM, Wanderlei Huttel wrote:
Hello Kern

I understand your concerns about make changes by hand in bacula database, but it wouldn't be interesting create an option in update to move volumes to another Storage?
An exemple: you can have 2 disks with 1TB (everyone with one storage) and you will change for a new one of 4TB. In this case is not necessary 2 storages but just one. 
You can move all volumes from both 1TB hard disk to the new one 4TB.


Best Regards 

Wanderlei Hüttel

2016-05-04 8:18 GMT-03:00 Kern Sibbald <kern AT sibbald DOT com>:
Hello,

I strongly encourage users to use Bacula bconsole commands to accomplish *all* modifications of the catalog database.  Making changes by hand using SQL will quite often lead to inconsistencies in the catalog that can come back to haunt you. In addition, much of the SQL for MySQL and PostgreSQL is different, which can also cause problems.  Bacula via bconsole knows how to handle the database for both MySQL and Postges.  It is *extremely* rare that I do any modification of the database by hand -- maybe 2 times in 16 years.

Best regards,
Kern


On 05/04/2016 12:13 PM, Florian Splett wrote:

Hello and sorry for the late response.

I just wanted to thank you for all the information.
Definitely helped me decide on how to approach the issue.

Regards,

Florian S.

Am 28.04.2016 um 13:04 schrieb Wanderlei Huttel:
Hello Florian


2016-04-28 5:47 GMT-03:00 Florian Splett <florian.splett AT web DOT de>:
Hello, bacula community.

The harddrive my bacula system is using to store its volumes is reaching
its maximum capacity, so I had the following plan for my network:

I want to manually move the old volumes onto an external harddrive and
keep that somewhere else.

Now what i want to ask is: Does this cause complications with the catalog?
It depends if they will be recycle soon or not
I guess so, since the volumes will be just gone.
Can I somehow tell the catalog that the volumes should be marked as
"unavailable" or something like that?
You can update Volume Status and set to "Archive" or "Disabled"
*update
1: Volume parameters
1: Volume Status
 
...or is it in fact perfectly fine to just remove those volumes?
Or you could create another Storage Resource in bacula-dir.conf and new Device in bacula-sd.conf and use this external harddrive as a Storage.
Move those Volumes to the external harddrive.

Get StorageId from New Storage:
*sqlquery
Entering SQL query mode.
Terminate each query with a semicolon.
Terminate query mode with a blank line.
Enter SQL query: select StorageID, Name, Autochanger from Storage;
+-----------+---------------+-------------+
| StorageID | Name          | Autochanger |
+-----------+---------------+-------------+
|         1 | StorageLocal1 |           0 |
|         3 | StorageLocal2 |           0 |
+-----------+---------------+-------------+

Use this below sql to get information about Volumes x Pool x Storage

select M.MediaId, M.VolumeName, M.StorageId, S.Name, M.PoolId, P.Name from Media M  left join Storage S on (M.StorageId = S.StorageId) left join Pool P on (M.PoolId = P.PoolId) order by M.VolumeName;

*sqlquery
Entering SQL query mode.
Terminate each query with a semicolon.
Terminate query mode with a blank line.
Enter SQL query: select M.MediaId, M.VolumeName, M.StorageId, S.Name, M.PoolId, P.Name from Media M  left join Storage S on (M.StorageId = S.StorageId) left join Pool P on (M.PoolId = P.PoolId) orde; by M.VolumeNam
+---------+---------------------+-----------+---------------+--------+---------+
| MediaId | VolumeName          | StorageId | Name          | PoolId | Name    |
+---------+---------------------+-----------+---------------+--------+---------+
|      36 | Volume-Diario-0001  |         1 | StorageLocal1 |      6 | Diaria  |
|      51 | Volume-Diario-0002  |         1 | StorageLocal1 |      6 | Diaria  |
|      74 | Volume-Diario-0003  |         1 | StorageLocal1 |      6 | Diaria  |
|      89 | Volume-Diario-0004  |         1 | StorageLocal1 |      6 | Diaria  |
|      96 | Volume-Diario-0005  |         1 | StorageLocal1 |      6 | Diaria  |
|      97 | Volume-Diario-0006  |         1 | StorageLocal1 |      6 | Diaria  |
|      98 | Volume-Diario-0007  |         1 | StorageLocal1 |      6 | Diaria  |
...

Update the volumes that you have moved to external hard drive to NewStorage (change StorageId).

*sqlquery
update Media set StorageId = 3 where PoolId = 6; # Move all volumes from a Pool or 
*sqlquery
update Media set StorageId = 3 where MediaId in (36,51,74,89,96);

I guess this can help you.

Best Regards

Wanderlei Hüttel


Regards,

Florian S.

------------------------------------------------------------------------------
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



------------------------------------------------------------------------------
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




------------------------------------------------------------------------------
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