Re: Selecting jobids for restores

Michel Figgins <[email protected]>
Newsgroups gmane.comp.bacula.user
Message-ID <[email protected]>
Thanks Bill!

I have 2 jobs configured for each client that are identical other than storage/pool.
What I have wound up doing is firing up psql and using these:
select MAX(jobid) from Job where clientid = (select clientid from Client where name='server1-fd') and poolid=7 and level='F';
select MAX(jobid) from Job where clientid = (select clientid from Client where name='server1-fd') and poolid=7 and level='D';
select jobid from Job where clientid = (select clientid from Client where name='server1-fd') and poolid=7 and level='I' and jobid > (select MAX(jobid) from Job where clientid = 14 and poolid=7 and level='D') and jobbytes > 0;
having already figured out that poolid 7 is my local storage pool.  The jobbytes >0 bit is because of some later jobs that failed.

(My apologies to anyone who looks at my SQL and cringes)

- Michel

-----Original Message-----
From: Bill Arlofski via Bacula-users <[email protected]> 
Sent: Saturday, July 19, 2025 11:37 AM
To: [email protected]
Subject: Re: [Bacula-users] Selecting jobids for restores

On 7/19/25 10:11 AM, Michel Figgins wrote:
> Hello,
> 
> I have backups going to 2 different SDs – one local and one remote.  
> I’m attempting a full restore of a client which has Full, Diff, and 
> Inc jobs.  Does anyone know of a way to find the necessary jobids that 
> use just one of the SDs?  When I do the restore and select last full for a client, the resulting list of jobids includes jobs from both storages (which is not a huge deal except the Full backup it’s choosing is from the remote storage which is significantly slower than the local one).
> 
> As I’m asking the question I’m realizing that at some point when I’m 
> past the current fire, I’m going to want to re-architect using Virtual Fulls and/or Copy jobs.
> 
> Thanks,

Hello Michel,

In bconsole, you can first find out your storageids for the Storages:

* sql
Enter SQL query: SELECT * FROM storage;

Note the StorageID for the storage you want.


* SELECT jobid, name, level, jobstatus FROM job WHERE writestorageid='xxxx' AND jobstatus='T' AND name='yyyy';


This will get you what you need I believe.

Then, in bconsole, do the restore based on the F (local storage), Inc1, Inc2, Inc3:

* restore jobid=x,y,z
You have selected the following JobIds: x,y,z

This assumes that when you ran the Virtual full, to the remote storage that you did not prune/purge the local Full and consolidated Diffs and Incs.

Personally, I have not tried such a feat, so ymmv. :)

But, having said that, I re-read your message... It seems you are not yet using Virtual Fulls.

Now I do not understand. If your fulls go to a remote storage, then that is the only place the full can be restored from.  If you run the same job and it writes a Full to local and a full to remote at different times, "restore, option 6" or option12 might help.

Can you describe your configuration a bit more?


Best regards,
Bill

--
Bill Arlofski
[email protected]

_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.