📜 ⬆️ ⬇️

Bacula: for those who need to quickly and in pictures

Good day to all those who are going to make backups all the time.

In this post I will try to make life easier for those who try to get acquainted with this system. I will not tell anything supernatural, just add something that I myself would need. The basis for this is a well-written post , so there is no point in rewriting and copying.
And so, we open the article, we study, we understand that there is a mess in our head and we open the schemes and go ahead! The schemes turned out to be big, because they contain all the parameters from the above mentioned article. You will only have to drive your data into the schema, follow the dependency arrows (all that is noted by any kind of arrows you need to check / replace), and copy the text into your configs. I don’t need to copy the same blocks many times, if such a block is just left (well, you never know, maybe someone didn’t understand)!
All in charts and pictures, for ease of information consumption. I hope this will make your life easier!

Prehistory or how I switched to the side of admins who regularly make backups
June is the month, my wife got a driver's license and closed the session, and we have to go and pick her up with the child from the Penza province (we live in Moscow). I took the first two weeks of vacation for the last 5 years of my life, copied all the accounting bases on the NAS, made a backup archive with Zimbra mail and put it on the second NAS and with a pure soul went to my wife.
Friday's day did not foretell any events, but at 5 pm a colleague calls and says that the post office does not plow. Thin notes of excitement ran through me, because connecting to the servers was problematic - I'm in a deep forest in a “secret” military camp! I am for a 3G modem - and it is buggy and refuses to connect. I'm on the phone - only EDGE. And here I notice that the laptop reported on WIFI networks - the funny thing is, there are several without a password. Well, who else would even think to password WIFI in the deep forest. Further more fun - the first test says that it is 10mb / s to Penza. But the happiness was not complete: having connected to the computer, I understand that the VMWare admin panel is hard on me, and then I issued a message that I cannot connect to any virtual machine on one of the servers. I sent the server to reboot from which it never came out. I ask a colleague to reboot the server hard and connect the monitor in one. After a couple of minutes, a colleague calls back and says that the server cannot find the OSes and some 2 lights are on the front panel. Yes, the very light bulbs that hinted that I was waiting for a quick return to Moscow for the resurrection of the server.
In the evening, before leaving, I was bitten by bees, my face was swollen and my eyes were sore, so I had to go as a passenger. But the new driver did an excellent job on the road and after a day I was at work.
Fears were confirmed - 2 HDDs from 8 in Raid 50 fell. It is clear that I lost everything on that server. I went to the NAS where the archive was located from the post office - but the NAS was not online! I climbed under the ceiling (NAS is stored there) and brought it to me, and it is with factory settings. What happened I do not know, but it was reset and formatted the HDD. Mailer was lost completely. While I was waiting for warranty HDD resurrected everything on the second server. But since then I have decided that the reservation system should be dealt with in full. I was saved by the fact that my users use email clients, from which all correspondence was resurrected. But it is a long time and not pleasant. Now I treat those who are already doing backups centrally.
As a result: the raid is now 51 and the HDD is in reserve. For half a year in 2 servers I lost 6 more HDDs. The reasons are not clear. HP also could not say what it is connected with.

')


Scheme for Kubuntu client in odg format



Scheme for Windows client in odg format



Scheme for server Bacula in odg format

Explanation of schemes


1. I used the NAS D'Link DNS 323 as a NAS storage, it was mounted in the / media / folder, each NAS disk in its / media / nfs_linbackup_v1 / and / media / nfs_linbackup_v2 / folders.
2. Unlike articles in the scheme, other names of servers and items. I could not understand the titles from the article (in principle, for this reason, the scheme appeared).
3. Three schemes are laid out: for Linux, Windows and separately for the server. Scheme 3 (Schem_center) is the backup configuration of the server itself and is based on default settings from templates. I did not implement it as unnecessary to me personally. But if you decide to do this, then simply add the missing blocks of code to the files already created.

Director section /etc/bacula/bacula-dir.conf

1. Center.domain.local - the backup server is also 192.168.1.100;
2. Password Director "Center.domain.local" - "Passdir_1";
3. Configuration file for client kub-fd - @ / etc / bacula / client-conf / client-dir-kubuntu.conf

For Kubuntu customer

Section /etc/bacula/client-conf/client-dir-kubuntu.conf

