Bacula-users

Re: [Bacula-users] Running a restore job

2008-04-08 05:35:07
Subject: Re: [Bacula-users] Running a restore job
From: Arno Lehmann <al AT its-lehmann DOT de>
To: bacula-users <bacula-users AT lists.sourceforge DOT net>
Date: Tue, 08 Apr 2008 11:34:43 +0200
Hello,

08.04.2008 10:55, Steven Jones wrote:
> Arno Lehmann wrote:
> 
> 8><-----
>> If you - through the startup script - run the SD as a user other than 
>> root, 
> no only as root, there are start up scripts to start them up on boot. I 
> have restarted them but as root.
>> you have to make sure the SD can access all its files and 
>> directories... once you ran the SD as root, some of these files might 
>> be inaccessible for the other user.
>>
>> To make sure, run e.g. 'bacula-sd -c /etc/bacula/bacula-sd.conf -f -d 
>> 50 -v' and you should see some messages.
>>   
> hermes:/backup-250g-01# bacula-sd -c /etc/bacula/bacula-sd.conf -f -d 50 -v
> 08-Apr 20:32 hermes-sd: ERROR TERMINATION at bsys.c:433
> bacula-sd is already running. pid=4638 Check file 
> /var/run/bacula/bacula-sd.9103.pid
> hermes:/backup-250g-01#
> 
> ?

Ok... check if that process is running. If it does, stop it. If it 
doesn't, simply delete the .pid file.

>> Typically, the working directory with all its contents and the pid 
>> file should be owned by the bacula user in this case.
>>
>> Also you should plan to upgrade to a more recent version...
>>
>>   
> This is what ships with Debian 4.0....reluctant to move away from the 
> packaging system.....

Well, debian ships outdated versions of Bacula.

Not being a debian user, and not managing a Bacula instance on debian, 
I don't know for sure, but I believe there is a repository or a 
package available with more recent versions.

