CentOS 8
Sponsored Link

Bacula : リストアの操作2020/02/14

 
取得したバックアップデータからのリストアの操作方法です。
[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     |        6 |      394 | 2020-02-12 19:35:56 | Vol-20200213 |
+-------+-------+----------+----------+---------------------+--------------+
You have selected the following JobId: 1

Building directory tree for JobId(s) 1 ...
4 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
  *testfile.txt
# リストア設定を終了
$ done
Bootstrap records written to /var/spool/bacula/bacula-dir.restore.3.bsr

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

    Vol-20200213              File1                     FileChgr1

Volumes marked with "*" are in the Autochanger.


6 files selected to be restored.

Using Catalog "MyCatalog"
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/spool/bacula/bacula-dir.restore.3.bsr
Where:           /tmp/bacula-restores
Replace:         Always
FileSet:         Full Set
Backup Client:   bacula-fd
Restore Client:  bacula-fd
Storage:         File1
When:            2020-02-12 19:47:30
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
# リストアジョブ実行
OK to run? (yes/mod/no): yes
Job queued. JobId=4
# メッセージ (ログ) を表示
*messages
12-Feb 19:47 bacula-dir JobId 4: Start Restore Job RestoreFiles.2020-02-12_19.47.32_13
12-Feb 19:47 bacula-dir JobId 4: Using Device "FileChgr1-Dev2" to read.
12-Feb 19:47 bacula-sd JobId 4: Ready to read from volume "Vol-20200213" on File device "FileChgr1-Dev2" (/tmp).
12-Feb 19:47 bacula-sd JobId 4: Forward spacing Volume "Vol-20200213" to addr=227
12-Feb 19:47 bacula-sd JobId 4: End of Volume "Vol-20200213" at addr=1747 on device "FileChgr1-Dev2" (/tmp).
12-Feb 19:47 bacula-sd JobId 4: Elapsed time=00:00:01, Transfer rate=952  Bytes/second
12-Feb 19:47 bacula-dir JobId 4: Bacula bacula-dir 9.0.6 (20Nov17):
  Build OS:               x86_64-redhat-linux-gnu redhat (Core)
  JobId:                  4
  Job:                    RestoreFiles.2020-02-12_19.47.32_13
  Restore Client:         bacula-fd
  Start time:             12-Feb-2020 19:47:34
  End time:               12-Feb-2020 19:47:35
  Files Expected:         6
  Files Restored:         6
  Bytes Restored:         490
  Rate:                   0.5 KB/s
  FD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Restore OK

12-Feb 19:47 bacula-dir JobId 4: Begin pruning Jobs older than 6 months .
12-Feb 19:47 bacula-dir JobId 4: No Jobs found to prune.
12-Feb 19:47 bacula-dir JobId 4: Begin pruning Files.
12-Feb 19:47 bacula-dir JobId 4: No Files found to prune.
12-Feb 19:47 bacula-dir JobId 4: End auto prune.

*exit

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

total 4
drwx------. 2 cent cent 62 Oct 12 22:39 cent
-rw-r--r--. 1 root root 19 Feb 12 19:28 testfile.txt
# リストアされた
[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

関連コンテンツ