]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/fr/main/rescue.tex
Reset everything to English
[bacula/docs] / docs / manuals / fr / main / rescue.tex
1 %%
2 %%
3
4 \chapter{Disaster Recovery Using Bacula}
5 \label{RescueChapter}
6 \index[general]{Disaster Recovery Using Bacula}
7 \index[general]{Bacula!Disaster Recovery Using}
8 \index[general]{Recovery!Disaster Recovery}
9 \index[general]{Rescue!Disaster Recovery}
10
11 \section{General}
12 \index[general]{General}
13
14 When disaster strikes, you must have a plan, and you must have prepared in
15 advance otherwise the work of recovering your system and your files will be
16 considerably greater.  For example, if you have not previously saved the
17 partitioning information for your hard disk, how can you properly rebuild
18 it if the disk must be replaced?
19
20 Unfortunately, many of the steps one must take before and immediately after
21 a disaster are very operating system dependent.  As a consequence, this
22 chapter will discuss in detail disaster recovery (also called Bare Metal
23 Recovery) for {\bf Linux} and {\bf Solaris}.  For Solaris, the procedures
24 are still quite manual.  For FreeBSD the same procedures may be used but
25 they are not yet developed.  For Win32, a number of Bacula users have
26 reported success using BartPE.
27
28
29 \label{considerations1}
30 \section{Important Considerations}
31 \index[general]{Important Considerations}
32 \index[general]{Considerations!Important}
33
34 Here are a few important considerations concerning disaster recovery that
35 you should take into account before a disaster strikes.
36
37 \begin{itemize}
38 \item If the building which houses your computers burns down or is otherwise 
39    destroyed, do you have off-site backup data? 
40 \item Disaster recovery is much easier if you have several machines. If  you
41    have a single machine, how will you handle unforeseen events  if your only
42    machine is down? 
43 \item Do you want to protect your whole system and use Bacula to  recover
44    everything? or do you want to try to restore your system from  the original
45    installation disks and apply any other updates and  only restore user files? 
46 \end{itemize}
47
48 \label{steps1}
49 \section{Steps to Take Before Disaster Strikes}
50 \index[general]{Steps to Take Before Disaster Strikes}
51 \index[general]{Strikes!Steps to Take Before Disaster}
52
53 \begin{itemize}
54 \item Create a rescue or CDROM for each of your Linux systems. Generally,
55    they are offered by each distribution, and there are many good 
56    rescue disks on the Web (Knoppix, sysrescuecd, PLD Linux rescue CD,
57    tomsrtbt, RIP ...
58
59 \item Create a bacula-hostname directory on 
60    each machine and save it somewhere -- possibly on a USB key.
61 \item Ensure that you always have a valid bootstrap file for your backup and 
62    that it is saved to an alternate machine.  This will permit you to
63    easily do a full restore of your system.
64 \item If possible copy your catalog nightly to an alternate machine.  If you
65    have a valid bootstrap file, this is not necessary, but  can be very useful if
66    you do not want to reload everything. .  
67 \item Ensure that you always have a valid bootstrap file for your  catalog
68    backup that is saved to an alternate machine. This will  permit you to restore
69    your catalog more easily if needed.  
70 \item Test using the Rescue CDROM before you are forced to use it in
71    an emergency situation.
72 \item Make a copy of your Bacula .conf files, particularly your
73    bacula-dir.conf, and your bacula-sd.conf files, because if your server
74    goes down, these files will be needed to get it back up and running,
75    and they can be difficult to rebuild from memory.
76 \end{itemize}
77
78 \label{rescueCDROM}
79 \section{Bare Metal Recovery on Linux with a Rescue CD}
80 \index[general]{Bare Metal Recovery on Linux with a Rescue CD}
81 \index[general]{CDROM!Bare Metal Recovery on Linux with a Rescue}
82
83 As an alternative to creating a Rescue CD, please see the
84 section below entitled \ilink{Bare Metal Recovery using a LiveCD}{LiveCD}.
85
86 Bacula previously had a Rescue CD.  Unfortunately, this CD did not work
87 on every Linux Distro, and in addition, Linux is evolving with different
88 boot methods, more and more complex hardware configurations (LVM, RAID, 
89 WiFi, USB, ...).  As a consequence, the Bacula Rescue CD as it was
90 originally envisioned no longer exists.
91
92 However there are many other good rescue disks available.
93 A so called "Bare Metal" recovery is one where you start with an empty hard
94 disk and you restore your machine. There are also cases where you may lose a
95 file or a directory and want it restored. Please see the previous chapter for
96 more details for those cases. 
97
98 Bare Metal Recovery assumes that you have the following items for your system:
99
100 \begin{itemize}
101 \item A Rescue CDROM containing a copy of your OS.
102 \item Perhaps a copy of your
103    hard disk information, as well as a statically linked version of the
104    Bacula File daemon.  
105 \item A full Bacula backup of your system possibly including  Incremental or
106    Differential backups since the last Full  backup 
107 \item A second system running the Bacula Director, the Catalog, and the
108    Storage daemon.  (this is not an absolute requirement, but how to get
109    around it is not yet documented here)
110 \end{itemize}
111
112 \section{Requirements}
113 \index[general]{Requirements}
114
115
116 \label{restore_client}
117 \section{Restoring a Client System}
118 \index[general]{Restoring a Client System}
119 \index[general]{System!Restoring a Client}
120
121 Now, let's assume that your hard disk has just died and that you have replaced
122 it with an new identical drive. In addition, we assume that you have: 
123
124 \begin{enumerate}
125 \item A recent Bacula backup (Full plus Incrementals)  
126 \item A Rescue CDROM.  
127 \item Your Bacula Director, Catalog, and Storage daemon running  on another
128    machine on your local network. 
129 \end{enumerate}
130
131 This is a relatively simple case, and later in this chapter, as time permits,
132 we will discuss how you might recover from a situation where the machine that
133 crashes is your main Bacula server (i.e. has the Director, the Catalog, and
134 the Storage daemon). 
135
136 You will take the following steps to get your system back up and running: 
137
138 \begin{enumerate}
139 \item Boot with your Rescue CDROM.  
140 \item Start the Network (local network)  
141 \item Re-partition your hard disk(s) as it was before  
142 \item Re-format your partitions  
143 \item Restore the Bacula File daemon (static version)  
144 \item Perform a Bacula restore of all your files  
145 \item Re-install your boot loader  
146 \item Reboot 
147 \end{enumerate}
148
149 Now for the details ... 
150
151 \section{Boot with your Rescue CDROM}
152 \index[general]{CDROM!Boot with your Rescue}
153 \index[general]{Boot with your Rescue CDROM}
154
155 Each rescue disk boots somewhat differently.  Please see the
156 instructions that go with your CDROM.
157
158
159 \paragraph*{Start the Network:}
160
161 \normalsize
162
163 You can test it by pinging another machine, or pinging your broken machine
164 machine from another machine. Do not proceed until your network is up. 
165
166 \paragraph*{Partition Your Hard Disk(s):}
167
168 \paragraph*{Format Your Hard Disk(s):}
169
170 \paragraph*{Mount the Newly Formatted Disks:}
171
172
173 \paragraph*{Somehow get the static File daemon loaded on your system}
174 Put the static file daemon and its conf file in /tmp.
175
176 \paragraph*{Restore and Start the File Daemon:}
177 \footnotesize
178 \begin{verbatim}
179 chroot /mnt/disk /tmp/bacula-fd -c /tmp/bacula-fd.conf
180 \end{verbatim}
181 \normalsize
182
183 The above command starts the Bacula File daemon with the proper root disk
184 location (i.e. {\bf /mnt/disk/tmp}. If Bacula does not start, correct the
185 problem and start it. You can check if it is running by entering: 
186
187 \footnotesize
188 \begin{verbatim}
189 ps fax
190 \end{verbatim}
191 \normalsize
192
193 You can kill Bacula by entering: 
194
195 \footnotesize
196 \begin{verbatim}
197 kill -TERM <pid>
198 \end{verbatim}
199 \normalsize
200
201 where {\bf pid} is the first number printed in front of the first occurrence
202 of {\bf bacula-fd} in the {\bf ps fax} command. 
203
204 Now, you should be able to use another computer with Bacula installed to check
205 the status by entering: 
206
207 \footnotesize
208 \begin{verbatim}
209 status client=xxxx
210 \end{verbatim}
211 \normalsize
212
213 into the Console program, where xxxx is the name of the client you are
214 restoring. 
215
216 One common problem is that your {\bf bacula-dir.conf} may contain machine
217 addresses that are not properly resolved on the stripped down system to be
218 restored because it is not running DNS. This is particularly true for the
219 address in the Storage resource of the Director, which may be very well
220 resolved on the Director's machine, but not on the machine being restored and
221 running the File daemon. In that case, be prepared to edit {\bf
222 bacula-dir.conf} to replace the name of the Storage daemon's domain name with
223 its IP address. 
224
225 \paragraph*{Restore Your Files:}
226
227 On the computer that is running the Director, you now run a {\bf restore}
228 command and select the files to be restored (normally everything), but before
229 starting the restore, there is one final change you must make using the {\bf
230 mod} option. You must change the {\bf Where} directory to be the root by using
231 the {\bf mod} option just before running the job and selecting {\bf Where}.
232 Set it to: 
233
234 \footnotesize
235 \begin{verbatim}
236 /
237 \end{verbatim}
238 \normalsize
239
240 then run the restore. 
241
242 You might be tempted to avoid using {\bf chroot} and running Bacula directly
243 and then using a {\bf Where} to specify a destination of {\bf /mnt/disk}. This
244 is possible, however, the current version of Bacula always restores files to
245 the new location, and thus any soft links that have been specified with
246 absolute paths will end up with {\bf /mnt/disk} prefixed to them. In general
247 this is not fatal to getting your system running, but be aware that you will
248 have to fix these links if you do not use {\bf chroot}. 
249
250 \paragraph*{Final Step:}
251
252
253
254 \footnotesize
255 \begin{verbatim}
256 /sbin/grub-install --root-directory=/mnt/disk /dev/hda
257 \end{verbatim}
258 \normalsize
259
260 Note, in this case, you omit the chroot command, and you must
261 replace /dev/hda with your boot device.  If you don't know what your
262 boot device is, run the ./run\_grub script once and it will tell
263 you.
264
265 Finally, I've even run into a case where grub-install was unable to
266 rewrite the boot block. In my case, it produced the following error
267 message:
268
269 \footnotesize
270 \begin{verbatim}
271 /dev/hdx does not have any corresponding BIOS drive.
272 \end{verbatim}
273 \normalsize
274
275 The solution is to insure that all your disks are properly mounted on
276 /mnt/disk, then do the following:
277
278 \footnotesize
279 \begin{verbatim}
280 chroot /mnt/disk
281 mount /dev/pts
282 \end{verbatim}
283 \normalsize
284
285 Then edit the file {\bf /boot/grub/grub.conf} and uncomment the line
286 that reads:
287
288 \footnotesize
289 \begin{verbatim}
290 #boot=/dev/hda
291 \end{verbatim}
292 \normalsize
293
294 So that it reads:
295
296 \footnotesize
297 \begin{verbatim}
298 boot=/dev/hda
299 \end{verbatim}
300 \normalsize
301
302 Note, the /dev/hda may be /dev/sda or possibly some other drive depending
303 on your configuration, but in any case, it is the same as the one that
304 you previously tried with {\bf grub-install}.
305
306 Then, enter the following commands:
307
308 \footnotesize
309 \begin{verbatim}
310 grub --batch --device-map=/boot/grub/device.map \
311   --config-file=/boot/grub/grub.conf --no-floppy
312 root (hd0,0)
313 setup (hd0)
314 quit
315 \end{verbatim}
316 \normalsize
317
318 If the {\bf grub} call worked, you will get a prompt of {\bf grub\gt{}}   
319 before the {\bf root}, {\bf setup}, and {\bf quit} commands, and after 
320 entering the {\bf setup} command, it should indicate that it successfully
321 wrote the MBR (master boot record).
322
323
324 \paragraph*{Reboot:}
325
326 First unmount all your hard disks, otherwise they will not be cleanly
327 shutdown, then reboot your machine by entering {\bf exit} until you get to the
328 main prompt then enter {\bf Ctrl-d}. Once back to the main CDROM prompt, you
329 will need to turn the power off, then back on to your machine to get it to
330 reboot. 
331
332 If everything went well, you should now be back up and running. If not,
333 re-insert the emergency boot CDROM, boot, and figure out what is wrong. 
334
335 \label{restore_server}
336 \section{Restoring a Server}
337 \index[general]{Restoring a Server}
338 \index[general]{Server!Restoring a}
339
340 Above, we considered how to recover a client machine where a valid Bacula
341 server was running on another machine. However, what happens if your server
342 goes down and you no longer have a running Director, Catalog, or Storage
343 daemon? There are several solutions: 
344
345 \begin{enumerate}
346 \item Bring up static versions of your Director, Catalog, and Storage  daemon 
347    on the damaged machine.
348
349 \item Move your server to another machine. 
350
351 \item Use a Hot Spare Server on another Machine.
352 \end{enumerate}
353
354 The first option, is very difficult because it requires you to have created a
355 static version of the Director and the Storage daemon as well as the Catalog.
356 If the Catalog uses MySQL or PostgreSQL, this may or may not be possible. In
357 addition, to loading all these programs on a bare system (quite possible), you
358 will need to make sure you have a valid driver for your tape drive. 
359
360 The second suggestion is probably a much simpler solution, and one I have done
361 myself. To do so, you might want to consider the following steps: 
362
363 \begin{itemize}
364 \item If you are using MySQL or PostgreSQL, configure, build and install it
365    from source (or use rpms) on your new system.  
366 \item Load the Bacula source code onto your new system, configure,  install
367    it, and create the Bacula database.  
368 \item Ideally, you will have a copy of all the Bacula conf files that
369    were being used on your server. If not, you will at a minimum need
370    create a bacula-dir.conf that has the same Client resource that
371    was used to backup your system.
372 \item If you have a valid saved Bootstrap file as created for your  damaged
373    machine with WriteBootstrap, use it to restore the files to the damaged
374    machine, where you have loaded a static Bacula File daemon using the
375    Rescue disk).  This is done by using the restore command and at
376    the yes/mod/no prompt, selecting {\bf mod} then specifying the path to
377    the bootstrap file.
378 \item If you have the Bootstrap file, you should now be back up and  running,
379    if you do not have a Bootstrap file, continue with the  suggestions below.  
380 \item Using {\bf bscan} scan the last set of backup tapes into your  MySQL,
381    PostgreSQL or SQLite database.  
382 \item Start Bacula, and using the Console {\bf restore} command,  restore the
383    last valid copy of the Bacula database and the Bacula configuration
384    files.  
385 \item Move the database to the correct location. 
386 \item Start the database, and restart Bacula. Then use the Console {\bf
387    restore} command, restore all the files  on the damaged machine, where you
388    have loaded a Bacula File  daemon using the Rescue disk. 
389 \end{itemize}
390
391 For additional details of restoring your database, please see the
392 \ilink{Restoring When Things Go Wrong}{database_restore} section
393 of the Console Restore Command chapter of this manual.
394
395
396 \label{problems2}
397 \section{Linux Problems or Bugs}
398 \index[general]{Bugs!Linux Problems or}
399 \index[general]{Linux Problems or Bugs}
400
401 Since every flavor and every release of Linux is different, there are likely
402 to be some small difficulties with the scripts, so please be prepared to edit
403 them in a minimal environment. A rudimentary knowledge of {\bf vi} is very
404 useful. Also, these scripts do not do everything. You will need to reformat
405 Windows partitions by hand, for example. 
406
407 Getting the boot loader back can be a problem if you are using {\bf grub}
408 because it is so complicated. If all else fails, reboot your system from your
409 floppy but using the restored disk image, then proceed to a reinstallation of
410 grub (looking at the run-grub script can help). By contrast, lilo is a piece
411 of cake. 
412
413 \label{LiveCD}
414 \section{Bare Metal Recovery using a LiveCD}
415 \index[general]{Bare Metal Recovery using a LiveCD}
416 \index[general]{Recovery!Bare Metal Recovery using a LiveCD}
417 \index[general]{Rescue!Bare Metal Recovery using a LiveCD}
418 \index[general]{LiveCD!Bare Metal Recovery using a LiveCD}
419
420 As an alternative to the old now defunct Bacula Rescue CDROM, you can use any
421 system rescue or LiveCD to recover your system. The big problem
422 with most rescue or LiveCDs is that they are not designed to
423 capture the current state of your system, so when you boot them on
424 a damaged system, you might be somewhat lost -- e.g. how many of
425 you remember your exact hard disk partitioning.
426
427 This lack can be easily corrected by running the part of the
428 Bacula Rescue code that creates a directory containing a   
429 static-bacula-fd, a snapshot of your current system disk
430 configuration, and scripts that help restoring it.
431
432 Before a disaster strikes:
433 \begin{enumerate}
434 \item Run only the {\bf make bacula} part of the
435   Bacula Rescue procedure to create the static Bacula
436   File daemon, and system disk snapshot. 
437 \item Save the directory generated (more details below)
438   preferrably on a CDROM or alternatively to some other
439   system.
440 \item Possibly run {\bf make bacula} every night as
441   part of your backup process to ensure that you have
442   a current snapshot of your system.
443 \end{enumerate}
444
445 Then when disaster strikes, do the following:
446
447 \begin{enumerate}
448 \item Boot with your system rescue disk or LiveCD
449    (e.g. Knoppix).
450 \item Start the Network (local network).  
451 \item Copy the Bacula recovery directory to the 
452    damaged system using ftp, scp, wget or if your
453    boot disk permits it reading it directly from a
454    CDROM.
455 \item Continue as documented above.
456 \item Re-partition your hard disk(s) as it was before,  
457    if necessary.
458 \item Re-format your partitions, if necessary.  
459 \item Restore the Bacula File daemon (static version).  
460 \item Perform a Bacula restore of all your files.  
461 \item Re-install your boot loader.  
462 \item Reboot. 
463 \end{enumerate}
464
465 In order to create the Bacula recovery directory, you need
466 a copy of the Bacula Rescue code as described above, and
467 you must first configure that directory.
468
469 Once the configuration is done, you can do the following
470 to create the Bacula recovery directory:
471
472 \footnotesize
473 \begin{verbatim}
474 cd <bacula-rescue-source>/linux/cdrom
475 su (become root)
476 make bacula
477 \end{verbatim}
478 \normalsize
479
480 The directory you want to save will be created in
481 the current directory with the name {\bf bacula}.  You
482 need only save that directory either as a directory or
483 possibly as a compressed tar file.  If you run this procedure
484 on multiple machines, you will probably want to rename this directory
485 to something like {\bf bacula-hostname}.
486
487
488
489 \label{FreeBSD1}
490 \section{FreeBSD Bare Metal Recovery}
491 \index[general]{Recovery!FreeBSD Bare Metal}
492 \index[general]{Rescue!FreeBSD Bare Metal}
493 \index[general]{FreeBSD Bare Metal Recovery}
494
495 The same basic techniques described above also apply to FreeBSD. Although we
496 don't yet have a fully automated procedure, Alex Torres Molina has provided us
497 with the following instructions with a few additions from Jesse Guardiani and
498 Dan Langille: 
499
500 \begin{enumerate}
501 \item Boot with the FreeBSD installation disk 
502 \item Go to Custom, Partition and create your slices and go to Label and 
503    create the partitions that you want. Apply changes. 
504 \item Go to Fixit to start an emergency console. 
505 \item Create devs ad0 .. .. if they don't exist under /mnt2/dev (in my  situation)
506    with MAKEDEV. The device or devices you  create depend on what hard drives you
507    have. ad0 is your  first ATA drive. da0 would by your first SCSI drive.  Under
508 OS version 5 and greater, your device files are  most likely automatically
509 created for you. 
510 \item mkdir /mnt/disk
511    this is the root of the new disk 
512 \item mount /mnt2/dev/ad0s1a /mnt/disk
513    mount /mnt2/dev/ad0s1c /mnt/disk/var
514    mount /mnt2/dev/ad0s1d /mnt/disk/usr
515 .....
516 The same hard drive issues as above apply here too.  Note, under OS version 5
517 or higher, your disk devices may  be in /dev not /mnt2/dev. 
518 \item Network configuration (ifconfig xl0 ip/mask + route add default 
519    ip-gateway) 
520 \item mkdir /mnt/disk/tmp 
521 \item cd /mnt/disk/tmp 
522 \item Copy bacula-fd and bacula-fd.conf to this path 
523 \item If you need to, use sftp to copy files, after which you must do this:
524    ln -s /mnt2/usr/bin /usr/bin 
525 \item chmod u+x bacula-fd 
526 \item Modify bacula-fd.conf to fit this machine 
527 \item Copy /bin/sh to /mnt/disk, necessary for chroot 
528 \item Don't forget to put your bacula-dir's IP address and domain  name in
529    /mnt/disk/etc/hosts if it's not on a public net.  Otherwise the FD on the
530    machine you are restoring to  won't be able to contact the SD and DIR on the
531 remote machine. 
532 \item mkdir -p /mnt/disk/var/db/bacula 
533 \item chroot /mnt/disk /tmp/bacula-fd -c /tmp/bacula-fd.conf
534    to start bacula-fd 
535 \item Now you can go to bacula-dir and restore the job with the entire 
536    contents of the broken server. 
537 \item You must create /proc 
538 \end{enumerate}
539
540 \label{solaris}
541 \section{Solaris Bare Metal Recovery}
542 \index[general]{Solaris Bare Metal Recovery}
543 \index[general]{Recovery!Solaris Bare Metal}
544
545 The same basic techniques described above apply to Solaris: 
546
547 \begin{itemize}
548 \item the same restrictions as those given for Linux apply  
549 \item you will need to create a Rescue disk 
550    \end{itemize}
551
552 However, during the recovery phase, the boot and disk preparation procedures
553 are different: 
554
555 \begin{itemize}
556 \item there is no need to create an emergency boot disk  since it is an
557    integrated part of the Solaris boot.  
558 \item you must partition and format your hard disk by hand  following manual
559    procedures as described in W. Curtis Preston's  book "Unix Backup \&
560    Recovery" 
561 \end{itemize}
562
563 Once the disk is partitioned, formatted and mounted, you can continue with
564 bringing up the network and reloading Bacula. 
565
566 \section{Preparing Solaris Before a Disaster}
567 \index[general]{Preparing Solaris Before a Disaster}
568 \index[general]{Disaster!Preparing Solaris Before a}
569
570 As mentioned above, before a disaster strikes, you should prepare the
571 information needed in the case of problems. To do so, in the {\bf
572 rescue/solaris} subdirectory enter: 
573
574 \footnotesize
575 \begin{verbatim}
576 su
577 ./getdiskinfo
578 ./make_rescue_disk
579 \end{verbatim}
580 \normalsize
581
582 The {\bf getdiskinfo} script will, as in the case of Linux described above,
583 create a subdirectory {\bf diskinfo} containing the output from several system
584 utilities. In addition, it will contain the output from the {\bf SysAudit}
585 program as described in Curtis Preston's book. This file {\bf
586 diskinfo/sysaudit.bsi} will contain the disk partitioning information that
587 will allow you to manually follow the procedures in the "Unix Backup \&
588 Recovery" book to repartition and format your hard disk. In addition, the
589 {\bf getdiskinfo} script will create a {\bf start\_network} script. 
590
591 Once you have your disks repartitioned and formatted, do the following: 
592
593 \begin{itemize}
594 \item Start Your Network with the {\bf start\_network} script  
595 \item Restore the Bacula File daemon as documented above  
596 \item Perform a Bacula restore of all your files using the same  commands as
597    described above for Linux  
598 \item Re-install your boot loader using the instructions outlined  in the
599    "Unix Backup \& Recovery" book  using installboot 
600 \end{itemize}
601
602 \label{genbugs}
603
604 \section{Bugs and Other Considerations}
605 \index[general]{Considerations!Bugs and Other}
606 \index[general]{Bugs and Other Considerations}
607
608 \paragraph*{Directory Modification and Access Times are Modified on pre-1.30
609 Baculas :}
610
611 When a pre-1.30 version of Bacula restores a directory, it first must create
612 the directory, then it populates the directory with its files and
613 subdirectories. The act of creating the files and subdirectories updates both
614 the modification and access times associated with the directory itself. As a
615 consequence, all modification and access times of all directories will be
616 updated to the time of the restore. 
617
618 This has been corrected in Bacula version 1.30 and later. The directory
619 modification and access times are reset to the value saved in the backup after
620 all the files and subdirectories have been restored. This has been tested and
621 verified on normal restore operations, but not verified during a bare metal
622 recovery. 
623
624 \paragraph*{Strange Bootstrap Files:}
625
626 If any of you look closely at the bootstrap file that is produced and used for
627 the restore (I sure do), you will probably notice that the FileIndex item does
628 not include all the files saved to the tape. This is because in some instances
629 there are duplicates (especially in the case of an Incremental save), and in
630 such circumstances, {\bf Bacula} restores only the last of multiple copies of
631 a file or directory. 
632
633 \label{Win3233}
634 \section{Disaster Recovery of Win32 Systems}
635 \index[general]{Systems!Disaster Recovery of Win32}
636 \index[general]{Disaster Recovery of Win32 Systems}
637
638 Due to open system files, and registry problems, Bacula cannot save and
639 restore a complete Win2K/XP/NT environment. 
640
641 A suggestion by Damian Coutts using Microsoft's NTBackup utility in
642 conjunction with Bacula should permit a Full bare metal restore of Win2K/XP
643 (and possibly NT systems). His suggestion is to do an NTBackup of the critical
644 system state prior to running a Bacula backup with the following command: 
645
646 \footnotesize
647 \begin{verbatim}
648 ntbackup backup systemstate /F c:\systemstate.bkf
649 \end{verbatim}
650 \normalsize
651
652 The {\bf backup} is the command, the {\bf systemstate} says to backup only the
653 system state and not all the user files, and the {\bf /F
654 c:\textbackslash{}systemstate.bkf} specifies where to write the state file.
655 this file must then be saved and restored by Bacula. This command
656 can be put in a Client Run Before Job directive so that it is automatically
657 run during each backup, and thus saved to a Bacula Volume.
658
659 To restore the system state, you first reload a base operating system, then
660 you would use Bacula to restore all the users files and to recover the {\bf
661 c:\textbackslash{}systemstate.bkf} file, and finally, run {\bf NTBackup} and
662 {\bf catalogue} the system statefile, and then select it for restore. The
663 documentation says you can't run a command line restore of the systemstate. 
664
665 This procedure has been confirmed to work by Ludovic Strappazon -- many
666 thanks! 
667
668 A new tool is provided in the form of a bacula plugin for the BartPE rescue
669 CD. BartPE is a self-contained WindowsXP boot CD which you can make using the
670 PeBuilder tools available at 
671 \elink{http://www.nu2.nu/pebuilder/}{\url{http://www.nu2.nu/pebuilder/}} and a valid
672 Windows XP SP1 CDROM. The plugin is provided as a zip archive. Unzip the file
673 and copy the bacula directory into the plugin directory of your BartPE
674 installation. Edit the configuration files to suit your installation and build
675 your CD according to the instructions at Bart's site. This will permit you to
676 boot from the cd, configure and start networking, start the bacula file client
677 and access your director with the console program. The programs menu on the
678 booted CD contains entries to install the file client service, start the file
679 client service, and start the WX-Console. You can also open a command line
680 window and CD Programs\textbackslash{}Bacula and run the command line console
681 bconsole. 
682
683 \section{Ownership and Permissions on Win32 Systems}
684 \index[general]{Systems!Resetting Directory and File Ownership and Permissions
685 on Win32}
686 \index[general]{Resetting Directory and File Ownership and Permissions on
687 Win32 Systems}
688 % TODO: should this be in the win32 chapter?
689
690 Bacula versions after 1.31 should properly restore ownership and permissions
691 on all WinNT/XP/2K systems. If you do experience problems, generally in
692 restores to alternate directories because higher level directories were not
693 backed up by Bacula, you can correct any problems with the {\bf SetACL}
694 available under the GPL license at: 
695 \elink{http://sourceforge.net/projects/setacl/}{\url{http://sourceforge.net/project%
696 s/setacl/}}. 
697
698 \section{Alternate Disaster Recovery Suggestion for Win32 Systems}
699 \index[general]{Systems!Alternate Disaster Recovery Suggestion for Win32}
700 \index[general]{Alternate Disaster Recovery Suggestion for Win32 Systems}
701 % TODO: should this be in the win32 chapter??
702
703 Ludovic Strappazon has suggested an interesting way to backup and restore
704 complete Win32 partitions. Simply boot your Win32 system with a Linux Rescue
705 disk as described above for Linux, install a statically linked Bacula, and
706 backup any of the raw partitions you want. Then to restore the system, you
707 simply restore the raw partition or partitions. Here is the email that Ludovic
708 recently sent on that subject: 
709
710 \footnotesize
711 \begin{verbatim}
712 I've just finished testing my brand new cd LFS/Bacula
713 with a raw Bacula backup and restore of my portable.
714 I can't resist sending you the results: look at the rates !!!
715 hunt-dir: Start Backup JobId 100, Job=HuntBackup.2003-04-17_12.58.26
716 hunt-dir: Bacula 1.30 (14Apr03): 17-Apr-2003 13:14
717 JobId:                  100
718 Job:                    HuntBackup.2003-04-17_12.58.26
719 FileSet:                RawPartition
720 Backup Level:           Full
721 Client:                 sauvegarde-fd
722 Start time:             17-Apr-2003 12:58
723 End time:               17-Apr-2003 13:14
724 Files Written:          1
725 Bytes Written:          10,058,586,272
726 Rate:                   10734.9 KB/s
727 Software Compression:   None
728 Volume names(s):        000103
729 Volume Session Id:      2
730 Volume Session Time:    1050576790
731 Last Volume Bytes:      10,080,883,520
732 FD termination status:  OK
733 SD termination status:  OK
734 Termination:            Backup OK
735 hunt-dir: Begin pruning Jobs.
736 hunt-dir: No Jobs found to prune.
737 hunt-dir: Begin pruning Files.
738 hunt-dir: No Files found to prune.
739 hunt-dir: End auto prune.
740 hunt-dir: Start Restore Job RestoreFilesHunt.2003-04-17_13.21.44
741 hunt-sd: Forward spacing to file 1.
742 hunt-dir: Bacula 1.30 (14Apr03): 17-Apr-2003 13:54
743 JobId:                  101
744 Job:                    RestoreFilesHunt.2003-04-17_13.21.44
745 Client:                 sauvegarde-fd
746 Start time:             17-Apr-2003 13:21
747 End time:               17-Apr-2003 13:54
748 Files Restored:         1
749 Bytes Restored:         10,056,130,560
750 Rate:                   5073.7 KB/s
751 FD termination status:  OK
752 Termination:            Restore OK
753 hunt-dir: Begin pruning Jobs.
754 hunt-dir: No Jobs found to prune.
755 hunt-dir: Begin pruning Files.
756 hunt-dir: No Files found to prune.
757 hunt-dir: End auto prune.
758 \end{verbatim}
759 \normalsize
760
761 \label{running}
762
763 \section{Restoring to a Running System}
764 \index[general]{System!Restoring to a Running}
765 \index[general]{Restoring to a Running System}
766
767 If for some reason you want to do a Full restore to a system that has a
768 working kernel (not recommended), you will need to take care not to
769 overwrite the following files:
770
771 \footnotesize
772 \begin{verbatim}
773 /etc/grub.conf
774 /etc/X11/Conf
775 /etc/fstab
776 /etc/mtab
777 /lib/modules
778 /usr/modules
779 /usr/X11R6
780 /etc/modules.conf
781 \end{verbatim}
782 \normalsize
783
784 \label{Resources}
785
786 \section{Additional Resources}
787 \index[general]{Additional Resources}
788 \index[general]{Resources!Additional}
789
790 Many thanks to Charles Curley who wrote 
791 \elink{Linux Complete Backup and Recovery HOWTO}
792 {\url{http://www.tldp.org/HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO/index.html%
793 }} for the 
794 \elink{The Linux Documentation Project}{\url{http://www.tldp.org/}}. This is an
795 excellent document on how to do Bare Metal Recovery on Linux systems, and it
796 was this document that made me realize that Bacula could do the same thing. 
797
798 You can find quite a few additional resources, both commercial and free at 
799 \elink{Storage Mountain}{\url{http://www.backupcentral.com}}, formerly known as
800 Backup Central. 
801
802 And finally, the O'Reilly book, "Unix Backup \& Recovery" by W. Curtis
803 Preston covers virtually every backup and recovery topic including bare metal
804 recovery for a large range of Unix systems.