>>> #
>>> # Default Bacula Storage Daemon Configuration file
>>> #
>>> #  For Bacula release 1.38.11 (28 June 2006) -- debian 4.0
>>> #
>>> # You may need to change the name of your tape drive
>>> #   on the "Archive Device" directive in the Device
>>> #   resource.  If you change the Name and/or the
>>> #   "Media Type" in the Device resource, please ensure
>>> #   that dird.conf has corresponding changes.
>>> #
>>>
>>> Storage {                             # definition of myself
>>>   Name = hermes-sd
>>>   SDPort = 9103                  # Director's port
>>>   WorkingDirectory = "/var/lib/bacula"
>>>   Pid Directory = "/var/run/bacula"
>>>   Maximum Concurrent Jobs = 20
>>>   SDAddress = 127.0.0.1
>>>     
>> This is, in most cases, a configuration error...
>>   
> Something above is wrong?

Yes... the localhost address won't work once you've got networked clients.

>>>   #ssj SDAddress = 192.168.1.254
>>> }
>>>
>>> #
>>> # List Directors who are permitted to contact Storage daemon
>>> #
>>> Director {
>>>   Name = hermes-dir
>>>   Password = "xxxxx"
>>> }
>>>
>>> #
>>> # Restricted Director, used by tray-monitor to get the
>>> #   status of the storage daemon
>>> #
>>> Director {
>>>   Name = hermes-mon
>>>   Password = "xxxxxxx"
>>>   Monitor = yes
>>> }
>>>
>>> #
>>> # Devices supported by this Storage daemon
>>> # To connect, the Director's bacula-dir.conf must have the
>>> #  same Name and MediaType.
>>> #
>>>
>>> Device {
>>>   Name = FileStorage
>>>   Media Type = File
>>>   Archive Device = /backup-250g-01
>>>   #Archive Device = /tmp
>>>   LabelMedia = yes;                   # lets Bacula label unlabeled media
>>>   Random Access = Yes;
>>>   AutomaticMount = yes;               # when device opened, read it
>>>   RemovableMedia = no;
>>>   AlwaysOpen = no;
>>> }
>>>
>>>     
>> ... lots of comments not needed here...
>>   
>>   
> 8><--------
>> Also, check with netstat and ps if the SD is running and listening on 
>> the network.
>>
>>   
>>>> Indeed when i try and connect I get,
>>>>
>>>> *status
>>>> Status available for:
>>>>      1: Director
>>>>      2: Storage
>>>>      3: Client
>>>>      4: All
>>>> Select daemon type for status (1-4): 2
>>>> Automatically selected Storage: File
>>>> Connecting to Storage daemon File at localhost:9103
>>>>
>>>> Failed to connect to Storage daemon File.
>>>> ====
>>>> *
>>>>
>>>> ?
>>>>
>>>> Looking at the pid directory when i retart the dir or fd the PID updates,
>>>> for the sd no pid is written, so this suggests the sd is failing to start?
>>>>
>>>> hermes:/var/run/bacula# ls -l
>>>> total 8
>>>> -rw-r----- 1 root root 6 2008-04-08 15:57 bacula-dir.9101.pid
>>>> -rw-r----- 1 root root 6 2008-04-08 15:19 bacula-fd.9102.pid
>>>>       
>> yup... only root can write here.
>>
>>   
> fixed....
>>>> hermes:/var/run/bacula# ls -l
>>>> total 8
>>>> -rw-r----- 1 root root 6 2008-04-08 15:57 bacula-dir.9101.pid
>>>> -rw-r----- 1 root root 6 2008-04-08 15:19 bacula-fd.9102.pid
>>>> hermes:/var/run/bacula# ls -l
>>>> total 8
>>>> -rw-r----- 1 root root 6 2008-04-08 16:01 bacula-dir.9101.pid
>>>> -rw-r----- 1 root root 6 2008-04-08 15:19 bacula-fd.9102.pid
>>>> hermes:/var/run/bacula# ls -l
>>>> total 8
>>>> -rw-r----- 1 root root 6 2008-04-08 16:01 bacula-dir.9101.pid
>>>> -rw-r----- 1 root root 6 2008-04-08 16:01 bacula-fd.9102.pid
>>>> hermes:/var/run/bacula#
>>>>
>>>> Any ideas please?
>>>>       
>> chown bacula: /var/run/bacula/*
>>   
> fixed....
>> chown -R bacula: /var/lib/bacula/
>>
>> (but make sure this doesn't interfere with files used by the DIR or FD 
>> in that directory...)
>>
>>   
> hermes:/backup-250g-01# cd /var/lib/bacula/
> hermes:/var/lib/bacula#
> hermes:/var/lib/bacula# ls -l
> total 100
> -rw-r----- 1 bacula bacula 43008 2008-03-21 10:12 bacula.db
> -rw-r----- 1 bacula bacula  2032 2008-04-08 20:31 bacula-dir.9101.state
> -rw-r----- 1 root   root    2032 2008-04-08 20:31 bacula-fd.9102.state
> -rw-r----- 1 bacula tape     192 2008-04-08 20:31 bacula-sd.9103.state
> -rw-r----- 1 bacula bacula  4748 2008-04-07 23:07 Client1.bsr
> -rw-r----- 1 bacula bacula  5764 2008-04-08 16:15 hermes-dir.1.restore.bsr
> -rw-r----- 1 bacula bacula  5764 2008-04-08 14:48 hermes-dir.2.restore.bsr
> -rw-r----- 1 bacula bacula  5764 2008-04-08 14:57 hermes-dir.3.restore.bsr
> -rw-r----- 1 bacula bacula  7823 2008-03-23 14:34 
> hermes-dir.Client1.2008-03-22_22.58.02.135293104.mail
> -rw------- 1 bacula bacula     0 2008-04-08 20:27 hermes-dir.conmsg
> -rw-r----- 1 bacula bacula     0 2008-04-08 15:14 
> hermes-dir.*Console*.2008-04-08_15.13.29.135185944.mail
> -rw-r----- 1 bacula bacula     0 2008-04-08 14:01 
> hermes-dir.RestoreFiles.2008-04-08_14.01.17.135158536.mail
> -rw-r----- 1 bacula bacula     0 2008-04-08 15:09 
> hermes-dir.RestoreFiles.2008-04-08_15.09.44.135319432.mail
> lrwxrwxrwx 1 root   root      20 2008-03-21 10:12 log -> 
> ../../log/bacula/log
> -rw-r----- 1 bacula bacula   203 2008-04-07 23:10 -u<user>.sql

The above file looks like an artifact from testing catalog backups 
that went wrong. Also, you've got some old bootstrap and messages 
files left that could be removed. Apart from that, this looks good.

> hermes:/var/lib/bacula#
> 
> I have it running, but it now has lost the backup disk.......

Does it? Let's see...

> 8><--------
> *status 2
> The defined Storage resources are:
>      1: File
>      2: DLT-0
>      3: DLT-1
> Select Storage resource (1-3): 1
> Connecting to Storage daemon File at 127.0.0.1:9103
> 
> hermes-sd Version: 1.38.11 (28 June 2006) i486-pc-linux-gnu debian 4.0
> Daemon started 08-Apr-08 20:31, 0 Jobs run since started.
> 
> Running Jobs:
> No Jobs running.
> ====
> 
> Jobs waiting to reserve a drive:
> ====
> No Terminated Jobs.
> 
> Device status:
> Device "FileStorage" (/backup-250g-01) is not open or does not exist.

That's normal - file devices are only "open" when they are active, 
i.e. the SD is currently using them.

> Device "DLT-0" (/dev/st0) open but no Bacula volume is mounted.
>     Total Bytes Read=0 Blocks Read=0 Bytes/block=0
>     Positioned at File=0 Block=0
> Device "DLT-1" (/dev/st1) open but no Bacula volume is mounted.
>     Total Bytes Read=0 Blocks Read=0 Bytes/block=0
>     Positioned at File=0 Block=0
> ====
> 
> In Use Volume status:
> ====
> 8><-----------
> 
> However the backup drive exists,
> 
> hermes:/var/lib/bacula# df -k
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/sda2              3842408   3282892    364328  91% /
> tmpfs                   516772         0    516772   0% /lib/init/rw
> tmpfs                   516772         0    516772   0% /dev/shm
> /dev/sda3              3826584   1912696   1719504  53% /var
> /dev/sdb1             34946248  29526236   3644832  90% /home
> /dev/hdc1            240362656  90119672 138033184  40% /backup-250g-01
> hermes:/var/lib/bacula#
> 
> Permissions seem fine,
> 
> hermes:/var/lib# cd /
> hermes:/# ls -l
> total 160
> drwxrwxrwx   5 bacula bacula  4096 2008-04-02 21:13 backup-250g-01
> 
> The backed up volume looks to be there,
> 
> hermes:/# cd  backup-250g-01
> hermes:/backup-250g-01# ls -l
> total 89927916
> -rw-r----- 1 bacula bacula 91996224311 2008-04-07 23:07 backup-250g-01
> drwxr-xr-x 2 bacula bacula        4096 2008-04-08 15:04 bacula-restores
> drwx------ 2 bacula bacula       16384 2008-03-23 15:35 lost+found
> drwxr-xr-x 2 bacula bacula        4096 2008-04-02 21:13 tape-restore-jan-08
> hermes:/backup-250g-01#
>  
> So now I appear to need to repair/recover the volume?

I don't think so.

> This seems illogical,
> 
> *mount
> Using default Catalog name=MyCatalog DB=bacula
> The defined Storage resources are:
>      1: File
>      2: DLT-0
>      3: DLT-1
> Select Storage resource (1-3): 1
> 3906 File device "FileStorage" (/backup-250g-01) is always mounted.
> *umount
> The defined Storage resources are:
>      1: File
>      2: DLT-0
>      3: DLT-1
> Select Storage resource (1-3): 1
> 3901 Device "FileStorage" (/backup-250g-01) is already unmounted.
> *mount
> The defined Storage resources are:
>      1: File
>      2: DLT-0
>      3: DLT-1
> Select Storage resource (1-3): 1
> 3906 File device "FileStorage" (/backup-250g-01) is always mounted.
> 
> always mounted, yet unmounted? wierd....
> 
> Sorry I am a bit lost here....struggling to get this going again.

Just a minor issue with how the SD reports file storage state.

I think if you try to run a job it would work.

Arno

> regards
> 
> Steven
> 
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Register now and save $200. Hurry, offer ends at 11:59 p.m., 
> Monday, April 7! Use priority code J8TLD2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
> 

-- 
Arno Lehmann
IT-Service Lehmann
www.its-lehmann.de

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users