三、实例演示bacula的差异备份功能
差异备份与增量备份的原理,前面已经介绍过了,这里只给出具体的操作步骤。
1.开始执行备份
*run Automatically selected Catalog: MyCatalog Using Catalog "MyCatalog" A job name must be specified. The defined Job resources are: 1: Client1 2: Client 3: BackupCatalog 4: RestoreFiles Select Job resource (1-4): 2 #这里有两个Job任务可选,名为Client1的为增量 #备份操作,名为Client的为差异备份操作 Run Backup job JobName: Client Level: Differential Client: dbfd FileSet: dbfs Pool: dbpool (From Job resource) Storage: dbsd (From Job resource) When: 2009-08-21 14:31:04 Priority: 10 OK to run? (yes/mod/no): yes Job queued. JobId=69 You have messages. 至此,开始执行差异备份,如果备份的数据量较大,可能需要一段时间才能完成备份。下面可以用“status”指令查看备份的状态。 2.查看备份状态 *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 14:30, 0 Jobs run since started. Heap: heap=253,952 smbytes=67,810 max_bytes=68,066 bufs=267 max_bufs=272 Scheduled Jobs: Level Type Pri Scheduled Name Volume =========================================================================== Incremental Backup 10 21-Aug-09 23:05 Client1 cicro4 Incremental Backup 10 21-Aug-09 23:05 Client cicro4 Incremental Backup 10 21-Aug-09 23:05 BackupCatalog cicro4 Running Jobs: Console connected at 21-Aug-09 14:30 JobId Level Name Status ====================================================================== 69 Full Client.2009-08-21_14.31.10_03 is running Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 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 68 Incr 2 3.908 M OK 21-Aug-09 14:20 Client1 从上面可以看到,备份还没有完成,备份状态为running。 等待几分钟,再次查看备份状态如下: * 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 14:30, 1 Job run since started. Heap: heap=253,952 smbytes=65,680 max_bytes=78,853 bufs=240 max_bufs=274 Scheduled Jobs: Level Type Pri Scheduled Name Volume ========================================================================== Incremental Backup 10 21-Aug-09 23:05 Client1 cicro4 Incremental Backup 10 21-Aug-09 23:05 Client cicro4 Incremental Backup 10 21-Aug-09 23:05 BackupCatalog cicro4 Running Jobs: Console connected at 21-Aug-09 14:30 No Jobs running. Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 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 68 Incr 2 3.908 M OK 21-Aug-09 14:20 Client1 69 Full 26 149.4 M OK 21-Aug-09 14:32 Client 从这里可以看到,JobId为69的备份已经完成,并且是一个完全备份,备份文件大小为149.4MB,而完成此差异备份的Job任务名称是Client。 3.继续执行备份操作 在执行下面的操作前,首先在客户端FD需要备份的文件夹下(根据前面的配置可知,应该是/cws3)增加一个大小为3.8MB左右的文件。 * run A job name must be specified. The defined Job resources are: 1: Client1 2: Client 3: BackupCatalog 4: RestoreFiles Select Job resource (1-4): 2 Run Backup job JobName: Client Level: Differential Client: dbfd FileSet: dbfs Pool: dbpool (From Job resource) Storage: dbsd (From Job resource) When: 2009-08-21 14:34:25 Priority: 10 OK to run? (yes/mod/no): yes Job queued. JobId=70 *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 14:30, 2 Jobs run since started. Heap: heap=253,952 smbytes=67,989 max_bytes=81,162 bufs=240 max_bufs=274 Scheduled Jobs: Level Type Pri Scheduled Name Volume =========================================================================== Incremental Backup 10 21-Aug-09 23:05 Client1 cicro4 Incremental Backup 10 21-Aug-09 23:05 Client cicro4 Incremental Backup 10 21-Aug-09 23:05 BackupCatalog cicro4 Running Jobs: Console connected at 21-Aug-09 14:30 No Jobs running. Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 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 68 Incr 2 3.908 M OK 21-Aug-09 14:20 Client1 69 Full 26 149.4 M OK 21-Aug-09 14:32 Client 70 Diff 2 3.908 M OK 21-Aug-09 14:34 Client
从JobId为70的备份信息可以看出,此备份为差异增量备份,此次进行差异备份的数据量大小刚好为3.908 MB,与前面增加的文件大小基本相同。
为了证明是前面执行的是差异增量备份,在FD端需要备份的文件夹下再次增加一个大小为3.8MB左右的一个文件,继续执行以下备份操作:
*run A job name must be specified. The defined Job resources are: 1: Client1 2: Client 3: BackupCatalog 4: RestoreFiles Select Job resource (1-4): 2 Run Backup job JobName: Client Level: Differential Client: dbfd FileSet: dbfs Pool: dbpool (From Job resource) Storage: dbsd (From Job resource) When: 2009-08-21 14:34:59 Priority: 10 OK to run? (yes/mod/no): yes Job queued. JobId=71 *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 14:30, 3 Jobs run since started. Heap: heap=253,952 smbytes=69,087 max_bytes=82,260 bufs=240 max_bufs=274 Scheduled Jobs: Level Type Pri Scheduled Name Volume =========================================================================== Incremental Backup 10 21-Aug-09 23:05 Client1 cicro4 Incremental Backup 10 21-Aug-09 23:05 Client cicro4 Incremental Backup 10 21-Aug-09 23:05 BackupCatalog cicro4 Running Jobs: Console connected at 21-Aug-09 14:30 No Jobs running. Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 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 68 Incr 2 3.908 M OK 21-Aug-09 14:20 Client1 69 Full 26 149.4 M OK 21-Aug-09 14:32 Client 70 Diff 2 3.908 M OK 21-Aug-09 14:34 Client 71 Diff 3 7.817 M OK 21-Aug-09 14:35 Client
由JobId为71的备份可以看出,此次备份的大小为7.817 M,刚好是上次差异增量备份的大小与此次增加文件的大小之和,由此证明确实为差异备份。