1. kub-fd - the client is also 192.168.1.20 (OS Kubuntu 13.10);
2. Password of the client “PassClient_3”;
3. The name of the repository is “Kubunt-nfs” (used in the task for a general description of the repository and an indication of the data storage devices themselves)
4. The name of the device is “KubFileStorage” (used as a link to a specific physical storage device in the /etc/bacula/bacula-sd.conf file);
5. File-set name - “KubFileSet” (describes what we will copy or exclude from copying);
6. The name of the pool is “poolkubnfs” (describes the type of pool, how large should the base of backups be and how much should they be stored).
7. The name of the scheduler (he is a sheduler) - “KubDiff” (sets the schedule and type of operation performed, that is, full on Saturdays, differential for all other days);

Section /etc/bacula/bacula-sd.conf

1. Storage server name - "center-sd"
2. Address of the server on which the STORAGE service is launched - SDAddress = 192.168.1.100
3. Link to the client configuration file KubFileStorage @ / etc / bacula / client-conf / client-sd-kubuntu.conf

For the WinSrv client section /etc/bacula/client-conf/client-dir-winsrv.conf

1. winsrv-fd - the client is also 192.168.1.40 (OS WinServ2003)

All other explanations in the text of the comments.

What happened: the contents of the configuration files
bacula-dir.conf
Director { Name = center.domain.local-dir #   ,   default DIRport = 9101 #   ,   sql    #  Bacula Catalog(mysql database) QueryFile = "/etc/bacula/scripts/query.sql" #      WorkingDirectory = "/var/lib/bacula" # pid   PidDirectory = "/var/run/bacula" #      Maximum Concurrent Jobs = 1 #     BC    Password = "Passdir_1" #   mail',    Messages Messages = Daemon #      DirAddress = 192.168.1.100 } Messages { #      Director Name = Daemon #    email mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r" #     (root   admins@domain.ru) #   ,     mail = milo@mydomena.ru = alert,error,fatal,terminate, !skipped #     console = all, !skipped, !saved #    append = "/var/log/bacula/bacula.log" = all, !skipped } Console { Name = center.domain.local-mon Password = "Passdir_1" CommandACL = status, .status } Messages { Name = Standard mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r" operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r" mail = root = all, !skipped operator = root = mount console = all, !skipped, !saved append = "/var/log/bacula/bacula.log" = all, !skipped catalog = all } Catalog { Name = MyCatalog dbname = "bacula"; DB Address = ""; dbuser = "bacula"; dbpassword = "SQL_pass" } #       ,    #     - @     , #       @/etc/bacula/client-conf/client-dir-kubuntu.conf @/etc/bacula/client-conf/client-dir-winsrv.conf 


bacula-sd.conf
 /etc/bacula/bacula-sd.conf (  ) Storage { #   SD Name = center-sd #   SDPort = 9103 #   (  ) WorkingDirectory = "/var/lib/bacula" # pid   Pid Directory = "/var/run/bacula" #    ip SDAddress = 192.168.1.100 } Director { #  DD,  ,     Name = center.domain.local-dir #  Password = "Passtor_2" } #       ,    #     - @          #   @/etc/bacula/client-conf/client-sd-kubuntu.conf @/etc/bacula/client-conf/client-sd-winsrv.conf 


bacula-fd.conf
 Director { Name = center.domain.local-dir Password = "PassClient_01" } FileDaemon { Name = center.domain.local-fd FDport = 9102 WorkingDirectory = /var/lib/bacula Pid Directory = /var/run/bacula Maximum Concurrent Jobs = 20 FDAddress = 192.168.1.100 #     } Messages { Name = Standard director = center.domain.local-dir = all, !skipped, !restored } 


bconsole.conf
 Director { Name = center.domain.local-dir DIRport = 9101 Address = 192.168.1.100 Password = "Passdir_1" } 


client-dir-kubuntu.conf
 Client { #  Name = kub-fd # ip   Address = 192.168.1.20 # ,    FDPort = 9102 #  mysql   Bacula Catalog = MyCatalog #   FD Password = "PassClient_3" #         #    ,     #  (   !!) File Retention = 30 days #  ,     Job Retention = 2 months #    ( mysql)  #   AutoPrune = yes } Storage { #     Name = Kubunt-nfs Password = "Passtor_2" # fqdn   Address = 192.168.1.100 #    SDPort = 9103 #      SD Device = KubFileStorage #           #  bacula( # /media/nfs_linbackup_v1/kubuntu/Vol0001) Media Type = File } Schedule { Name = "KubDiff" Run = Level=Full on sat at 15:01 Run = Level=Differential on tue-fri at 15:02 } Pool { #  ,      Name = poolkubnfs #  ,       Pool Type = Backup #    (   1-, #  2-,  3-, 3-  -   1-) AutoPrune = yes #    bacula catalog ( mysql  ) #    Recycle = yes #       (Voumes) #    ,     #   Volume Retention = 5 days Maximum Volume Bytes = 1G Maximum Volumes = 3 LabelFormat = "Kubvol" } FileSet { Name = "KubFileSet" Include { Options { #      , #      md5 signature = MD5 } #  ,    File = /var/backups/opt/ File = /etc/hosts File = /etc/host.conf File = /etc/network/interfaces File = /etc/dnsmasq.conf File = /etc/resolv.conf File = /etc/ntp.conf File = /home/rk/testbackup/ } Exclude { #      File = /home/rk/testbackup/NTFS.dmg } } Job { #   Name = "BackupKubFull" # (backup or restore) Type = Backup # (,   # ) Level = Full #  SD  Storage = Kubunt-nfs #  -(   # ,    ) FileSet="KubFileSet" #   Schedule = "KubDiff" #  (     # (volume)    ) Pool = poolkubnfs #   Client=kub-fd #       , #     , #    ,   #   -    ,  #   Write Bootstrap = "/var/lib/bacula/%n.bsr" #   messages,   #     Messages = Standard #      #(   -    !) ClientRunBeforeJob = "/root/sh/before_bg_db_backup.sh" #      ClientRunAfterJob = "/root/sh/after_bg_db_backup.sh" #     !!! } Job { #      Name = "RestoreKub" Type = Restore Client=kub-fd FileSet="KubFileSet" Storage = winsrv-nfs Pool = poolkubnfs Messages = Standard #      #   .       # ,       Where = /home/rb/1/ } 


client-dir-WinSrv.conf
 Client { #  Name = winsrv-fd # ip   Address = 192.168.1.40 # ,    FDPort = 9102 #  mysql   Bacula Catalog = MyCatalog #   FD Password = "PassClient_3" #         #    ,     #  (   !!) File Retention = 30 days #  ,     Job Retention = 2 months #    ( mysql)  #   AutoPrune = yes } Storage { #     Name = winsrv-nfs Password = "Passtor_2" # fqdn   Address = center.domain.local #    SDPort = 9103 #      SD Device = winsrvFileStorage #      NFS NAS    #  bacula( /backup/bgbilling/Vol0001) Media Type = File } Schedule { Name = "WinDiff" Run = Level=Full on sat at 00:02 Run = Level=Differential on tue-fri at 00:03 } Pool { #  ,      Name = poolwinsrvnfs #  ,       Pool Type = Backup #    (   1-, #  2-,  3-, 3-  -   1-) AutoPrune = yes #    bacula catalog ( mysql  ) #    Recycle = yes #       (Voumes) #    ,     #   Volume Retention = 5 days Maximum Volume Bytes = 1G Maximum Volumes = 3 LabelFormat = "winvol" } FileSet { Name = "WinFileSet" #VSS    ,   #    Enable VSS = no Include { Options { compression = GZIP signature = MD5 portable=yes noatime = yes checkfilechanges = yes Ignore Case = yes wildfile = "*.avi" wildfile = "*.wmv" wildfile = "*.mp3" wilddir = "System Volume Information" exclude = yes } #  ,    File = "C:/Buh" File = "C:/Supply" File = "C:/Doc" } Exclude { File = "C:/Doc/myphoto/" } } Job { #   Name = "BackupWinFull" # (backup or restore) Type = Backup # (,   # ) Level = Full #  SD  Storage = winsrv-nfs #  -(   # ,    ) FileSet="WinFileSet" #   Schedule = "WinDiff" #  (     # (volume)    ) Pool = poolwinsrvnfs #   Client=winsrv-fd #       , #     , #    ,   #   -    ,  #   Write Bootstrap = "/var/lib/bacula/%n.bsr" #   messages,   #     Messages = Standard } Job { #      Name = "ResotreWinsrv" Type = Restore Client=winsrv-fd FileSet="WinFileSet" Storage = winsrv-nfs Pool = poolwinsrvnfs Messages = Standard #      #   .       # ,       Where = /1/ } 


client-sd-kubuntu.conf
Device {
# Name, name and password compliance will be discussed below.
Name = KubFileStorage
# type of
Media Type = File
# directory where files of this device are located (volumes, volumes)
Archive Device = / media / nfs_linbackup_v1 / kubuntu
# new volumes will be called up according to Pool settings (Vol * here), see
# config DD
LabelMedia = yes;
# for a File device should be like this
Random Access = Yes;
# if the device is open, use it
AutomaticMount = yes;
I think it is clear =)
RemovableMedia = no;
# open only when the corresponding task starts
AlwaysOpen = no;
}

client-sd-winsrv.conf
Device {
# Name, name and password compliance will be discussed below.
Name = winsrvFileStorage
# type of
Media Type = File
# directory where files of this device are located (volumes, volumes)
Archive Device = / media / nfs_linbackup_v2 / winsrv
# new volumes will be called up according to Pool settings (Vol * here), see
# config DD
LabelMedia = yes;
# for a File device should be like this
Random Access = Yes;
# if the device is open, use it
AutomaticMount = yes;
I think it is clear =)
RemovableMedia = no;
# open only when the corresponding task starts
AlwaysOpen = no;
}

ClientPCKUBUNT_usr_local_etc_bacula-fd.conf
Director {
Name = center.domain.local-dir
Password = "PassClient_3"
}
FileDaemon {
Name = kub-fd
FDport = 9102
WorkingDirectory = / var / lib / bacula
Pid Directory = / var / run / bacula
Maximum Concurrent Jobs = 20
FDAddress = 192.168.1.20 # client's address or name
}
Messages {
Name = Standard
director = center.domain.local-dir = all,! skipped,! restored
}

ClientPCWIN_backup_bacula_winsrv-fd.conf
# Client (File Services) to backup
Client {
Name = winsrv-fd
Address = 192.168.1.40
FDPort = 9102
Catalog = MyCatalog
Password = "PassClient_3"
File Retention = 30 days
Job Retention = 2 months
AutoPrune = yes
}

ClientPCWIN_ProgramFiles_Bacula_bacula-fd.conf
Director {
Name = center.domain.local-dir
Password = "PassClient_3"
}
FileDaemon {
Name = winsrv-fd
FDport = 9102
WorkingDirectory = "C: \\ Program Files \\ Bacula \\ working"
Pid Directory = "C: \\ Program Files \\ Bacula \\ working"
# Plugin Directory = "C: \\ Program Files \\ Bacula \\ plugins"
Maximum Concurrent Jobs = 10

Messages {
Name = Standard
director = center.domain.local-dir = all,! skipped,! restored
}



How to drive these locomotives


Our locomotive wound up and seemed to rush into our happy future. But you should always look at him. To do this, smart people came up with the Bacula Administration Tool (BAT). To use it, you need to install it from the repositories. Since all the distributions are different, we will not go into details. But it should be set up. To do this, open the /etc/bacula/bat.conf file on the computer from which we will manage and make changes:

 Director { Name = center.domain.local-dir DIRport = 9101 address = 192.168.1.100 Password = "Passdir_1" } 

If everything is configured correctly, run the Bacula Administration Tool and see a similar window:



Next, we need to see what all the tasks we have done - the JOBS tab. Especially this tab is useful to us when we will restore something.



Next, we will be interested to see what technology has already managed to do - tab Jobs Run



And if you double-click on the task, we get full information about what has been done, for how much and how things are.



Be sure to browse the Media tab, where we are clearly shown the occupancy of our files and their rewriting (Extremely handy thing, which allows us to determine if everything is good with our place. But then I went over the number of Wolums and my NAS quickly overflowed.)



And now the most important thing is how to recover. We already know the JOBS_RUN tab and select the completed task that has the file we need. But it happens that we do not know if the file we need is there. Clicking with the right button we get the menu in which you need to select “List files on job”.



Making sure that we have the file we need, go back to “Jobs Run” and on the task we need, call the context menu and select “Restore from Job” - restore from the task or “Restore from Time” - restore by time. In the window that appears, you can choose - by job number, or, in general, by task, by checking all settings in one.





Click "OK" and after a few seconds our eyes will see a tree of files saved in this task, where we need to check the files of interest.



After selecting the files, the system will prompt us to select the task that we will restore. An interesting feature is that if you do not have a restoration task for this particular client, you can use any restoration task only by changing the task parameters before applying it (see below). Click "OK" and enjoy the task.





That's basically it. I hope the article will find its reader. All files used in the article are on my disk.
Maybe too many pictures and texts, maybe there are mistakes, maybe some serious details are missing, but I tried to facilitate the use of the program for those who do not want to go deep (well, or for those who have little experience, for example for me).
PS The main thing that it worked, and everything else is not important

Source: https://habr.com/ru/post/211755/


All Articles