2011年7月24日

Bacula網路備份工具 (四)還原篇

開啟bconsole輸入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):
比較常用的幾個選項就是
1:列出最後20個Job
3:輸入JobIds 從這個JobId做還原
5:選一個client(FD),從最新的備份來還原

選1會看到Job的清單,記得你要還原的JobId

選3 輸入剛剛記下來的JobId
再來要使用mark指令,把你要還原的東西選出來
Enter JobId(s), comma separated, to restore: 65
You have selected the following JobId: 65

Building directory tree for JobId(s) 65 ... 
2 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 和cd 指令看有哪些東西可以選,或是進到特定的目錄中
像這樣
cwd is: /
$ ls
e:/
$ cd e:/
cwd is: e:/
$ ls
abc/
$ mark abc
4 files marked.
$ ls
*abc/
$ done
被mark的目錄 ,前面會出現" * "
如果mark到不想選的東西,可以用unmark來取消
選好以後輸入done畫面變成下面這樣
Bootstrap records written to /var/lib/bacula/yucing-dir.restore.4.bsr

The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
================================================================
    Vol0001                   File                      FileStorage             

Volumes marked with "*" are online.


4 files selected to be restored.

The defined Restore Job resources are:
     1: RestoreFiles
     2: RestoreFiles51
Select Restore Job (1-2): 1
Defined Clients:
     1: yucing-fd
     2: yucing-pc-fd
Select the Client (1-2): 2
選擇用來還原的 Job 和 Clients (FD)
這邊是選 看你在bacula-dir.conf中設定的 Job哪個比較符合現在還原動作的需求
不過詳細的內容還是可以再後面修改
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/lib/bacula/yucing-dir.restore.4.bsr
Where:           /bacula/backup/bacula2/
Replace:         always
FileSet:         TEST
Backup Client:   yucing-pc-fd
Restore Client:  yucing-pc-fd
Storage:         File
When:            2011-07-24 16:09:19
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no):
再來會跟你說現在要做的還原工作的詳細內容
要取消輸入no
要調整設定輸入mod
確定無誤可以還原了就輸入yes

因為上面的where沒有設定到一開始備份來的地方,所以要還原到一開始備份的地方要選mod
OK to run? (yes/mod/no): mod
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): 9
Please enter path prefix for restore (/ for none): /
選9 把where改成 / 就會把檔案還原到原來的地方
不然他會還原到他預設的路徑去
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/lib/bacula/yucing-dir.restore.4.bsr
Where:         
Replace:         always
FileSet:         TEST
Backup Client:   yucing-pc-fd
Restore Client:  yucing-pc-fd
Storage:         File
When:            2011-07-24 16:09:19
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=78
You have messages.
設定好以後就輸入yes 還原工作就完成了
(如果還原比較多或比較大的檔案要稍等一下才會有messages)

沒有留言:

張貼留言