On Friday 11 January 2008 22:26, Martin Simmons wrote:
> >>>>> On Fri, 11 Jan 2008 13:45:50 +0200, Silver Salonen said:
> > 
> > On Thursday 10 January 2008 09:55, Silver Salonen wrote:
> > > On Tuesday 08 January 2008 20:15, Martin Simmons wrote:
> > > > >>>>> On Sat, 5 Jan 2008 16:48:23 +0200, Silver Salonen said:
> > > > > 
> > > > > On Friday 28 December 2007, Silver Salonen wrote:
> > > > > > On Tuesday 06 March 2007 22:01, Paul England wrote:
> > > > > > > Hi there,
> > > > > > > 
> > > > > > > Yesterday I run bscan to update my bacula catalog database,
> > > > > > > 
> > > > > > > The reason I did this was due to a configuration error on my 
behalf,
> > > > > > > even though my pool was set to 'AutoPrune = no', 'Volume 
Retention =
> > > > > > > 99y' and 'Recycle = no'... the client directive was set 
> > to 'AutoPrune 
> > > =
> > > > > > > yes' and 'File Retention = 60d'.
> > > > > > > 
> > > > > > > Because of this it seems that Bacula was pruning files from this 
> > job,
> > > > > > > when I went to restore files it wouldn't only show me about 10% 
of 
> > > them.
> > > > > > > 
> > > > > > > So I tried using bscan with the following parameters...
> > > > > > > 
> > > > > > > bscan -s -m -c bacula-sd.conf -v -V Archive-1\|Archive-2\|
> > Archive-3\|
> > > > > > > Archive-4\|Archive-5\|Archive-6\|Archive-7\|Archive-8 /dev/nst0
> > > > > > > 
> > > > > > > It took more than a day but after wards it said it had added 
255000
> > > > > > > records to my database (which sounds about right).
> > > > > > > 
> > > > > > > Now it just doesn't want to work, when I try to restore it tells 
me 
> > > that
> > > > > > > there is no full backup available.
> > > > > > > 
> > > > > > > Any ideas?
> > > > > > 
> > > > > > Any answers on this? I run Bacula 2.2.6 dir and sd on FreeBSD-6.3 
and 
> > > want 
> > > > > to 
> > > > > > restore some files from an old volume via bconsole, but there seem 
to 
> > be 
> > > > > > something missing in database.
> > > > > > 
> > > > > > I tested with SQL-queries taken from Bat:
> > > > > > =====
> > > > > > SELECT DISTINCT Job.Jobid AS Id, Job.Name AS JobName,  Client.Name 
AS 
> > > > > Client, 
> > > > > > Job.Starttime AS JobStart, Job.Type AS JobType, Job.Level AS 
> > > BackupLevel, 
> > > > > > Job.Jobfiles AS FileCount, Job.JobBytes AS Bytes, Job.JobStatus AS 
> > > Status, 
> > > > > > Status.JobStatusLong AS StatusLong, Job.PurgedFiles AS Purged, 
> > > > > > FileSet.FileSet FROM Job JOIN Client ON 
(Client.ClientId=Job.ClientId) 
> > > JOIN 
> > > > > > Status ON (Job.JobStatus=Status.JobStatus) LEFT OUTER JOIN FileSet 
ON 
> > > > > > (FileSet.FileSetId=Job.FileSetId)  LEFT OUTER JOIN JobMedia ON 
> > > > > > (JobMedia.JobId=Job.JobId)  LEFT OUTER JOIN Media ON 
> > > > > > (JobMedia.MediaId=Media.MediaId)  WHERE 
> > > > > > Media.VolumeName='ultrasoft-s2-full-0001' ORDER BY Job.Starttime 
DESC, 
> > > > > > Job.JobId DESC
> > > > > > =====
> > > > > > 
> > > > > > This returned empty set, so I guess bscan isn't updating all the 
> > > necessary 
> > > > > > tables?
> > > > > > 
> > > > > > bscan output:
> > > > > > =====
> > > > > > # bscan -c /usr/local/etc/bacula-sd.conf -v -V 
> > ultrasoft-s2-full-0001 -h 
> > > > > > localhost -P baculapasswd m -s /backup/bacula/ultrasoft-s2
> > > > > > bscan: butil.c:282 Using device: "/backup/bacula/ultrasoft-s2" for 
> > > reading.
> > > > > > 19-Dec 10:20 bscan JobId 0: Ready to read from 
> > > > > volume "ultrasoft-s2-full-0001" 
> > > > > > on device "device-ultrasoft-s2" (/backup/bacula/ultrasoft-s2).
> > > > > > bscan: bscan.c:288 Using Database: bacula, User: bacula
> > > > > > bscan: bscan.c:431 Pool record for pool-ultrasoft-s2-full found in 
DB.
> > > > > > bscan: bscan.c:445 Pool type "Backup" is OK.
> > > > > > bscan: bscan.c:455 Media record for ultrasoft-s2-full-0001 found 
in 
> > DB.
> > > > > > bscan: bscan.c:473 Media type "files-varukas" is OK.
> > > > > > bscan: bscan.c:483 VOL_LABEL: OK for Volume: 
ultrasoft-s2-full-0001
> > > > > > bscan: bscan.c:501 SOS_LABEL: Found Job record for JobId: 7796
> > > > > > bscan: bscan.c:683 32,768 file records. At file:blk=1:104,701 
> > > > > > bytes=6,750,689,534
> > > > > > bscan: bscan.c:683 65,536 file records. At file:blk=1:106,565 
> > > > > > bytes=6,870,863,970
> > > > > > bscan: bscan.c:683 98,304 file records. At file:blk=1:108,570 
> > > > > > bytes=7,000,108,099
> > > > > > bscan: bscan.c:683 131,072 file records. At file:blk=2:144,874 
> > > > > > bytes=9,340,856,777
> > > > > > bscan: bscan.c:683 163,840 file records. At file:blk=2:176,914 
> > > > > > bytes=11,406,665,320
> > > > > > bscan: bscan.c:683 196,608 file records. At file:blk=2:194,509 
> > > > > > bytes=12,541,106,404
> > > > > > bscan: bscan.c:995 Fileset "ultrasoft-s2" already exists.
> > > > > > bscan: bscan.c:1116 Updated Job termination record for JobId=7796 
> > > Level=Full 
> > > > > > TermStat=T
> > > > > > bscan: bscan.c:1205 Created JobMedia record JobId 7796, MediaId 
1376
> > > > > > 19-Dec 10:34 bscan JobId 0: End of file 3 on 
> > > device "device-ultrasoft-s2" 
> > > > > > (/backup/bacula/ultrasoft-s2), Volume "ultrasoft-s2-full-0001"
> > > > > > 19-Dec 10:34 bscan JobId 0: End of Volume at file 3 on 
> > > > > > device "device-ultrasoft-s2" (/backup/bacula/ultrasoft-s2), 
> > > > > > Volume "ultrasoft-s2-full-0001"
> > > > > > bscan: bscan.c:318-0 ========== JobId=0 ========
> > > > > > bscan: bscan.c:937 Updated Media record at end of Volume: 
> > > > > > ultrasoft-s2-full-0001
> > > > > > 19-Dec 10:34 bscan JobId 0: End of all volumes.
> > > > > > bscan: bscan.c:937 Updated Media record at end of Volume: 
> > > > > > ultrasoft-s2-full-0001
> > > > > > bscan: bscan.c:632 End of all Volumes. VolFiles=3 VolBlocks=0 
> > > > > > VolBytes=13,013,043,636
> > > > > > Records added or updated in the catalog:
> > > > > >       1 Media
> > > > > >       1 Pool
> > > > > >       1 Job
> > > > > >  204810 File
> > > > > > =====
> > > > > > 
> > > > > > -- 
> > > > > > Silver
> > > > > 
> > > > > Hmm, no bscan experts? :)
> > > > 
> > > > The bscan output looks OK to me.  Maybe Bacula has pruned the volume 
> > again?
> > > > 
> > > > If not, then I think you'll have to simplify the query to see why it 
> > doesn't
> > > > work.  In particular
> > > > 
> > > > - the Job table should contain the job
> > > > 
> > > > - the JobMedia table should contain records for that job
> > > > 
> > > > __Martin
> > > 
> > > Hi!
> > > 
> > > I just queried MySQL for JobId 7796 and there's an entry for it in 
> > table 'Job' 
> > > as well as 20 entries in table 'JobMedia'.
> > > 
> > > The job doesn't still show up in Bat's JobList, so I still can't restore 
> > it :(
> > 
> > So I tried modifying the query I specified earlier, and found out that if 
I 
> > erased "JOIN Client ON (Client.ClientId=Job.ClientId)", the query worked. 
> > This led me to the discovery that Job.ClientId was 0 for JobId=7796. If I 
> > changed it to the correct ID manually, I could see the job in Bat and 
restore 
> > from there.
> 
> Ah, good.
> 
> 
> > Should bscan sed Job.ClientId too or is it a bug?
> 
> Yes it should, but I think there is a bug.
> 
> Can you try deleting the job from the database before running bscan?  It 
looks
> like it loses the Job.ClientId if the job already exists.

Yup, right you are. I deleted a row from Job table of another old full-backup 
(with ClientId=0), and bscan created a new job with right ClientId:
=====
bscan: bscan.c:483 VOL_LABEL: OK for Volume: ultrasoft-s2-full-0002
bscan: bscan.c:978 Created Client record for Client: ultrasoft-s2-fd
bscan: bscan.c:1061 Created new JobId=16896 record for original JobId=8471
=====

I also queried database for another job and saw existing jobs with right 
ClientId entries for old, purged volumes. As I couldn't browse the files, I 
thought it would be a right time to bscan the volume. After doing that, the 
Job.ClientId of the job was set to 0. After correcting it manually, I could 
browse the job's files.

-- 
Silver

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to