CentOS Stream 8
Sponsored Link

Bacula : リストアの操作2021/06/22

 
取得したバックアップデータからのリストアの操作方法です。
[1] Bacula コンソールからリストアを実行します。
[root@dlp ~]#
bconsole

Connecting to Director localhost:9101
1000 OK: 103 bacula-dir Version: 9.0.6 (20 November 2017)
Enter a period to cancel a command.

# リストアタスクを開始
*restore
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"

First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.

To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     2: List Jobs where a given File is saved
     3: Enter list of comma separated JobIds to select
     4: Enter SQL list command
     5: Select the most recent backup for a client
     6: Select backup for a client before a specified time
     7: Enter a list of files to restore
     8: Enter a list of files to restore before a specified time
     9: Find the JobIds of the most recent backup for a client
    10: Find the JobIds for a backup for a client before a specified time
    11: Enter a list of directories to restore for found JobIds
    12: Select full restore to a specified Job date
    13: Cancel

Select item:  (1-13): 5
Automatically selected Client: bacula-fd
Automatically selected FileSet: Full Set
+-------+-------+----------+----------+---------------------+--------------+
| JobId | Level | JobFiles | JobBytes | StartTime           | VolumeName   |
+-------+-------+----------+----------+---------------------+--------------+
|     1 | F     |        5 |      396 | 2021-06-21 03:03:05 | Vol-20210621 |
+-------+-------+----------+----------+---------------------+--------------+
You have selected the following JobId: 1

Building directory tree for JobId(s) 1 ...
3 files inserted into the tree.

You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.

cwd is: /

# バックアップデータを一覧表示
$ ls
home/
# リストアしたいデータをマーキング
$ mark home
6 files marked.
# マーキングしたデータを一覧表示
$ lsmark
*home/
  *cent/
    *.bash_logout
    *.bash_profile
    *.bashrc
# リストア設定を終了
$ done
Bootstrap records written to /var/spool/bacula/bacula-dir.restore.1.bsr

The Job will require the following (*=>InChanger):
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================

    Vol-20210621              File1                     FileChgr1

Volumes marked with "*" are in the Autochanger.


5 files selected to be restored.

Using Catalog "MyCatalog"
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/spool/bacula/bacula-dir.restore.1.bsr
Where:           /tmp/bacula-restores
Replace:         Always
FileSet:         Full Set
Backup Client:   bacula-fd
Restore Client:  bacula-fd
Storage:         File1
When:            2021-06-21 03:15:54
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*

# リストアジョブ実行
OK to run? (yes/mod/no): yes
Job queued. JobId=2

# メッセージ (ログ) を表示
*messages
21-Jun 03:16 bacula-dir JobId 2: Start Restore Job RestoreFiles.2021-06-21_03.16.15_05
21-Jun 03:16 bacula-dir JobId 2: Using Device "FileChgr1-Dev2" to read.
21-Jun 03:16 bacula-sd JobId 2: Ready to read from volume "Vol-20210621" on File device "FileChgr1-Dev2" (/tmp).
21-Jun 03:16 bacula-sd JobId 2: Forward spacing Volume "Vol-20210621" to addr=227
21-Jun 03:16 bacula-sd JobId 2: End of Volume "Vol-20210621" at addr=1625 on device "FileChgr1-Dev2" (/tmp).
21-Jun 03:16 bacula-sd JobId 2: Elapsed time=00:00:01, Transfer rate=866  Bytes/second
21-Jun 03:16 bacula-dir JobId 2: Bacula bacula-dir 9.0.6 (20Nov17):
  Build OS:               x86_64-redhat-linux-gnu redhat (Core)
  JobId:                  2
  Job:                    RestoreFiles.2021-06-21_03.16.15_05
  Restore Client:         bacula-fd
  Start time:             21-Jun-2021 03:16:17
  End time:               21-Jun-2021 03:16:18
  Files Expected:         5
  Files Restored:         5
  Bytes Restored:         535
  Rate:                   0.5 KB/s
  FD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Restore OK

21-Jun 03:16 bacula-dir JobId 2: Begin pruning Jobs older than 6 months .
21-Jun 03:16 bacula-dir JobId 2: No Jobs found to prune.
21-Jun 03:16 bacula-dir JobId 2: Begin pruning Files.
21-Jun 03:16 bacula-dir JobId 2: No Files found to prune.
21-Jun 03:16 bacula-dir JobId 2: End auto prune.

*exit

[root@dlp ~]#
ll /tmp/bacula-restores/home

total 0
drwx------. 2 cent cent 62 Feb 18 00:50 cent
# リストアされた
[2] SELinux を有効にしている場合は、リストアが失敗するため、ポリシーの変更が必要です。
[root@dlp ~]#
vi baculafd.te
# 以下の内容で新規作成

module baculafd 1.0;

require {
        type bacula_t;
        type bacula_tmp_t;
        class lnk_file { create setattr };
        class capability dac_override;
}

#============= bacula_t ==============
allow bacula_t bacula_tmp_t:lnk_file { create setattr };
allow bacula_t self:capability dac_override;

[root@dlp ~]#
checkmodule -m -M -o baculafd.mod baculafd.te

checkmodule: loading policy configuration from baculafd.te
checkmodule: policy configuration loaded
checkmodule: writing binary representation (version 19) to baculafd.mod
[root@dlp ~]#
semodule_package --outfile baculafd.pp --module baculafd.mod

[root@dlp ~]#
semodule -i baculafd.pp

関連コンテンツ