bacula II
bacula II – Backup ,Restore for windows server 2008 R2
I will use LTO4 tape drive to store multiple copies of window server backup images , hence I can restore backup images of certain date into the usb external harddrive for bare metal restore in windows server 2008 .
Windows Server 2008 Backup :
As for windows 2008 server bare metal recovery, it need to access the files from external usb harddrive , but not from any remote network drive . So I will do the “backup once…” and save the backup files into external usb drive . In my case , I have quite a number of 2008 servers , so I have save all these images into the usb drive , and then backup the whole usb drive to bacula server in my centos box.
1. Backup the windows 2008 Server R2’s system image to a usb drive , Server Manager -> Storage -> Windows Server Backup -> “Backup Once … “
This is the normal backup of whole Windows server 2008 system. Suppose the usb drive is E: , the directory used to store the images is E:\WindowsImageBackup\clienthost
System images of other machine will occupy directory under D:\WindowsImageBackup\{machine name II}
Backup external USB disk to bacula server
To backup the usb drive data from windows server (clienthost) to bacula server serverhost , first you need to install the bacula client as described in bacula I
Now the task is backup E:\ in clienthost’s external USB DISK into tape drive in serverhost
Ensure the clienthost can connect to serverhost , then update /usr/local/bacula/bin/bacula-dir.conf with below , so that bacula server knows it need to backup clienthost’s E:\ drive and when bacula do restore , files will go to E:\restore .
Job {
Name = “clienthost-fd”
Type = Backup
Client=clienthost-fd
FileSet=”Windows FileSet”
Storage = LTO-4
Pool = Default
Messages = Standard
Level = Full
}
Job {
Name = “clienthostRestore”
Type = Restore
Client=clienthost-fd
FileSet=”Windows FileSet”
Storage = File
Pool = Default
Messages = Standard
Where = “E:/restore”
}
FileSet {
Name = “Windows FileSet”
Include {
Options {
signature = MD5
compression = GZIP
}
File = “E:/”
}
}
After changes are made, restart bacula server :
% /usr/local/bacula/bin/bacula restart
Start the backup from clienthost now , by running bconsole :
* run
Automatically selected Catalog: MyCatalog
Using Catalog “MyCatalog”
A job name must be specified.
The defined Job resources are:
1: BackupCatalog
2: RestoreFiles
3: WinRestoreFiles
4: clienthost-fd
Select Job resource (1-5): 4
…..
OK to run (yes/mod/no) : yes
To see how the job is running , use bconsole command “messages” . But then you will find that the backup is paused , because you have not label the tape :
* messages
……. Cannot find any appendable volumes.Please use the “label” command to create a new Volume for :
Storage : “LTO-4” (/dev/nst0)
…
So you use bconsole command “label” to label the tape with arbitrary name “win01”
* label
The defined Storage resources are:
1: File
2: LTO-4
Select Storage resource (1-2): 2
Connecting to Storage daemon LTO-4 at serverhost:9103 …
3995 Device “LTO-4” (/dev/nst0) is not an autochanger.
Enter autochanger drive[0]:
Enter new Volume name: win01
Enter slot (0 or Enter for none):
Defined Pools:
1: Default
2: File
3: Scratch
Select the Pool (1-3): 1
Connecting to Storage daemon LTO-4 at serverhost:9103 …
Sending label command for Volume “win01” Slot 0 …
block.c:1002 Read error on fd=3 at file:blk 0:0 on device “LTO-4” (/dev/nst0). ERR=Cannot allocate memory.
3000 OK label. VolBytes=350196360192 DVD=0 Volume=”win01″ Device=”LTO-4″ (/dev/nst0)
Catalog record for Volume “test0002”, Slot 0 successfully created.
Requesting to mount LTO-4 …
3001 OK mount requested. Device=”LTO-4″ (/dev/nst0)
*
You can type “message” command again to see if there is any error messages. If things go well , and the backup is done , you will receive Email from bacula server with backup report . You can reconfigure the Email Address and smtp server in “Messages” block in serverhost:/usr/local/bacula/bin/bacula-dir.conf . The report Email is of below similar content :
From : you@foo.com
Subject : Bacula: Backup OK of client-fd Full
To : you@foo.com
26-May 16:01 serverhost-dir JobId 7: Start Backup JobId 7, Job=clienthost-fd.2011-05-26_16.01.06_03
26-May 16:01 serverhost-dir JobId 7: Using Device “LTO-4” 26-May 16:01 serverhost-sd JobId 7:
Please mount Volume “win01” or label a new one for:
Job: clienthost-fd.2011-05-26_16.01.06_03
Storage: “LTO-4” (/dev/nst0)
Pool: Default
Media type: LTO-4
26-May 16:02 clienthost-fd JobId 7: Generate VSS snapshots. Driver=”VSS Vista”, Drive(s)=”G”
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “System Writer”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 serverhost-sd JobId 7: Job write elapsed time = 12:45:37, Transfer rate = 7.615 M Bytes/second
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “ASR Writer”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “SqlServerWriter”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “Shadow Copy Optimization Writer”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “BITS Writer”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “TermServLicensing”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “IIS Metabase Writer”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “Registry Writer”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “COM+ REGDB Writer”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “WMI Writer”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 clienthost-fd JobId 7: VSS Writer (BackupComplete): “IIS Config Writer”, State: 0x1 (VSS_WS_STABLE)
27-May 04:48 serverhost-dir JobId 7: Bacula serverhost-dir 5.0.3 (04Aug10): 27-May-2011 04:48:23
Build OS: x86_64-unknown-linux-gnu redhat release
jobId: 7
Job: clienthost-fd.2011-05-26_16.01.06_03
Backup Level: Full
Client: “clienthost-fd” 5.0.3 (04Aug10) Linux,Cross-compile,Win64
FileSet: “Windows FileSet” 2011-05-26 16:01:06
Pool: “Default” (From Job resource)
Catalog: “MyCatalog” (From Client resource)
Storage: “LTO-4” (From Job resource)
Scheduled time: 26-May-2011 16:00:06
Start time: 26-May-2011 16:01:08
End time: 27-May-2011 04:48:23
Elapsed time: 12 hours 47 mins 15 secs
Priority: 10
FD Files Written: 25,214
SD Files Written: 25,214
FD Bytes Written: 349,835,913,069 (349.8 GB)Elapsed time: 12 hours 47 mins 15 secs
Priority: 10
FD Files Written: 25,214
SD Files Written: 25,214
FD Bytes Written: 349,835,913,069 (349.8 GB)
SD Bytes Written: 349,841,281,703 (349.8 GB)
Rate: 7599.3 KB/s
Software Compression: 59.6 %
VSS: yes
Encryption: no
Accurate: no
Volume name(s): usb1t26may11
Volume Session Id: 1
Volume Session Time: 1306396722
Last Volume Bytes: 350,196,295,680 (350.1 GB)
Non-fatal FD errors: 0
SD Errors: 0
FD termination status: OK
SD termination status: OK
Termination: Backup OK
Restore windows server 2008 from bacula server to external USB disk
To restore those windows files back to external usb disk , you should ensure the restore job resources is available in serverhost:/usr/local/bacula/bin/bacula-dir.conf (note: if you have follow the above section, you should already have this updated) , i.e.
Job {
Name = “clienthostRestore”
Type = Restore
Client=clienthost-fd
FileSet=”Windows FileSet”
Storage = File
Pool = Default
Messages = Standard
Where = “E:/restore”
}FileSet {
Name = “Windows FileSet”
Include {
Options {
signature = MD5
compression = GZIP
}
File = “E:/”
}
}
If you have updated this bacula-dir.conf , you should restart bacula again . Since I don’t want to replace the existing directory E:\WindowsImageBackup\clienthost\ after restore . So the Restore Job resources use E:\restore\ directory for restoring files. To start the restore , use bconsole command “restore all” :
Connecting to Director serverhost:9101
1000 OK: serverhost-dir Version: 5.0.3 (04 August 2010)
Enter a period to cancel a command.
* restore all
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: serverhost-fd
2: clienthost-fdSelect the Client (1-2): 2
Automatically selected FileSet: Catalog
+——-+——-+———-+———-+———————+—————+
| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |
+——-+——-+———-+———-+———————+—————+
| 2 | F | 9 | 349,835,913,069 | 26-May-2011 16:01:08 | win01 |
+——-+——-+———-+———-+———————+—————+
You have selected the following JobId: 2Building directory tree for JobId(s) 2 …
1 files inserted into the tree and marked for extraction.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: /
$
$ dir
———- 0 root root 33388 2011-05-25 23:10:02 E:/
$ add E:/
10 file marked.
$ done
Bootstrap records written to /usr/local/bacula/bin/working/seis04.se.cuhk.edu.hk-dir.restore.1.bsrThe job will require the following
Volume(s) Storage(s) SD Device(s)
===========================================================================win01 LTO-4 LTO-4
Volumes marked with “*” are online.
9 file selected to be restored.
The defined Restore Job Resources are :
1: RestoreFiles
2: clienthostRestore
Select Restore Job (1-2): 2
Run Restore job
JobName: clienthostRestore
Bootstrap: /usr/local/bacula/bin/working/seis04.se.cuhk.edu.hk-dir.restore.1.bsr
Where: E:/restore
Replace: always
FileSet: Full Set
Backup Client: clienthost-fd
Restore Client: clienthost-fd
Storage: LTO-4
When: 2011-05-26 12:24:31
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=4* messages
If things go well and after the restore is done , you should receive an Email about the restore report .
Windows Server 2008 Bare Metal Restore :
Suppose the system disk of windows 2008 server r2 fails , and a new disk is replaced. To do a bare metal restore , you have to boot up your machine with Windows 2008 R2 DVD , then Select the option “Repair your Computer ”
Since the disk is new , so no OS should be found , select the second option to restore the computer from a system images you created earlier :
Select the images you have restored in USB external Hard drive and follow on-screen instruction for restoring the images.