4
\section*{Disaster Recovery Using Bacula}
5
\label{_ChapterStart38}
6
\index[general]{Disaster Recovery Using Bacula }
7
\index[general]{Bacula!Disaster Recovery Using }
8
\addcontentsline{toc}{section}{Disaster Recovery Using Bacula}
11
\index[general]{General }
12
\addcontentsline{toc}{subsection}{General}
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 it
18
if the disk must be replaced?
20
Unfortunately, many of the steps one must take before and immediately after a
21
disaster are very operating system dependent. As a consequence, this chapter
22
will discuss in detail disaster recovery (also called Bare Metal Recovery) for
23
{\bf Linux} and {\bf Solaris}. For Solaris, the procedures are still quite
24
manual. For FreeBSD the same procedures may be used but they are not yet
25
developed. For Win32, no luck. Apparently an "emergency boot" disk allowing
26
access to the full system API without interference does not exist.
27
\label{considerations1}
29
\subsection*{Important Considerations}
30
\index[general]{Important Considerations }
31
\index[general]{Considerations!Important }
32
\addcontentsline{toc}{subsection}{Important Considerations}
34
Here are a few important considerations concerning disaster recovery that you
35
should take into account before a disaster strikes.
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
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?
50
\subsection*{Steps to Take Before Disaster Strikes}
51
\index[general]{Steps to Take Before Disaster Strikes }
52
\index[general]{Strikes!Steps to Take Before Disaster }
53
\addcontentsline{toc}{subsection}{Steps to Take Before Disaster Strikes}
56
\item Create a Bacula Rescue CDROM for each of your Linux systems. Note, it
57
is possible to create one CDROM by copying the bacula-hostname directory from
58
each machine to the machine where you will be burning the CDROM, so
59
if the OS is the same, you can have a single CDROM that can recover
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 Bacula Rescue CDROM before you are forced to use it in
71
an emergency situation.
75
\subsection*{Bare Metal Recovery on Linux with a Bacula Rescue CDROM}
76
\index[general]{Bare Metal Recovery on Linux with a Bacula Rescue CDROM }
77
\index[general]{CDROM!Bare Metal Recovery on Linux with a Bacula Rescue }
78
\addcontentsline{toc}{subsection}{Bare Metal Recovery on Linux with a Bacula
81
The remainder of this section concerns recovering a {\bf Linux} computer, and
82
parts of it relate to the Red Hat version of Linux. The {\bf Solaris}
83
procedures can be found below under the
84
\ilink{Solaris Bare Metal Recovery}{solaris} section of this
87
Previously Bacula supported a floppy rescue disk. This code has been
88
removed in 1.37.40 and later.
90
A so called "Bare Metal" recovery is one where you start with an empty hard
91
disk and you restore your machine. There are also cases where you may lose a
92
file or a directory and want it restored. Please see the previous chapter for
93
more details for those cases.
95
Bare Metal Recovery assumes that you have the following items for your system:
98
\item A Bacula Rescue CDROM containing a copy of your OS and a copy of your
99
hard disk information, as well as a statically linked version of the Bacula
100
File daemon. This chapter describes how to build such a CDROM.
101
\item A full Bacula backup of your system possibly including Incremental or
102
Differential backups since the last Full backup
103
\item A second system running the Bacula Director, the Catalog, and the
104
Storage daemon. (this is not an absolute requirement, but how to get around
105
it is not yet documented here)
108
\subsection*{Requirements}
109
\index[general]{Requirements }
110
\addcontentsline{toc}{subsection}{Requirements}
112
In addition, to the above assumptions, the following conditions or
116
\item Linux only -- tested only on Red Hat, but should work on other Linuxes
117
\item The scripts handle only SCSI and IDE disks
118
\item All partitions will be recreated, but only {\bf ext2}, {\bf ext3}, {\bf
119
rfs} and {\bf swap} partitions will be reformatted. Any other partitions such
120
as Windows FAT partitions will not be formatted by the scripts, but you can
122
\item You are using either {\bf lilo} or {\bf grub} as a boot loader, and you
123
know which one (not automatically detected)
124
\item The partitioning and reformatting scripts *should* work with RAID
125
devices, but probably not with other "complicated" disk
126
partitioning/formatting schemes. They also should work with Reiser
127
filesystems. Please check them carefully. You will probably need to edit the
128
scripts by hand to make them work.
129
\item You will need mkisofs (might be part of cdrtools, but is a separate rpm
130
on my system); cdrecord or some other tool for burning the CDROM.
133
\subsection*{Directories}
134
\index[general]{Directories }
135
\addcontentsline{toc}{subsection}{Directories}
137
To build the Bacula Rescue CDROM, you must get a copy of the
138
rescue files. In version 1.37 and later, they are separate from
139
the Bacula source. One place you can find the rescue files is
140
in the Source Forge Bacula CVS module named {\bf rescue}.
142
Please read the README file in the main directory of the
143
Rescue source code. Before using it, you must run configure and
144
specify the location of the Bacula source code (not necessary if installed
145
from rpms). This permits the build of the rescue disk to automatically
146
create a statically linked Bacula File daemon.
148
You will find the necessary scripts in {\bf
149
linux/cdrom} subdirectory of the rescue source code. If you installed
150
the bacula rpm package the scripts will be found in the {\bf
151
/etc/bacula/rescue/cdrom} directory.
153
\subsection*{Preparation for a Bare Metal Recovery}
154
\index[general]{Recovery!Preparation for a Bare Metal }
155
\index[general]{Preparation for a Bare Metal Recovery }
156
\addcontentsline{toc}{subsection}{Preparation for a Bare Metal Recovery}
158
Before you can do a Bare Metal recovery, you must create a Bacula Rescue
159
CDROM, which will contain everything you need to begin recovery. This assumes
160
that you will have your Director and Storage daemon running on a different
161
machine. If you want to recover a machine where the Director and/or the
162
database were previously running things will be much more complicated.
164
\subsection*{Creating a Bacula Rescue CDROM}
165
\index[general]{CDROM!Creating a Bacula Rescue }
166
\index[general]{Creating a Bacula Rescue CDROM }
167
\addcontentsline{toc}{subsection}{Creating a Bacula Rescue CDROM}
169
The primary goals of the Bacula rescue CD are:
172
\item NOT to be a general or universal recovery disk.
173
\item to capture and setup a restore environment for a single system running
175
\item to capture the current state of the hard disks on your system, so that
176
they can be easily restored from pre-generated scripts. Note, this is
177
not done by any other rescue CDROM, as far as I am aware.
178
\item to create and save a statically linked copy of your current Bacula FD.
179
Thus you need no packages or other software to be installed before using
180
this CDROM and the Bacula File daemon on it.
181
\item to be relatively easy to create. In most cases you simply type {\bf
182
make all} in the {\bf rescue/linux/cdrom} directory, then burn the ISO image
183
created. In contrast, if you have looked at any of the documentation on how
184
to remaster a CD or how to roll your own, your head will spin (at least mine
186
\item to be easy for you to add any additional files, binaries, or libraries
188
\item to build and work on any (or almost any) Linux flavor or release.
189
\item you might ask why I don't use Knoppix or some other preprepared recovery
190
disk, especially since Knoppix is very kind and provides the Bacula FD on
191
their disk. The answer is that: I am more comfortable having my Linux boot
192
up in rescue mode rather than another flavor. In addition, the Bacula rescue
193
CDROM contains a complete snapshot of your disk partitioning, which is not
194
the case with any other rescue disk. If your harddisk dies, do you remember all
195
the partitions you had and how big they are? I don't, and without that information,
196
you have little hope of reformatting your harddisk and rebuilding your system.
199
One of the main of the advantages of a Bacula Rescue CDROM is that it contains
200
a bootable copy of your system, so you should be familiar with it.
202
You should probably make a new rescue CDROM each time you make any major
203
updates to your kernel, and every time you upgrade a major version of Bacula.
205
The whole process with the exception of burning the CDROM is done with the
210
(Build a working version of Bacula in the
211
bacula-source directory)
213
./configure (your options)
215
cd <bacula-rescue-source>
216
./configure --with-bacula=<path-to-bacula-source>
223
The above instructions were for building the rescue CDROM from
224
a bacula-rescue release. You will note that you need to do a
225
separate ./configure in the rescue source directory and that you
226
need to provide it the path to the Bacula source so that it can
227
build a statically linked File daemon.
229
For users of the bacula-rescue rpm the static bacula-fd has already been built
230
and placed in {\bf /etc/bacula/rescue/cdrom/bin/} along with a symbolic link
231
to your {\bf /etc/bacula/bacula-fd.conf} file. Rpm users only need to do the
236
cd /etc/bacula/rescue/cdrom
242
At this point, if the scripts are successful, they should have done the
246
\item Made a copy of your kernel and its essential files.
247
\item Copied a number of binary files from your system.
248
\item Copied all the necessary shared libraries to run the above binary
250
\item Made a statically-linked version of your File daemon and copied it into
251
the CDROM build area.
252
\item Made an ISO image and left it in {\bf bootcd.iso}
255
Once this is accomplished, you need only burn it into a CDROM. This can be
256
done directly from the makefile with:
264
However, you may need to modify the Makefile to properly specify your CD
265
burner as the detection process is complicated especially if you have two
266
CDROMs or do not have {\bf cdrecord} loaded on your system. Users of the
267
rescue rpm package should definitely examine the Makefile since it was
268
configured on the host used to produce the rpm package. If you find that the
269
{\bf make burn} does not work for you, try doing a:
277
and use the output of that to modify the Makefile accordingly.
279
The "make all" that you did above actually does the equivalent to the
291
If you wish, you can modify what you put on the CDROM and redo any part of the
292
make that you wish. For example, if you want to add a new directory, you might
293
do the first three makes, then add a new directory to the CDROM, and finally
294
do a "make iso". Please see the README file in the {\bf rescue/linux/cdrom}
295
or {\bf /etc/bacula/rescue/cdrom}directory for instructions on changing the
296
contents of the CDROM.
298
At the current time, the size of the CDROM is about 50MB (compressed to about
299
20MB), so there is quite a bit more room for additional programs. Keep in mind
300
that when this CDROM is booted, *everything* is in memory, so the total size
301
cannot exceed your memory size, and even then you will need some reserve
302
memory for running programs, ...
307
make copy-static-bacula
311
which is similar to a "make all" except that instead of trying to build
312
the static File daemon from the Bacula source, it will assume that you
313
have already installed a static copy of the FD in the sbindir location
314
(usually /usr/local/sbin), and will copy it from there.
316
Finally, if you want to be completely responsible for getting your
317
own FD binary on the disk, you can do the following:
326
(add your own Bacula FD to the bacula/bin directory)
332
The rpm_release file prevents the "make bacula" from attempting to
333
build or copy a File daemon, so that you can do it before the
334
"make iso" step. Once "make iso" is run, you can no longer add
335
anything to the in-memory part of the image. You can still add
336
files to the cdtree directory, and when you do a "make burn" they
337
will be written to the CDROM. However, to access them, you must
338
be able to mount the CDROM after booting it, then copy them into
344
\subsection*{Putting Two or More Systems on Your Rescue Disk}
345
\index[general]{Putting Two or More Systems on Your Rescue Disk }
346
\index[general]{Disk!Putting Two or More Systems on Your Rescue }
347
\addcontentsline{toc}{subsection}{Putting Two or More Systems on Your Rescue
350
You can put multiple systems on the same rescue CD if you wish. This is
351
because the information that is specific to your OS will be stored in the {\bf
352
/bacula-hostname} directory, where {\bf hostname} is the name of the host on
353
which you are building the CD. Suppose for example, you have two systems. One
354
named {\bf client1} and one named {\bf client2}. Assume also that your CD
355
burner is on client1, and that is the machine we start on, and that we can ssh
356
into client2 and also client2's disks are mounted on client1.
362
./configure (your options)
364
cd <bacula-rescue-source>
365
./configure --with-bacula=<path-to-bacula-source>
373
Again, for rpm package users the above command set would be:
378
cd /etc/bacula/rescue/cdrom
380
(enter root password)
386
Thus we have just built a Bacula rescue directory on client2. Now, on client1,
387
we copy the appropriate directory to two places (explained below), then build
393
./configure (your options)
395
cd <bacula-rescue-source>
396
./configure --with-bacula=<path-to-bacula-source>
399
c=/mnt/client2/home/user/bacula/rescue/linux/cdrom
400
cp -a $c/roottree/bacula-client2 roottree
401
cp -a $c/roottree/bacula-client2 cdtree
408
And with the rpm package:
412
cd /etc/bacula/rescue/cdrom
414
(enter root password)
415
c=/mnt/client2/etc/bacula/rescue/cdrom
416
cp -a $c/roottree/bacula-client2 roottree
417
cp -a $c/roottree/bacula-client2 cdtree
424
In summary, with the above commands, we first build a Bacula directory on
425
client2 in roottree/bacula-client2, then we copied the bacula-client2
426
directory into the client1's roottree so it is available in memory after
427
booting, and we also copied it into the cdtree so it will also be on the CD as
428
a separate directory and thus can be read without booting the CDROM. Then we
429
made and burned the CDROM for client1, which of course, contains the client2
433
\subsection*{Restoring a Client System}
434
\index[general]{Restoring a Client System }
435
\index[general]{System!Restoring a Client }
436
\addcontentsline{toc}{subsection}{Restoring a Client System}
438
Now, let's assume that your hard disk has just died and that you have replaced
439
it with an new identical drive. In addition, we assume that you have:
442
\item A recent Bacula backup (Full plus Incrementals)
443
\item A Bacula Rescue CDROM.
444
\item Your Bacula Director, Catalog, and Storage daemon running on another
445
machine on your local network.
448
This is a relatively simple case, and later in this chapter, as time permits,
449
we will discuss how you might recover from a situation where the machine that
450
crashes is your main Bacula server (i.e. has the Director, the Catalog, and
453
You will take the following steps to get your system back up and running:
456
\item Boot with your Bacula Rescue CDROM.
457
\item Start the Network (local network)
458
\item Re-partition your hard disk(s) as it was before
459
\item Re-format your partitions
460
\item Restore the Bacula File daemon (static version)
461
\item Perform a Bacula restore of all your files
462
\item Re-install your boot loader
466
Now for the details ...
468
\subsection*{Boot with your Bacula Rescue CDROM}
469
\index[general]{CDROM!Boot with your Bacula Rescue }
470
\index[general]{Boot with your Bacula Rescue CDROM }
471
\addcontentsline{toc}{subsection}{Boot with your Bacula Rescue CDROM}
473
When the CDROM boots, you will be presented with a script that looks like:
478
Welcome to the Bacula Rescue Disk 1.1.0
479
To proceed, press the <ENTER> key or type "linux <runlevel>"
482
linux 2 -> login (default if ENTER pressed)
483
linux 3 -> network started and login (network not working yet)
484
linux debug -> print debug during boot then login
488
Normally, at this point, you simply press ENTER. However, you may supply
489
options for the boot if you wish.
491
Once it has booted, you will be requested to login something like:
495
Welcome to the Bacula Rescue CDROM
496
2.4.21-15.0.4.EL #1 Wed Aug 4 03:08:03 EDT 2004
497
Please login using root and your root password ...
502
Note, you must enter the root password for the system on which you loaded the
503
kernel or on which you did the build of the CDROM. Once you are logged in,
504
you will be in the home directory for {\bf root}, and you can proceed to
507
The complete Bacula rescue part of the CD will be in the directory: {\bf
508
/bacula-hostname}, where hostname is replaced by the name of the host machine
509
on which you did the build for the CDROM. This naming procedure allows you to
510
put multiple restore environments for each of your machines on a single CDROM
511
if you so wish to do. Please see the README document in the {\bf
512
rescue/linux/cdrom} directory for more information on adding to the CDROM.
514
\paragraph*{Start the Network:}
516
At this point, you should bring up your network. Normally, this is quite
517
simple and requires just a few commands. Please cd into the /bacula-hostname
518
directory before continuing. To simplify your task, we have created a script
519
that should work in most cases by typing:
528
You can test it by pinging another machine, or pinging your broken machine
529
machine from another machine. Do not proceed until your network is up.
531
\paragraph*{Partition Your Hard Disk(s):}
533
Assuming that your hard disk crashed and needs repartitioning, proceed with:
541
If you have multiple disks, do the same for each of them. For SCSI disks, the
542
repartition script will be named: {\bf partition.sda}. If the script complains
543
about the disk being in use, simply go back and redo the {\bf df} command and
544
{\bf umount} commands until you no longer have your hard disk mounted. Note,
545
in many cases, if your hard disk was seriously damaged or a new one installed,
546
it will not automatically be mounted. If it is mounted, it is because the
547
emergency kernel found one or more possibly valid partitions.
549
If for some reason this procedure does not work, you can use the information
550
in {\bf partition.hda} to re-partition your disks by hand using {\bf fdisk}.
552
\paragraph*{Format Your Hard Disk(s):}
554
If you have repartitioned your hard disk, you must format it appropriately.
555
The formatting script will put back swap partitions, normal Unix partitions
556
(ext2) and journaled partitions (ext3) as well as Reiser partitions (rei). Do
557
so by entering for each disk:
565
The format script will ask you if you want a block check done. We recommend to
566
answer yes, but realize that for very large disks this can take hours.
568
\paragraph*{Mount the Newly Formatted Disks:}
570
Once the disks are partitioned and formatted, you can remount them with the
571
{\bf mount\_drives} script. All your drives must be mounted for Bacula to be
572
able to access them. Run the script as follows:
581
The {\bf df} command will tell you if the drives are mounted. If not, re-run
582
the script again. It isn't always easy to figure out and create the mount
583
points and the mounts in the proper order, so repeating the {\bf
584
./mount\_drives} command will not cause any harm and will most likely work the
585
second time. If not, correct it by hand before continuing.
587
\paragraph*{Restore and Start the File Daemon:}
589
If you have booted with a Bacula Rescue CDROM, your statically linked Bacula
590
File daemon and the bacula-fd.conf file will be in the /bacula-hostname/bin
591
directory. Make sure {\bf bacula-fd} and {\bf bacula-fd.conf} are both there.
593
Edit the Bacula configuration file, create the working/pid/subsys directory if
594
you haven't already done so above, and start Bacula. Before starting Bacula,
595
you will need to move it and bacula-fd.conf from /bacula-hostname/bin, to the
596
/mnt/disk/tmp directory so that it will be on your hard disk. Then start it
597
with the following command:
601
chroot /mnt/disk /tmp/bacula-fd -c /tmp/bacula-fd.conf
605
The above command starts the Bacula File daemon with the proper root disk
606
location (i.e. {\bf /mnt/disk/tmp}. If Bacula does not start, correct the
607
problem and start it. You can check if it is running by entering:
615
You can kill Bacula by entering:
623
where {\bf pid} is the first number printed in front of the first occurrence
624
of {\bf bacula-fd} in the {\bf ps fax} command.
626
Now, you should be able to use another computer with Bacula installed to check
627
the status by entering:
635
into the Console program, where xxxx is the name of the client you are
638
One common problem is that your {\bf bacula-dir.conf} may contain machine
639
addresses that are not properly resolved on the stripped down system to be
640
restored because it is not running DNS. This is particularly true for the
641
address in the Storage resource of the Director, which may be very well
642
resolved on the Director's machine, but not on the machine being restored and
643
running the File daemon. In that case, be prepared to edit {\bf
644
bacula-dir.conf} to replace the name of the Storage daemon's domain name with
647
\paragraph*{Restore Your Files:}
649
On the computer that is running the Director, you now run a {\bf restore}
650
command and select the files to be restored (normally everything), but before
651
starting the restore, there is one final change you must make using the {\bf
652
mod} option. You must change the {\bf Where} directory to be the root by using
653
the {\bf mod} option just before running the job and selecting {\bf Where}.
662
then run the restore.
664
You might be tempted to avoid using {\bf chroot} and running Bacula directly
665
and then using a {\bf Where} to specify a destination of {\bf /mnt/disk}. This
666
is possible, however, the current version of Bacula always restores files to
667
the new location, and thus any soft links that have been specified with
668
absolute paths will end up with {\bf /mnt/disk} prefixed to them. In general
669
this is not fatal to getting your system running, but be aware that you will
670
have to fix these links if you do not use {\bf chroot}.
672
\paragraph*{Final Step:}
674
At this point, the restore should have finished with no errors, and all your
675
files will be restored. One last task remains and that is to write a new boot
676
sector so that your machine will boot. For {\bf lilo}, you enter the following
685
If you are using grub instead of lilo, you must enter the following:
693
Note, I've had quite a number of problems with {\bf grub} because it is rather
694
complicated and not designed to install easily under a simplified system. So,
695
if you experience errors or end up unexpectedly in a {\bf chroot} shell,
696
simply exit back to the normal shell and type in the appropriate commands from
697
the {\bf run\_grub} script by hand until you get it to install. When you run
698
the run\_grub script, it will print the commands that you should manually
699
enter if that is necessary.
703
First unmount all your hard disks, otherwise they will not be cleanly
704
shutdown, then reboot your machine by entering {\bf exit} until you get to the
705
main prompt then enter {\bf Ctrl-d}. Once back to the main CDROM prompt, you
706
will need to turn the power off, then back on to your machine to get it to
709
If everything went well, you should now be back up and running. If not,
710
re-insert the emergency boot CDROM, boot, and figure out what is wrong.
713
\subsection*{Restoring a Server}
714
\index[general]{Restoring a Server }
715
\index[general]{Server!Restoring a }
716
\addcontentsline{toc}{subsection}{Restoring a Server}
718
Above, we considered how to recover a client machine where a valid Bacula
719
server was running on another machine. However, what happens if your server
720
goes down and you no longer have a running Director, Catalog, or Storage
721
daemon? There are several solutions:
724
\item Bring up static versions of your Director, Catalog, and Storage daemon.
726
\item Move your server to another machine.
729
The first option, is very difficult because it requires you to have created a
730
static version of the Director and the Storage daemon as well as the Catalog.
731
If the Catalog uses MySQL or PostgreSQL, this may or may not be possible. In
732
addition, to loading all these programs on a bare system (quite possible), you
733
will need to make sure you have a valid driver for your tape drive.
735
The second suggestion is probably a much simpler solution, and one I have done
736
myself. To do so, you might want to consider the following steps:
739
\item If you are using MySQL or PostgreSQL, configure, build and install it
740
from source (or use rpms) on your new system.
741
\item Load the Bacula source code onto your new system, configure, install
742
it, and create the Bacula database.
743
\item If you have a valid saved Bootstrap file as created for your damaged
744
machine with WriteBootstrap, use it to restore the files to the damaged
745
machine, where you have loaded a static Bacula File daemon using the Bacula
746
Rescue disk). This is done by using the restore command and at the yes/mod/no
747
prompt, selecting {\bf mod} then specifying the path to the bootstrap file.
748
\item If you have the Bootstrap file, you should now be back up and running,
749
if you do not have a Bootstrap file, continue with the suggestions below.
750
\item Using {\bf bscan} scan the last set of backup tapes into your MySQL,
751
PostgreSQL or SQLite database.
752
\item Start Bacula, and using the Console {\bf restore} command, restore the
753
last valid copy of the Bacula database and the Bacula configuration
755
\item Move the database to the correct location.
756
\item Start the database, and restart Bacula. Then use the Console {\bf
757
restore} command, restore all the files on the damaged machine, where you
758
have loaded a Bacula File daemon using the Bacula Rescue disk.
763
\subsection*{Linux Problems or Bugs}
764
\index[general]{Bugs!Linux Problems or }
765
\index[general]{Linux Problems or Bugs }
766
\addcontentsline{toc}{subsection}{Linux Problems or Bugs}
768
Since every flavor and every release of Linux is different, there are likely
769
to be some small difficulties with the scripts, so please be prepared to edit
770
them in a minimal environment. A rudimentary knowledge of {\bf vi} is very
771
useful. Also, these scripts do not do everything. You will need to reformat
772
Windows partitions by hand, for example.
774
Getting the boot loader back can be a problem if you are using {\bf grub}
775
because it is so complicated. If all else fails, reboot your system from your
776
floppy but using the restored disk image, then proceed to a reinstallation of
777
grub (looking at the run-grub script can help). By contrast, lilo is a piece
781
\subsection*{FreeBSD Bare Metal Recovery}
782
\index[general]{Recovery!FreeBSD Bare Metal }
783
\index[general]{FreeBSD Bare Metal Recovery }
784
\addcontentsline{toc}{subsection}{FreeBSD Bare Metal Recovery}
786
The same basic techniques described above also apply to FreeBSD. Although we
787
don't yet have a fully automated procedure, Alex Torres Molina has provided us
788
with the following instructions with a few additions from Jesse Guardiani and
792
\item Boot with the FreeBSD installation disk
793
\item Go to Custom, Partition and create your slices and go to Label and
794
create the particions that you want. Apply changes.
795
\item Go to Fixit to start an emergency console.
796
\item Create devs ad0 .. .. if they don't exist under /mnt2/dev (in my situation)
797
with MAKEDEV. The device or devices you create depend on what hard drives you
798
have. ad0 is your first ATA drive. da0 would by your first SCSI drive. Under
799
OS version 5 and greater, your device files are most likely automatically
801
\item mkdir /mnt/disk
802
this is the root of the new disk
803
\item mount /mnt2/dev/ad0s1a /mnt/disk
804
mount /mnt2/dev/ad0s1c /mnt/disk/var
805
mount /mnt2/dev/ad0s1d /mnt/disk/usr
807
The same hard drive issues as above apply here too. Note, under OS version 5
808
or higher, your disk devices may be in /dev not /mnt2/dev.
809
\item Network configuration (ifconfig xl0 ip/mask + route add default
811
\item mkdir /mnt/disk/tmp
812
\item cd /mnt/disk/tmp
813
\item Copy bacula-fd and bacula-fd.conf to this path
814
\item If you need to, use sftp to copy files, after which you must do this:
815
ln -s /mnt2/usr/bin /usr/bin
816
\item chmod u+x bacula-fd
817
\item Modify bacula-fd.conf to fit this machine
818
\item Copy /bin/sh to /mnt/disk, necessary for chroot
819
\item Don't forget to put your bacula-dir's IP address and domain name in
820
/mnt/disk/etc/hosts if it's not on a public net. Otherwise the FD on the
821
machine you are restoring to won't be able to contact the SD and DIR on the
823
\item mkdir -p /mnt/disk/var/db/bacula
824
\item chroot /mnt/disk /tmp/bacula-fd -c /tmp/bacula-fd.conf
826
\item Now you can go to bacula-dir and restore the job with the entire
827
contents of the broken server.
828
\item You must create /proc
833
\subsection*{Solaris Bare Metal Recovery}
834
\index[general]{Solaris Bare Metal Recovery }
835
\index[general]{Recovery!Solaris Bare Metal }
836
\addcontentsline{toc}{subsection}{Solaris Bare Metal Recovery}
838
The same basic techniques described above apply to Solaris:
841
\item the same restrictions as those given for Linux apply
842
\item you will need to create a Bacula Rescue disk
845
However, during the recovery phase, the boot and disk preparation procedures
849
\item there is no need to create an emergency boot disk since it is an
850
integrated part of the Solaris boot.
851
\item you must partition and format your hard disk by hand following manual
852
procedures as described in W. Curtis Preston's book "Unix Backup \&
856
Once the disk is partitioned, formatted and mounted, you can continue with
857
bringing up the network and reloading Bacula.
859
\subsection*{Preparing Solaris Before a Disaster}
860
\index[general]{Preparing Solaris Before a Disaster }
861
\index[general]{Disaster!Preparing Solaris Before a }
862
\addcontentsline{toc}{subsection}{Preparing Solaris Before a Disaster}
864
As mentioned above, before a disaster strikes, you should prepare the
865
information needed in the case of problems. To do so, in the {\bf
866
rescue/solaris} subdirectory enter:
876
The {\bf getdiskinfo} script will, as in the case of Linux described above,
877
create a subdirectory {\bf diskinfo} containing the output from several system
878
utilities. In addition, it will contain the output from the {\bf SysAudit}
879
program as described in Curtis Preston's book. This file {\bf
880
diskinfo/sysaudit.bsi} will contain the disk partitioning information that
881
will allow you to manually follow the procedures in the "Unix Backup \&
882
Recovery" book to repartition and format your hard disk. In addition, the
883
{\bf getdiskinfo} script will create a {\bf start\_network} script.
885
Once you have your disks repartitioned and formatted, do the following:
888
\item Start Your Network with the {\bf start\_network} script
889
\item Restore the Bacula File daemon as documented above
890
\item Perform a Bacula restore of all your files using the same commands as
891
described above for Linux
892
\item Re-install your boot loader using the instructions outlined in the
893
"Unix Backup \& Recovery" book using installboot
898
\subsection*{Bugs and Other Considerations}
899
\index[general]{Considerations!Bugs and Other }
900
\index[general]{Bugs and Other Considerations }
901
\addcontentsline{toc}{subsection}{Bugs and Other Considerations}
903
\paragraph*{Directory Modification and Access Times are Modified on pre-1.30
906
When a pre-1.30 version of Bacula restores a directory, it first must create
907
the directory, then it populates the directory with its files and
908
subdirectories. The act of creating the files and subdirectories updates both
909
the modification and access times associated with the directory itself. As a
910
consequence, all modification and access times of all directories will be
911
updated to the time of the restore.
913
This has been corrected in Bacula version 1.30 and later. The directory
914
modification and access times are reset to the value saved in the backup after
915
all the files and subdirectories have been restored. This has been tested and
916
verified on normal restore operations, but not verified during a bare metal
919
\paragraph*{Strange Bootstrap Files:}
921
If any of you look closely at the bootstrap file that is produced and used for
922
the restore (I sure do), you will probably notice that the FileIndex item does
923
not include all the files saved to the tape. This is because in some instances
924
there are duplicates (especially in the case of an Incremental save), and in
925
such circumstances, {\bf Bacula} restores only the last of multiple copies of
929
\subsection*{Disaster Recovery of Win32 Systems}
930
\index[general]{Systems!Disaster Recovery of Win32 }
931
\index[general]{Disaster Recovery of Win32 Systems }
932
\addcontentsline{toc}{subsection}{Disaster Recovery of Win32 Systems}
934
Due to open system files, and registry problems, Bacula cannot save and
935
restore a complete Win2K/XP/NT environment.
937
A suggestion by Damian Coutts using Microsoft's NTBackup utility in
938
conjunction with Bacula should permit a Full bare metal restore of Win2K/XP
939
(and possibly NT systems). His suggestion is to do an NTBackup of the critical
940
system state prior to running a Bacula backup with the following command:
944
ntbackup backup systemstate /F c:\systemstate.bkf
948
The {\bf backup} is the command, the {\bf systemstate} says to backup only the
949
system state and not all the user files, and the {\bf /F
950
c:\textbackslash{}systemstate.bkf} specifies where to write the state file.
951
this file must then be saved and restored by Bacula.
953
To restore the system state, you first reload a base operating system, then
954
you would use Bacula to restore all the users files and to recover the {\bf
955
c:\textbackslash{}systemstate.bkf} file, and finally, run {\bf NTBackup} and
956
{\bf catalogue} the system statefile, and then select it for restore. The
957
documentation says you can't run a command line restore of the systemstate.
959
This procedure has been confirmed to work by Ludovic Strappazon -- many
962
A new tool is provided in the form of a bacula plugin for the BartPE rescue
963
CD. BartPE is a self-contained WindowsXP boot CD which you can make using the
964
PeBuilder tools available at
965
\elink{http://www.nu2.nu/pebuilder/}{http://www.nu2.nu/pebuilder/} and a valid
966
Windows XP SP1 CDROM. The plugin is provided as a zip archive. Unzip the file
967
and copy the bacula directory into the plugin directory of your BartPE
968
installation. Edit the configuration files to suit your installation and build
969
your CD according to the instructions at Bart's site. This will permit you to
970
boot from the cd, configure and start networking, start the bacula file client
971
and access your director with the console program. The programs menu on the
972
booted CD contains entries to install the file client service, start the file
973
client service, and start the WX-Console. You can also open a command line
974
window and CD Programs\textbackslash{}Bacula and run the command line console
977
\subsection*{Resetting Directory and File Ownership and Permissions on Win32
979
\index[general]{Systems!Resetting Directory and File Ownership and Permissions
981
\index[general]{Resetting Directory and File Ownership and Permissions on
983
\addcontentsline{toc}{subsection}{Resetting Directory and File Ownership and
984
Permissions on Win32 Systems}
986
Bacula versions after 1.31 should properly restore ownership and permissions
987
on all WinNT/XP/2K systems. If you do experience problems, generally in
988
restores to alternate directories because higher level directories were not
989
backed up by Bacula, you can correct any problems with the {\bf SetACL}
990
available under the GPL license at:
991
\elink{http://sourceforge.net/projects/setacl/}{http://sourceforge.net/project%
994
\subsection*{Alternate Disaster Recovery Suggestion for Win32 Systems}
995
\index[general]{Systems!Alternate Disaster Recovery Suggestion for Win32 }
996
\index[general]{Alternate Disaster Recovery Suggestion for Win32 Systems }
997
\addcontentsline{toc}{subsection}{Alternate Disaster Recovery Suggestion for
1000
Ludovic Strappazon has suggested an interesting way to backup and restore
1001
complete Win32 partitions. Simply boot your Win32 system with a Linux Rescue
1002
disk as described above for Linux, install a statically linked Bacula, and
1003
backup any of the raw partitions you want. Then to restore the system, you
1004
simply restore the raw partition or partitions. Here is the email that Ludovic
1005
recently sent on that subject:
1009
I've just finished testing my brand new cd LFS/Bacula
1010
with a raw Bacula backup and restore of my portable.
1011
I can't resist sending you the results: look at the rates !!!
1012
hunt-dir: Start Backup JobId 100, Job=HuntBackup.2003-04-17_12.58.26
1013
hunt-dir: Bacula 1.30 (14Apr03): 17-Apr-2003 13:14
1015
Job: HuntBackup.2003-04-17_12.58.26
1016
FileSet: RawPartition
1018
Client: sauvegarde-fd
1019
Start time: 17-Apr-2003 12:58
1020
End time: 17-Apr-2003 13:14
1022
Bytes Written: 10,058,586,272
1024
Software Compression: None
1025
Volume names(s): 000103
1026
Volume Session Id: 2
1027
Volume Session Time: 1050576790
1028
Last Volume Bytes: 10,080,883,520
1029
FD termination status: OK
1030
SD termination status: OK
1031
Termination: Backup OK
1032
hunt-dir: Begin pruning Jobs.
1033
hunt-dir: No Jobs found to prune.
1034
hunt-dir: Begin pruning Files.
1035
hunt-dir: No Files found to prune.
1036
hunt-dir: End auto prune.
1037
hunt-dir: Start Restore Job RestoreFilesHunt.2003-04-17_13.21.44
1038
hunt-sd: Forward spacing to file 1.
1039
hunt-dir: Bacula 1.30 (14Apr03): 17-Apr-2003 13:54
1041
Job: RestoreFilesHunt.2003-04-17_13.21.44
1042
Client: sauvegarde-fd
1043
Start time: 17-Apr-2003 13:21
1044
End time: 17-Apr-2003 13:54
1046
Bytes Restored: 10,056,130,560
1048
FD termination status: OK
1049
Termination: Restore OK
1050
hunt-dir: Begin pruning Jobs.
1051
hunt-dir: No Jobs found to prune.
1052
hunt-dir: Begin pruning Files.
1053
hunt-dir: No Files found to prune.
1054
hunt-dir: End auto prune.
1060
\subsection*{Restoring to a Running System}
1061
\index[general]{System!Restoring to a Running }
1062
\index[general]{Restoring to a Running System }
1063
\addcontentsline{toc}{subsection}{Restoring to a Running System}
1065
If for some reason you want to do a Full restore to a system that has a
1066
working kernel (not recommended), you will need to take care not to
1067
overwrite the following files:
1084
\subsection*{Additional Resources}
1085
\index[general]{Additional Resources }
1086
\index[general]{Resources!Additional }
1087
\addcontentsline{toc}{subsection}{Additional Resources}
1089
Many thanks to Charles Curley who wrote
1090
\elink{ Linux Complete Backup and Recovery
1092
{http://www.tldp.org/HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO/index.html%
1094
\elink{The Linux Documentation Project}{http://www.tldp.org/}. This is an
1095
excellent document on how to do Bare Metal Recovery on Linux systems, and it
1096
was this document that made me realize that Bacula could do the same thing.
1098
You can find quite a few additional resources, both commercial and free at
1099
\elink{Storage Mountain}{http://www.backupcentral.com}, formerly known as
1102
And finally, the O'Reilly book, "Unix Backup \& Recovery" by W. Curtis
1103
Preston covers virtually every backup and recovery topic including bare metal
1104
recovery for a large range of Unix systems.