Linux (サーバー制作) : 41:baculaで容量に余裕があるホストにリストアデーターを保存する
”バックアップ用のホストを作り直す”で何回も出てくるので、ここに方法を書く
もちろん baculaの設定は終わっていて、起動している。
bacula-dirが起動していないホストでも出来るみたいだが、やっていないのでbacula-dirが起動しているホスト(smb3) で作業をする。
例として、Clientの名前が web-fd、リストアしたいデーターが web-Rdata、余裕のあるホスト名が smb-fd とする。
# bconsole
Connecting to Director localhost:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
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
Defined Clients:
1: kvm-fd
2: smb-fd
3: web-fd
Select the Client (1-3): 3
The defined FileSet resources are:
1: web-Mail
2: web-Rdata
3: web-root
4: web-webdata
Select FileSet resource (1-4): 2
+-------+-------+----------+-------------+---------------------+------------+
| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |
+-------+-------+----------+-------------+---------------------+------------+
| 49 | F | 15,282 | 187,557,669 | 2017-10-18 03:47:34 | Vol-0020 |
| 164 | D | 167 | 1,542,522 | 2017-10-29 03:32:22 | Vol-0115 |
| 174 | I | 1 | 1,193,046 | 2017-10-30 03:28:10 | Vol-0124 |
| 184 | I | 1 | 1,193,146 | 2017-10-31 03:28:31 | Vol-0133 |
| 194 | I | 167 | 1,543,736 | 2017-11-01 03:29:03 | Vol-0142 |
| 204 | I | 1 | 1,194,890 | 2017-11-02 03:26:33 | Vol-0151 |
| 217 | I | 1 | 1,195,480 | 2017-11-03 04:05:36 | Vol-0160 |
| 233 | I | 167 | 1,548,364 | 2017-11-04 08:26:48 | Vol-0170 |
+-------+-------+----------+-------------+---------------------+------------+
You have selected the following JobIds: 49,164,174,184,194,204,217,233
Building directory tree for JobId(s) 49,164,174,184,194,204,217,233 ... +++++++++++++++++++++++++++++++++++++++++
12,664 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: /
$ mark *
15,282 files marked.
$ done
Bootstrap records written to /var/spool/bacula/bacula-dir.restore.8.bsr
The job will require the following
Volume(s) Storage(s) SD Device(s)
===========================================================================
Vol-0020 File FileStorage
Vol-0170 File FileStorage
Volumes marked with "*" are online.
15,282 files selected to be restored.
The defined Restore Job resources are:
1: Restore-smb-root
2: Restore-smb-SmbData
3: Restore-kvm-root
4: Restore-kvm-Download
5: Restore-kvm-Thunderbird
6: Restore-web-root
7: Restore-web-webdata
8: Restore-web-Mail
9: Restore-web-Rdata
Select Restore Job (1-9): 9
Run Restore job
JobName: Restore-web-Rdata
Bootstrap: /var/spool/bacula/bacula-dir.restore.8.bsr
Where: /SmbData/kinryo/Restores/web-Rdata
Replace: always
FileSet: web-Rdata
Backup Client: web-fd
Restore Client: web-fd
Storage: File
When: 2017-11-04 09:18:22
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no): m
Parameters to modify:
1: Level
2: Storage
3: Job
4: FileSet
5: Restore Client
6: When
7: Priority
8: Bootstrap
9: Where
10: File Relocation
11: Replace
12: JobId
13: Plugin Options
Select parameter to modify (1-13): 5
The defined Client resources are:
1: smb-fd
2: kvm-fd
3: web-fd
Select Client (File daemon) resource (1-3): 1
Run Restore job
JobName: Restore-web-Rdata
Bootstrap: /var/spool/bacula/bacula-dir.restore.8.bsr
Where: /SmbData/kinryo/Restores/web-Rdata
Replace: always
FileSet: web-Rdata
Backup Client: web-fd
Restore Client: web-fd
Storage: File
When: 2017-11-04 09:18:22
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no): y
Job queued. JobId=235
*
しばらくして終わったらメールが来る(bacula-dir.confに設定がある。bconsole のままmessageとして同じ内容が表示される。
リストアされたデーターをコピーするには
smb-fd(ホスト名smb3)ではsambaが起動しているので、保存された場所は(Where: /SmbData/kinryo/Restores/web-Rdata)は他のホストから参照が可能。
まずこのデーターをマウントする。
# mount.cifs //smb3.kinryokai.net/kinryo /test1 -o username=administrator
パスワードを聞かれる。/test1は作成して置く
ディレクトリを変更。
# cd /test1/Restores/web-Rdata
コピー先をマウント(例はLVMの領域)
# mount /dev/Data/Rdata /test2
/test2も作成して置く
# cp -pr ./ /test2
NFSでマウントする方法もある。ここを参照
投稿された内容の著作権はコメントの投稿者に帰属します。