前提
Baculaからのリストアは、システムのファイルに間違って上書きすることを避けるため、bacula-dirのJobリソースで指定した場所に復元されます。
/etc/bacula/bacula-dir.conf
Job {
Name = "RestoreFiles"
Type = Restore
Client=bacula-fd
FileSet="Full Set"
Storage = File1
Pool = File
Messages = Standard
Where = /tmp/bacula-restores ←ここ
}
リストア手順
ここではconsoleでの手順をまとめます。
リストアの準備
bconsoleを起動
[root@bacula ~]# bconsole
Connecting to Director 192.168.10.10:9101
1000 OK: 1 bacula-dir Version: 7.0.5 (28 July 2014)
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」を選択します。
リストアするクライアントの選択
Select item: (1-13): 5
Defined Clients:
1: bacula-fd
2: client2-fd
Select the Client (1-2):
File Setの選択
Select the Client (1-2): 2
The defined FileSet resources are:
1: Catalog
2: Full Set
Select FileSet resource (1-2):
「2」を選択します。
Select FileSet resource (1-2): 2
+-------+-------+----------+------------+---------------------+------------+
| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |
+-------+-------+----------+------------+---------------------+------------+
| 10 | F | 1,356 | 21,294,579 | 2016-07-26 16:49:04 | Full-0001 |
| 18 | I | 1 | 0 | 2016-07-27 02:00:00 | Inc-0002 |
+-------+-------+----------+------------+---------------------+------------+
You have selected the following JobIds: 10,18
Building directory tree for JobId(s) 10,18 ... +++++++++++++++++++++++++++++++++++++++++++
1,216 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: /
$
直近のバックアップデータが表示され、コマンドプロンプトが「$」になります。
ここまででリストアの準備が完了です。
リストアの実行
リストアは、バックアップしてあるデータ全てをリストアすることも可能ですし、ファイルを選んで特定のファイルのみリストアすることも可能です。コマンドはLinuxのコマンドと同様の操作が可能です。
$ ls
etc/
$ cd etc/
cwd is: /etc/
$ ls
.java/
.pwd.lock
.updated
DIR_COLORS
DIR_COLORS.256color
DIR_COLORS.lightbgcolor
GREP_COLORS
NetworkManager/
X11/
adjtime
(略)
リストアするファイルはmark ファイル名
で選択します。
ディレクトリを全て選択する場合はmark *
とします。
$ mark test
1 file marked.
$
リストアするファイルを選択したらdone
で実行します。
OK to run? (yes/mod/no):
はyes
で。
$ done
Bootstrap records written to /var/spool/bacula/bacula-dir.restore.2.bsr
The Job will require the following (*=>InChanger):
Volume(s) Storage(s) SD Device(s)
===========================================================================
Full-0001 File FileStorage
Volumes marked with "*" are in the Autochanger.
1 file selected to be restored.
Using Catalog "MyCatalog"
Run Restore job
JobName: RestoreFiles
Bootstrap: /var/spool/bacula/bacula-dir.restore.2.bsr
Where: /var/bacula/restore
Replace: always
FileSet: Full Set
Backup Client: bacula-fd
Restore Client: bacula-fd
Storage: File
When: 2016-07-27 11:58:49
Catalog: MyCatalog
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=21
*
確認
復元先サーバの/tmp/bacula-restores/etc/
に戻っているか確認できれば終了です。