bacula I

bacula I – Installation of bacula in server and client

As the number of Windows 2008 servers for (either acts as research projects or as TS servers ) in the laboratory increases, now I try to use bacula , a free network backup tools, to backup their system images into a LTO 4 tape drive attached to a PowerEdge server of CentOS 5.5 , with hostname “serverhost” in my case

Download the source of bacula 5.0.3 from
http://sourceforge.net/projects/bacula , then compile and install it in serverhost :

% cd /usr/local/src/bacula-5.0.3
% ./build.sh

Content of build.sh is as follows :

#!/bin/sh
CFLAGS=”-g -O2″ \
./configure \
–sbindir=/usr/local/bacula/bin \
–sysconfdir=/usr/local/bacula/bin \
–with-pid-dir=/usr/local/bacula/bin/working \
–with-subsys-dir=/usr/local/bacula/bin/working \
–enable-smartalloc \
–with-mysql \
–with-working-dir=/usr/local/bacula/bin/working \
–with-dump-email={My Email Addr.} \
–with-job-email={My Email Addr.}\
–with-smtp-host={My STMP server host}

If above configuraiton does not return any error, proceed with compilation and installation :

% make
% make install

Now create the bacula database “bacula” which owned by user “bacula” in mysql server in serverhost . After that , create bacula tables :

% /usr/local/src/bacula-5.0.3
% src/cats/make_bacula_tables -u bacula -p
{ key in password for bacula user}
Making MySQL tables
Enter password:
Creation of Bacula MySQL tables succeeded.

Afterwards, set the correct bacula table privileges . If you miss this step , it will return error while the job for backup starts even bacula daemon can be started up successfullly , and client can connect to it.

% /usr/local/src/bacula-5.0.3/src/cats/grant_bacula_privileges -u root -p
{ key in password for mysql root user}

All the configuration for bacula is put in /usr/local/bacula/bin/ of serverhost , and now we need to edit /usr/local/bacula/bin/bacula-dir.conf to access the mysql databse “bacula” (Special Note : “dbaddress” in the bacula-dir.conf is incorrect , that should be “DB Address” ) :

# Generic catalog service
Catalog {
Name = MyCatalog
# Uncomment the following line if you want the dbi driver
# dbdriver = “dbi:mysql”; dbaddress = localhost; dbport =
dbdriver = “dbi:mysql”;
dbname = “bacula”; dbuser = “bacula”; dbpassword = “PASSWORD”
DB Address=127.0.0.1
}

Now You can install bacula client in a Windows client machine with hostname “clienthost” in my case , and also test connection to bacula server in “serverhost” . First download and install the bacula client in windows machine :
http://www.bacula.org/en/?page=downloads

and fill in below dialog box with value of the DIR name , Dir password and Dir Address with information from serverhost’s /usr/local/bacula/bin/bacula-dir.conf

bacula11.JPG

Now add client configuration of “clienthost” in /usr/local/bacula/bin/bacula-dir.conf in servershost w.r.t. information from clienthost’s C:\clienthost-fd.conf

Client {
Name = clienthost-fd
Address = clienthost
FDPort = 9102
Catalog = MyCatalog
Password = “3aoSQxxxxxxxxxxxxxxxxxxxxxxxjlcjYj” # password for FileDaemon 2
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}

Also add below parts for backup and restore job for client “clienthost” . The directory for backup is clienthost’s G:/test/ , while directory for restore is clienthost’s G:/restore/ 。 The backup storage is “LTO4” (Some more examples on backup and restore jobs for windows OS, read here )

Job {
Name = “clienthost-fd”
Type = Backup
Client=clienthost-fd
FileSet=”clienthost FileSet”
Storage = LTO-4
Pool = Default
Messages = Standard
Level = Full
}

Job {
Name = “clienthostRestore”
Type = Restore
Client=clienthost-fd
FileSet=”clienthost FileSet”
Storage = File
Pool = Default
Messages = Standard
Where = “G:/restore”
}

FileSet {
Name = “clienthost FileSet”
Include {
Options {
signature = MD5
compression = GZIP
}
File = “G:/test/”
}
}

Then configure LTO-4 tape drive device configuration in /usr/local/bacula/bin/bacula-sd.conf (For information on troubleshooting the tape drive connectivity with bacula , read here ) :

Device {
Name = LTO-4
Media Type = LTO-4
Archive Device = /dev/nst0
AutomaticMount = yes; # when device opened, read it
AlwaysOpen = yes;
RemovableMedia = yes;
RandomAccess = no;
Maximum File Size = 800GB
}

And uncomment section for LTO-4 in bacula-dir.conf (suppose test backup G:/test/ directory in windows client clienthost ):

Storage {
Name = LTO-4
#Do not use “localhost” here
Address = serverhost # N.B. Use a fully qualified name here
SDPort = 9103
Password = “i0KYqTvbfXXXXXXXXXXXXXXXXXXXH6y56oemkg” # password for Storage daemon
Device = LTO-4 # must be same as Device in Storage daemon
Media Type = LTO-4 # must be same as MediaType in Storage daemon
Autochanger = yes # enable for autochanger device
}

Now Start bacula again to test the backup from client clienthost to server serverhost with LTO4 tape drive attached

In serverhost , start the bacula daemon by running :

/usr/local/bacula/bin/bacula start

Test connection and start Backup to serverhost’s tape drive from client “clienthost” : -> All Programs -> Bacula -> bconsole

If You should see “*” after invoking bconsole , that implies the connection to serverhost bacula is established.

Here is some useful commands under bconsole :
1. Show information of client “clienthost” , e.g. Running Jobs, Terminated Jobs ,etc.

*status client=clienthost-fd

2. Show Filesets information that will be backup or be excluded while backup.

*show filesets

3. Show Scheduled Jobs , Running Jobs in the director machine “serverhost “

*status dir

4. Show Storage information for backup and restore ,e.g. File or LTO tape drive :

*status storage

5. Start backup job from director machine :

*run

6. Start restore job from director machine :

* restore all

You may also like...