一、实例演示bacula的完全备份功能
1.创建卷组
执行如下命令,连接到bacula控制端,执行备份恢复操作:
[root@baculaserver opt]#/opt/bacula/sbin/bconsole Connecting to Director 192.168.12.188:9101 1000 OK: f10-64-build-dir Version: 3.0.2 (18 July 2009) Enter a period to cancel a command *label Automatically selected Storage: dbsd Enter new Volume name: cicro4 #卷组名称,可随意指定,指定完毕后会在 #bacula-dir.conf文件的指定位置生成一个cicro4文件 Defined Pools: 1: dbpool 2: Scratch Select the Pool (1-2): 1 #指定卷组的放置位置,即为SD名称。 #Dbpool在bacula-dir.conf中定义 Connecting to Storage daemon dbsd at 192.168.12.188:9103 ... #由于指定SD在 #192.168.12.188主机上,因此将卷cicro4创建到了此主机上 Sending label command for Volume "cicro4" Slot 0 ... 3000 OK label. VolBytes=191 DVD=0 Volume="cicro4" Device="dbdev" (/cicro/backup2) Catalog record for Volume "cicro4", Slot 0 successfully created. Requesting to mount dbdev ... 3906 File device "dbdev" (/cicro/backup2) is always mounted.
2.利用run命令执行备份操作
下面继续在bacula控制端执行备份操作:
*run A job name must be specified. The defined Job resources are: 1: Client1 #这里的Client1 是在bacula-dir.conf中定义的一个Job执行任务 2: Client #这里的Client 也是在bacula-dir.conf中定义的一个Job执行任务 3: BackupCatalog 4: RestoreFiles Select Job resource (1-2): 1 Run Backup job JobName: Client1 Level: Incremental Client: dbfd FileSet: dbfs Pool: dbpool (From Job resource) Storage: dbsd (From Job resource) When: 2009-08-21 13:40:13 Priority: 10 OK to run? (yes/mod/no): yes Job queued. JobId=67
到此为止,可以开始执行备份,在bacula-dir.conf文件中定义的Client1是一个增量备份,因此这个备份只是个增量操作。由于这是第一个备份,因此默认Client1会做一个完全备,第二次备份时,才执行增量备份。
3.查看备份状态
在bacula控制端利用“status”可以查看bacula的各种状态,这里查看备份时Director端的一个状态信息。
*status Status available for: 1: Director 2: Storage 3: Client 4: All Select daemon type for status (1-4): 1 f10-64-build-dir Version: 3.0.2 (18 July 2009) x86_64-unknown-linux-gnu RedHat Daemon started 21-Aug-09 13:22, 0 Jobs run since started. Heap: heap=241,664 smbytes=82,242 max_bytes=82,498 bufs=245 max_bufs=250 Scheduled Jobs: Level Type Pri Scheduled Name Volume =============================================================================== Incremental Backup 10 21-Aug-09 23:05 Client1 cicro4 Running Jobs: Console connected at 21-Aug-09 13:37 JobId Level Name Status ====================================================================== 67 Full Client1.2009-08-21_13.40.16_07 is running 由此可知,备份正在进行,备份完成再次查看备份信息,输出如下: *status Status available for: 1: Director 2: Storage 3: Client 4: All Select daemon type for status (1-4): 1 由于这里bacula将备份的存储端(SD)和控制端(DIR)设置在一台服务器上,因此可以通过选项1“Director”来查看SD的状态,如果SD端和DIR端不在一台服务器上,要查看选项2,即“Storage”。这里选择选项1r后输出内容如下: f10-64-build-dir Version: 3.0.2 (18 July 2009) x86_64-unknown-linux-gnu redhat Daemon started 21-Aug-09 13:22, 1 Job run since started. Heap: heap=241,664 smbytes=73,891 max_bytes=84,825 bufs=212 max_bufs=250 Scheduled Jobs: Level Type Pri Scheduled Name Volume =============================================================================== Incremental Backup 10 21-Aug-09 23:05 Client1 cicro4 Running Jobs: Console connected at 21-Aug-09 13:42 No Jobs running. Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 58 Incr 2 46.85 M OK 19-Aug-09 16:51 Client1 59 Incr 2 3.908 M OK 19-Aug-09 16:51 Client1 60 Incr 2 8.377 K OK 19-Aug-09 16:52 Client1 61 Incr 1 0 OK 19-Aug-09 16:53 Client1 62 Incr 2 8.344 K OK 19-Aug-09 16:53 Client1 63 Incr 2 8.377 K OK 19-Aug-09 16:54 Client1 64 3 77.44 K OK 19-Aug-09 16:57 RestoreFiles 65 1 0 OK 19-Aug-09 16:58 RestoreFiles 66 2 38.77 K OK 19-Aug-09 16:59 RestoreFiles 67 Full 25 145.5 M OK 21-Aug-09 13:41 Client1
这里可以看到,JobId为67的备份是一个完全备份,备份数据的文件数为25个,备份压缩后的大小为145.5MB,备份完成在“21-Aug-09 13:41”,最后的Client1是备份资源的名称。