~ubuntu-branches/ubuntu/trusty/bacula-doc/trusty

« back to all changes in this revision

Viewing changes to manual-de/rescuefloppy.tex

  • Committer: Bazaar Package Importer
  • Author(s): John Goerzen
  • Date: 2006-08-15 09:44:08 UTC
  • Revision ID: james.westby@ubuntu.com-20060815094408-1kvvfls2hs3d9uw8
Tags: upstream-1.38.11.1
ImportĀ upstreamĀ versionĀ 1.38.11.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%%
 
3
 
 
4
\section*{Disaster Recovery Using a Bacula Rescue Floppy}
 
5
\label{_ChapterStart24}
 
6
\index[general]{Floppy!Disaster Recovery Using a Bacula Rescue }
 
7
\index[general]{Disaster Recovery Using a Bacula Rescue Floppy }
 
8
\addcontentsline{toc}{section}{Disaster Recovery Using a Bacula Rescue Floppy}
 
9
 
 
10
\subsection*{General}
 
11
\index[general]{General }
 
12
\addcontentsline{toc}{subsection}{General}
 
13
 
 
14
Please note that the Bacula Rescue Floppy is now deprecated and is 
 
15
replaced by the Bacula Rescue CDROM described in another
 
16
chapter of this manual. The code will remain until after the 1.38.0 
 
17
release, then it will be removed.
 
18
 
 
19
When disaster strikes, you must have a plan, and you must have prepared in
 
20
advance otherwise the work of recovering your system and your files will be
 
21
considerably greater. For example, if you have not previously saved the
 
22
partitioning information for your hard disk, how can you properly rebuild it
 
23
if the disk must be replaced? 
 
24
 
 
25
Unfortunately, many of the steps one must take before and immediately after a
 
26
disaster are very operating system dependent. As a consequence, this chapter
 
27
will discuss in detail disaster recovery (also called Bare Metal Recovery) for
 
28
{\bf Linux} and {\bf Solaris}. For Solaris, the procedures are still quite
 
29
manual. For FreeBSD the same procedures may be used but they are not yet
 
30
developed. For Win32, no luck. Apparently an "emergency boot" disk allowing
 
31
access to the full system API without interference does not exist. 
 
32
\label{considerations}
 
33
 
 
34
\subsection*{Important Considerations}
 
35
\index[general]{Important Considerations }
 
36
\index[general]{Considerations!Important }
 
37
\addcontentsline{toc}{subsection}{Important Considerations}
 
38
 
 
39
Here are a few important considerations concerning disaster recovery that you
 
40
should take into account before a disaster strikes. 
 
41
 
 
42
\begin{itemize}
 
43
\item If the building which houses your computers burns down or is otherwise 
 
44
   destroyed, do you have off-site backup data? 
 
45
\item Disaster recovery is much easier if you have several machines. If  you
 
46
   have a single machine, how will you handle unforeseen events  if your only
 
47
   machine is down? 
 
48
\item Do you want to protect your whole system and use Bacula to  recover
 
49
   everything? or do you want to try to restore your system from  the original
 
50
   installation disks and apply any other updates and  only restore user files? 
 
51
\end{itemize}
 
52
 
 
53
\label{steps}
 
54
 
 
55
\subsection*{Steps to Take Before Disaster Strikes}
 
56
\index[general]{Steps to Take Before Disaster Strikes }
 
57
\index[general]{Strikes!Steps to Take Before Disaster }
 
58
\addcontentsline{toc}{subsection}{Steps to Take Before Disaster Strikes}
 
59
 
 
60
\begin{itemize}
 
61
\item Create a Bacula Rescue floppy for each of your Linux systems.  
 
62
\item Ensure that you always have a valid bootstrap file that is  saved to an
 
63
   alternate machine.  
 
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 Test using the Bacula Rescue floppy before you are forced to use  it in
 
68
   an emergency situation. 
 
69
   \end{itemize}
 
70
 
 
71
\label{floppy}
 
72
 
 
73
\subsection*{Bare Metal Floppy Recovery on Linux with a Bacula Floppy Rescue
 
74
Disk}
 
75
\index[general]{Disk!Bare Metal Floppy Recovery on Linux with a Bacula Floppy
 
76
Rescue }
 
77
\index[general]{Bare Metal Floppy Recovery on Linux with a Bacula Floppy
 
78
Rescue Disk }
 
79
\addcontentsline{toc}{subsection}{Bare Metal Floppy Recovery on Linux with a
 
80
Bacula Floppy Rescue Disk}
 
81
 
 
82
Since floppies are being used less and less, the Bacula Floppy rescue disk is
 
83
deprecated, which means that it is no longer really supported. For those of
 
84
you who have or need floppy rescue, we include the recovery instructions here
 
85
for your reference. 
 
86
 
 
87
The remainder of this section concerns recovering a {\bf Linux} computer using
 
88
a floppy, and parts of it relate to the Red Hat version of Linux. 
 
89
 
 
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. 
 
94
 
 
95
Bare Metal Recovery assumes that you have the following four items for your
 
96
system: 
 
97
 
 
98
\begin{itemize}
 
99
\item An emergency boot disk allowing you to boot without a  hard disk  
 
100
\item A Bacula Rescue floppy containing your disk information and  a number of
 
101
   helpful scripts (described below) including a  statically linked version of
 
102
   the Bacula File daemon 
 
103
\item A full Bacula backup of your system possibly including  Incremental or
 
104
   Differential backups since the last Full  backup 
 
105
\item A second system running the Bacula Director, the Catalog,  and the
 
106
   Storage daemon. (this is not an absolute requirement,  but how to get around
 
107
   it is not yet documented here) 
 
108
\end{itemize}
 
109
 
 
110
\subsection*{Restrictions}
 
111
\index[general]{Restrictions }
 
112
\addcontentsline{toc}{subsection}{Restrictions}
 
113
 
 
114
In addition, to the above assumptions, the following conditions or
 
115
restrictions apply: 
 
116
 
 
117
\begin{itemize}
 
118
\item Linux only -- tested only on Red Hat, but should work on other Linuxes  
 
119
\item The scripts handle only SCSI and IDE disks  
 
120
\item All partitions will be recreated, but only {\bf ext2},  {\bf ext3}, and
 
121
   {\bf swap} partitions will be reformatted.  Any other partitions such as
 
122
   Windows FAT partitions will  not be formatted by the scripts, but you can do
 
123
   it by hand  
 
124
\item You are using either {\bf lilo} or {\bf grub} as a boot  loader, and you
 
125
   know which one (not automatically detected)  
 
126
\item The partitioning and reformatting scripts *should* work with RAID 
 
127
   devices, but probably not with other "complicated" disk 
 
128
   partitioning/formatting schemes. Please check them carefully. You  will
 
129
   probably need to edit the scripts by hand to make them work. 
 
130
\end{itemize}
 
131
 
 
132
\subsection*{Directories}
 
133
\index[general]{Directories }
 
134
\addcontentsline{toc}{subsection}{Directories}
 
135
 
 
136
If you are building a self-contained Bacula Rescue CDROM, you will find the
 
137
necessary scripts in {\bf rescule/linux/cdrom} subdirectory of the Bacula
 
138
source code. 
 
139
 
 
140
If you wish to build the Bacula Rescue floppy disk, the scripts discussed
 
141
below can be found in the {\bf rescue/linux/floppy} subdirectory of the Bacula
 
142
source code. 
 
143
 
 
144
\subsection*{Preparation for a Bare Metal Recovery}
 
145
\index[general]{Recovery!Preparation for a Bare Metal }
 
146
\index[general]{Preparation for a Bare Metal Recovery }
 
147
\addcontentsline{toc}{subsection}{Preparation for a Bare Metal Recovery}
 
148
 
 
149
There are two things you should do immediately on all (Linux) systems for
 
150
which you wish to do a bare metal recovery: 
 
151
 
 
152
\begin{enumerate}
 
153
\item Create a system emergency boot disk or alternatively  a system
 
154
   installation boot floppy. This step can be skipped  if you have an
 
155
   Installation CDROM and your machine will boot  from CDROM (most modern
 
156
   computers will).  
 
157
\item Create a Bacula Rescue floppy, which captures the current working  state
 
158
   of your computer and creates scripts to restore it. In  addition, it creates a
 
159
   statically linked version of the Bacula  File daemon (Client) program, which
 
160
   is key to successfully restoring  from scratch. 
 
161
\end{enumerate}
 
162
 
 
163
\subsubsection*{Creating an Emergency Boot Disk}
 
164
\index[general]{Creating an Emergency Boot Disk }
 
165
\index[general]{Disk!Creating an Emergency Boot }
 
166
\addcontentsline{toc}{subsubsection}{Creating an Emergency Boot Disk}
 
167
 
 
168
Here you have several choices: 
 
169
 
 
170
\begin{itemize}
 
171
\item Create a tomsrtbt disk (any Linux)  
 
172
\item Create an emergency boot disk (any Linux I think) 
 
173
\item Create a Red Hat Installation disk (Red Hat specific)  
 
174
\item Others 
 
175
   \end{itemize}
 
176
 
 
177
\paragraph*{tomsrtbt:}
 
178
 
 
179
If you have created a Bacula Rescue CDROM, you can skip this section. 
 
180
 
 
181
If you *must* use a boot floppy, my preference is to create and use a {\bf
 
182
tomsrtbt} emergency boot disk because it gives you a very clean Linux
 
183
environment (with a 2.2 kernel) and the most utilities. See 
 
184
\elink{http://www.toms.net/rb/}{http://www.toms.net/rb/} for more details on
 
185
this. It is very easy to do and well worth the effort. However, I recommend
 
186
that you create both especially if you have non-standard hardware. You may
 
187
find that {\bf tomsrtbt} will not work with your network driver (he surely has
 
188
one, but you must explicitly put it on the disk), whereas the Linux rescue is
 
189
more likely to work. 
 
190
 
 
191
\paragraph*{Emergency Boot Disk:}
 
192
 
 
193
If you have created a Bacula Rescue CDROM, you can skip this section. 
 
194
 
 
195
To create a standard Linux emergency boot disk you must first know the name of
 
196
the kernel, which you can find with: 
 
197
 
 
198
\footnotesize
 
199
\begin{verbatim}
 
200
  ls -l /boot
 
201
\end{verbatim}
 
202
\normalsize
 
203
 
 
204
and looking on the {\bf vmlinux-...} line or alternatively do a
 
205
 
 
206
\footnotesize
 
207
\begin{verbatim}
 
208
 uname -a
 
209
\end{verbatim}
 
210
\normalsize
 
211
 
 
212
then become root and with a blank floppy in the drive, enter the following
 
213
command: 
 
214
 
 
215
\footnotesize
 
216
\begin{verbatim}
 
217
  mkbootdisk --device /dev/fd0 2.4.18-18
 
218
\end{verbatim}
 
219
\normalsize
 
220
 
 
221
where you replace "2.4.18-18" by your system name. 
 
222
 
 
223
This disk can then be booted and you will be in an environment with a number
 
224
of important tools available. Some disadvantages of this environment as
 
225
opposed to {\bf tomsrtbt} are that you must enter {\bf linux rescue} at the
 
226
boot prompt or the boot will fail without a hard disk; it requires a disk boot
 
227
image or a CDROM to be mounted, if the CDROM is released, you will lose a
 
228
large number of the tools. 
 
229
 
 
230
\paragraph*{Red Hat Installation Disk:}
 
231
 
 
232
If you have created a Bacula Rescue CDROM, you can skip this section. 
 
233
 
 
234
Specific to Red Hat Linux, is to create an Installation floppy, which can also
 
235
be used as an emergency boot disk. The advantage of this method is that it
 
236
works in conjunction with the installation CDROM and hence during the first
 
237
part of restoring the system, you have a much larger number of tools available
 
238
(on the CDROM). This can be extremely useful if you are not sure what really
 
239
happened and you need to examine your system in detail. 
 
240
 
 
241
To make a Red Hat Linux installation disk, do the following: 
 
242
 
 
243
\footnotesize
 
244
\begin{verbatim}
 
245
mount the Installation CDROM (/mnt/cdrom)
 
246
cd /mnt/cdrom/images
 
247
dd if=boot.img of=/dev/fd0 bs=1440k
 
248
\end{verbatim}
 
249
\normalsize
 
250
 
 
251
Now that you have either an emergency boot disk or an installation floppy, you
 
252
will be able to reboot your system in the absence of your hard disk or with a
 
253
damaged hard disk. This method has the same disadvantages compared to {\bf
 
254
tomsrtbt} disk as mentioned above for the Emergency Boot Disk. 
 
255
 
 
256
\subsubsection*{Creating a Bacula Rescue Disk}
 
257
\index[general]{Creating a Bacula Rescue Disk }
 
258
\index[general]{Disk!Creating a Bacula Rescue }
 
259
\addcontentsline{toc}{subsubsection}{Creating a Bacula Rescue Disk}
 
260
 
 
261
If you have created a Bacula Rescue CDROM, this step will be automatically
 
262
done for you. 
 
263
 
 
264
Simply having a boot disk is not sufficient to re-create things as they were.
 
265
To solve this problem, we will create a Bacula Rescue disk. Everything that
 
266
will be written to this disk will first be placed into the {\bf
 
267
\lt{}bacula-src\gt{}/rescue/linux} directory. 
 
268
 
 
269
The first step is while your system is up and running normally, you use a
 
270
Bacula script called {\bf getdiskinfo} to capture certain important
 
271
information about your hard disk configuration (partitioning, formatting,
 
272
mount points, ...). {\bf getdiskinfo} will also create a number of scripts
 
273
using the information found that can be used in an emergency to repartition
 
274
your disks, reformat them, and restore a statically linked version of the
 
275
Bacula file daemon so that your disk can be restored from within a minimal
 
276
boot environment. 
 
277
 
 
278
The first step is to run {\bf getdiskinfo} as follows: 
 
279
 
 
280
\footnotesize
 
281
\begin{verbatim}
 
282
   su
 
283
   cd <bacula-src>/rescue/linux
 
284
   ./getdiskinfo
 
285
\end{verbatim}
 
286
\normalsize
 
287
 
 
288
{\bf getdiskinfo} works for either IDE or SCSI drives and recognizes both ext2
 
289
and ext3 file systems. If you wish to restore other file systems, you will
 
290
need to modify the code. This script can be run multiple times, but really
 
291
only needs to be run once unless you change your hard disk configuration. 
 
292
 
 
293
Assuming you have a single hard disk on device /dev/hda, {\bf getdiskinfo}
 
294
will create the following files: 
 
295
 
 
296
\begin{description}
 
297
 
 
298
\item [partition.hda]
 
299
   \index[fd]{partition.hda }
 
300
   This file contains the shell commands  to repartition your hard disk drive
 
301
/dev/hda to the current  state. If you have additional drives (e.g. /dev/hdc),
 
302
you  will find one of these files for each drive.  DO NOT EXECUTE THIS SCRIPT
 
303
UNLESS YOU WANT YOUR HARD DISK  REPARTITIONED  
 
304
 
 
305
\item [format.hda]
 
306
   \index[fd]{format.hda }
 
307
   This file contains the shell commands that  will format each of the partitions
 
308
on your hard drive. It  knows about ext2, ext3, and swap partitions. All other
 
309
partitions,  you must manually format. It is recommended that any Microsoft 
 
310
partitions be partitioned with Microsoft's {\bf format} command  rather than
 
311
using Unix tools.  DO NOT EXECUTE THIS SCRIPT UNLESS YOU WANT YOUR HARD DISK 
 
312
REFORMATTED  
 
313
 
 
314
\item [mount\_drives]
 
315
   \index[fd]{mount\_drives }
 
316
   This script will mount all ext2 and ext3  drives that were previously mounted.
 
317
They will be mounted on  
 
318
 
 
319
/mnt/drive/. This is used just before running the statically  linked Bacula so
 
320
that it can access your drives for the restore.  
 
321
 
 
322
\item [restore\_bacula]
 
323
   \index[fd]{restore\_bacula }
 
324
   This script will restore the File daemon  from the Bacula Rescue disk.
 
325
Building the Bacula Rescue disk  will be described later. This will provide
 
326
your emergency boot  environment with a Bacula file daemon. Note, this is a
 
327
special  statically linked version of the file daemon (i.e. it does not  need
 
328
or use shared libraries).  
 
329
 
 
330
\item [start\_network]
 
331
   \index[fd]{start\_network }
 
332
   This script will start your network using  the simplest possible commands. You
 
333
will need to verify that the  IP address used in this script is correct. In
 
334
addition, if you  have several ethernet cards, you may need to make other
 
335
modifications  to this script.  
 
336
 
 
337
\item [sfdisk]
 
338
   \index[fd]{sfdisk }
 
339
   This is the program that will repartition your hard disk,  and it is normally
 
340
found in {\bf /sbin/sfdisk}. It is placed in  this directory so that it will
 
341
be included on the rescue disk as  it is not normally available with all
 
342
emergency boot environments.  
 
343
 
 
344
\item [sfdisk.gz]
 
345
   \index[dir]{sfdisk.gz }
 
346
   This is the version of sfdisk that works with  {\bf tomsrtbt}. The standard
 
347
sfdisk described above will not  run under tomsrtbt. 
 
348
\end{description}
 
349
 
 
350
The {\bf getdiskinfo} program (actually a shell script) will also create a
 
351
subdirectory named {\bf diskinfo}, which contains the following files: 
 
352
 
 
353
\footnotesize
 
354
\begin{verbatim}
 
355
df.bsi
 
356
disks.bsi
 
357
fstab.bsi
 
358
ifconfig.bsi
 
359
mount.bsi
 
360
mount.ext2.bsi
 
361
mount.ext3.bsi
 
362
mtab.bsi
 
363
route.bsi
 
364
sfdisk.disks.bsi
 
365
sfdisk.hda.bsi
 
366
sfdisk.make.hda.bsi
 
367
\end{verbatim}
 
368
\normalsize
 
369
 
 
370
Each of these files contains some important piece of information (sometimes
 
371
redundant) about your hard disk setup or your network. Normally, you will not
 
372
need this information, but it will be written to the Bacula Rescue disk just
 
373
in case. Since it is normally not used, we will leave it to you to examine
 
374
those files at your leisure. 
 
375
 
 
376
\paragraph*{Building a Static File Daemon:}
 
377
 
 
378
If you have created a Bacula Rescue CDROM, this step will be automatically
 
379
done for you. 
 
380
 
 
381
The second of the three steps in creating your Bacula Rescue disk is to build
 
382
a static version of the File daemon. Do so by either configuring Bacula as
 
383
follows or by allowing the {\bf make\_rescue\_disk} script described below
 
384
make it for you: 
 
385
 
 
386
\footnotesize
 
387
\begin{verbatim}
 
388
cd <bacula-src>
 
389
./configure <normal-options>
 
390
make
 
391
cd src/filed
 
392
make static-bacula-fd
 
393
strip static-bacula-fd
 
394
cp static-bacula-fd ../../rescue/linux/bacula-fd
 
395
cp bacula-fd.conf ../../rescue/linux
 
396
\end{verbatim}
 
397
\normalsize
 
398
 
 
399
Note, above, we built {\bf static-bacula-fd} and changed its name to {\bf
 
400
bacula-fd} when copying it to the rescue/linux directory. 
 
401
 
 
402
Finally, in \lt{}bacula-src\gt{}/rescue/linux, ensure that the
 
403
WorkingDirectory and PIDDirectory both point to reasonable locations on a
 
404
stripped down system. If you are using {\bf tomsrtbt} you will also want to
 
405
replace machine names with IP addresses since there is no resolver running.
 
406
With the Linux Rescue disk, network address mapping seems to work. Don't
 
407
forget that at the time this version of the Bacula File daemon runs, your file
 
408
system will not be restored. In my bacula-fd.conf, I use {\bf /var/working}. 
 
409
 
 
410
\paragraph*{Writing the Bacula Rescue Floppy:}
 
411
 
 
412
When you have everything you need (output of getdiskinfo, Bacula File daemon,
 
413
...), you create your rescue floppy by putting a blank tape into your floppy
 
414
disk drive and entering: 
 
415
 
 
416
\footnotesize
 
417
\begin{verbatim}
 
418
su
 
419
./make_rescue_disk
 
420
\end{verbatim}
 
421
\normalsize
 
422
 
 
423
This script will reformat the floppy and write everything in the current
 
424
directory and all files in the {\bf diskinfo} directory to the floppy. If you
 
425
supply the appropriate command line options, it will also build a static
 
426
version of the Bacula file daemon and copy it along with the configuration
 
427
file to the disk. Also using a command line option, you can make it write a
 
428
compressed tar file containing all the files whose names are in {\bf
 
429
backup.etc.list} to the floppy. The list as provided contains names of files
 
430
in {\bf /etc} that you might need in a disaster situation. It is not needed,
 
431
but in some cases such as a complex network setup, you may find it useful. 
 
432
 
 
433
\paragraph*{Options for make\_rescue\_disk:}
 
434
 
 
435
The following command line options are available for the make\_rescue\_disk
 
436
script: 
 
437
 
 
438
\footnotesize
 
439
\begin{verbatim}
 
440
Usage: make_rescue_disk
 
441
  -h, --help             print this message
 
442
  --make-static-bacula   make static File daemon and add to diskette
 
443
  --copy-static-bacula   copy static File daemon to diskette
 
444
  --copy-etc-files       copy files in etc list to diskette
 
445
\end{verbatim}
 
446
\normalsize
 
447
 
 
448
Briefly the options are: 
 
449
 
 
450
\begin{description}
 
451
 
 
452
\item [{-}{-}make-static-bacula]
 
453
   \index[fd]{{-}{-}make-static-bacula }
 
454
   If this option is specified, the  script will assume that you have already
 
455
configured and  built Bacula. It will then proceed to build a statically 
 
456
linked version and copy it along with bacula-fd.conf to the  current
 
457
directory, then write it to the rescue disk.  
 
458
 
 
459
\item [{-}{-}copy-static-bacula]
 
460
   \index[dir]{{-}{-}copy-static-bacula }
 
461
   If this option is given, the  script will assume that you already have a copy
 
462
of the  statically linked Bacula in the current directory named  {\bf
 
463
bacula-fd} as well as the configuration script. They  will then be written to
 
464
the rescue disk.  
 
465
 
 
466
\item [{-}{-}copy-etc-files]
 
467
   \index[fd]{{-}{-}copy-etc-files }
 
468
   If this option is specified, the  script will tar the files in {\bf
 
469
backup.etc.list} and write  them to the rescue disk. 
 
470
\end{description}
 
471
 
 
472
Please examine the contents of the rescue floppy to ensure that it has
 
473
everything you want and need. If not modify the scripts as necessary and
 
474
re-run it until it is correct. 
 
475
 
 
476
Now that you have both a system boot floppy and a Bacula Rescue floppy,
 
477
assuming you have a full backup of your system made by Bacula, you are ready
 
478
to handle nearly any kind of emergency restoration situation. 
 
479
\label{FloppyRestore}
 
480
 
 
481
\subsection*{Restoring Your Linux Client with a Floppy}
 
482
\index[general]{Restoring Your Linux Client with a Floppy }
 
483
\index[general]{Floppy!Restoring Your Linux Client with a }
 
484
\addcontentsline{toc}{subsection}{Restoring Your Linux Client with a Floppy}
 
485
 
 
486
Now, let's assume that your hard disk has just died and that you have replaced
 
487
it with a new identical drive. In addition, we assume that you have: 
 
488
 
 
489
\begin{enumerate}
 
490
\item A recent Bacula backup (Full plus Incrementals)  
 
491
\item An emergency boot floppy (preferably {\bf tomsrtbt})  
 
492
\item A Bacula Rescue Floppy Disk  
 
493
\item Your Bacula Director, Catalog, and Storage daemon running  on another
 
494
   machine on your local network. 
 
495
   \end{enumerate}
 
496
 
 
497
This is a relatively simple case, and later in this chapter, as time permits,
 
498
we will discuss how you might recover from a situation where the machine that
 
499
crashes is your main Bacula server (i.e. has the Director, the Catalog, and
 
500
the Storage daemon). 
 
501
 
 
502
You will take the following steps to get your system back up and running: 
 
503
 
 
504
\begin{enumerate}
 
505
\item Boot with your Emergency Floppy  
 
506
\item Mount your Bacula Rescue floppy  
 
507
\item Start the Network (local network)  
 
508
\item Re-partition your hard disk(s) as it was before  
 
509
\item Re-format your partitions  
 
510
\item Restore the Bacula File daemon (static version)  
 
511
\item Perform a Bacula restore of all your files  
 
512
\item Re-install your boot loader  
 
513
\item Reboot 
 
514
   \end{enumerate}
 
515
 
 
516
Now for the details ... 
 
517
 
 
518
\subsubsection*{Boot with your Emergency Floppy}
 
519
\index[general]{Floppy!Boot with your Emergency }
 
520
\index[general]{Boot with your Emergency Floppy }
 
521
\addcontentsline{toc}{subsubsection}{Boot with your Emergency Floppy}
 
522
 
 
523
First you will boot with your emergency floppy. If you use the Installation
 
524
floppy described above, when you get to the boot prompt: 
 
525
 
 
526
\footnotesize
 
527
\begin{verbatim}
 
528
boot:
 
529
\end{verbatim}
 
530
\normalsize
 
531
 
 
532
you enter {\bf linux rescue}. 
 
533
 
 
534
If you are booting from {\bf tomsrtbt} simply enter the default responses. 
 
535
 
 
536
When your machine finishes booting, you should be at the command prompt
 
537
possibly with your hard disk mounted on {\bf /mount/sysimage} (Linux emergency
 
538
only). To see what is actually mounted, use: 
 
539
 
 
540
\footnotesize
 
541
\begin{verbatim}
 
542
df
 
543
\end{verbatim}
 
544
\normalsize
 
545
 
 
546
\paragraph*{Mount your Bacula Rescue Floppy:}
 
547
 
 
548
Make sure that the mount point {\bf /mnt/floppy} exists. If not, enter: 
 
549
 
 
550
\footnotesize
 
551
\begin{verbatim}
 
552
mkdir -p /mnt/floppy
 
553
\end{verbatim}
 
554
\normalsize
 
555
 
 
556
then mount your {\bf Bacula Rescue} disk and cd to it with: 
 
557
 
 
558
\footnotesize
 
559
\begin{verbatim}
 
560
mount /dev/fd0 /mnt/floppy
 
561
cd /mnt/floppy
 
562
\end{verbatim}
 
563
\normalsize
 
564
 
 
565
To simplify running the scripts make sure the current directory is on your
 
566
path by: 
 
567
 
 
568
\footnotesize
 
569
\begin{verbatim}
 
570
PATH=$PATH:.
 
571
\end{verbatim}
 
572
\normalsize
 
573
 
 
574
\paragraph*{Start the Network:}
 
575
 
 
576
At this point, you should bring up your network. Normally, this is quite
 
577
simple and requires just a few commands. If you have booted from your Bacula
 
578
Rescue CDROM, please cd into the /bacula-hostname directory before continuing.
 
579
To simplify your task, we have created a script that should work in most cases
 
580
by typing: 
 
581
 
 
582
\footnotesize
 
583
\begin{verbatim}
 
584
./start_network
 
585
\end{verbatim}
 
586
\normalsize
 
587
 
 
588
You can test it by pinging another machine, or pinging your broken machine
 
589
machine from another machine. Do not proceed until your network is up. 
 
590
 
 
591
\paragraph*{Unmount Your Hard Disk (if mounted):}
 
592
 
 
593
When you are sure you want to repartition your disk, normally, if your disk
 
594
was damaged or if you are using {\bf tomsrtbt} your hard disk will not be
 
595
mounted. However, if it is you must first unmount it so that it is not in use.
 
596
Do so by entering {\bf df} and then enter the correct commands to unmount the
 
597
disks. For example: 
 
598
 
 
599
\footnotesize
 
600
\begin{verbatim}
 
601
umount /mnt/sysimage/boot
 
602
umount /mnt/sysimage/usr
 
603
umount /mnt/sysimage/proc
 
604
umount /mnt/sysimage/
 
605
\end{verbatim}
 
606
\normalsize
 
607
 
 
608
where you explicitly unmount ({\bf umount}) each sysimage partition and
 
609
finally, the last one being the root. Do another {\bf df} command to be sure
 
610
you successfully unmount all the sysimage partitions. 
 
611
 
 
612
This is necessary because {\bf sfdisk} will refuse to partition a disk that is
 
613
currently mounted. As mentioned, this should never be necessary with {\bf
 
614
tomsrtbt}. 
 
615
 
 
616
\paragraph*{Partition Your Hard Disk(s):}
 
617
 
 
618
If you are using {\bf tomsrtbt}, you will need to do the following steps to
 
619
get the correct sfdisk: 
 
620
 
 
621
\footnotesize
 
622
\begin{verbatim}
 
623
rm -f sfdisk
 
624
bzip2 -d sfdisk.bz2
 
625
\end{verbatim}
 
626
\normalsize
 
627
 
 
628
{\bf Do not do the above steps if you are using a standard Linux boot disk or
 
629
the Bacula Rescue CDROM.} 
 
630
 
 
631
Then proceed with partitioning your hard disk by: 
 
632
 
 
633
\footnotesize
 
634
\begin{verbatim}
 
635
./partition.hda
 
636
\end{verbatim}
 
637
\normalsize
 
638
 
 
639
If you have multiple disks, do the same for each of them. For SCSI disks, the
 
640
repartition script will be named: {\bf partition.sda}. If the script complains
 
641
about the disk being in use, simply go back and redo the {\bf df} command and
 
642
{\bf umount} commands until you no longer have your hard disk mounted. Note,
 
643
in many cases, if your hard disk was seriously damaged or a new one installed,
 
644
it will not automatically be mounted. If it is mounted, it is because the
 
645
emergency kernel found one or more possibly valid partitions. 
 
646
 
 
647
If for some reason this procedure does not work, you can use the information
 
648
in {\bf partition.hda} to re-partition your disks by hand using {\bf fdisk}. 
 
649
 
 
650
\paragraph*{Format Your Hard Disk(s):}
 
651
 
 
652
After partitioning your disk, you must format it appropriately. The formatting
 
653
script will put back swap partitions, normal Unix partitions (ext2) and
 
654
journaled partitions (ext3). Do so by entering for each disk: 
 
655
 
 
656
\footnotesize
 
657
\begin{verbatim}
 
658
./format.hda
 
659
\end{verbatim}
 
660
\normalsize
 
661
 
 
662
The format script will ask you if you want a block check done. We recommend to
 
663
answer yes, but realize that for very large disks this can take hours. 
 
664
 
 
665
\paragraph*{Mount the Newly Formatted Disks:}
 
666
 
 
667
Once the disks are partitioned and formatted, you can remount them with the
 
668
{\bf mount\_drives} script. All your drives must be mounted for Bacula to be
 
669
able to access them. Run the script as follows: 
 
670
 
 
671
\footnotesize
 
672
\begin{verbatim}
 
673
./mount_drives
 
674
df
 
675
\end{verbatim}
 
676
\normalsize
 
677
 
 
678
The {\bf df} will tell you if the drives are mounted. If not, re-run the
 
679
script again. It isn't always easy to figure out and create the mount points
 
680
and the mounts in the proper order, so repeating the {\bf ./mount\_drives}
 
681
command will not cause any harm and will most likely work the second time. If
 
682
not, correct it by hand before continuing. 
 
683
 
 
684
\paragraph*{Unmount the CDROM:}
 
685
 
 
686
Next, if you are using the Red Hat installation disk, unmount the CDROM drive
 
687
by doing: 
 
688
 
 
689
\footnotesize
 
690
\begin{verbatim}
 
691
umount /mnt/cdrom
 
692
\end{verbatim}
 
693
\normalsize
 
694
 
 
695
This is not necessary if you are running {\bf tomsrtbt}. In doing this, I find
 
696
it is always busy, and I haven't figured out how to unmount it (Linux boot
 
697
only). 
 
698
 
 
699
\paragraph*{Restore and Start the File Daemon:}
 
700
 
 
701
If you have booted with a Bacula Rescue CDROM, your statically linked Bacula
 
702
File daemon and the bacula-fd.conf file with be in the /bacula-hostname/bin
 
703
directory. Please skip the following paragraph and continue with editing the
 
704
Bacula configuration file. 
 
705
 
 
706
If you have not used a Bacula Rescue CDROM, now change (cd) to some directory
 
707
where you want to put the image of the Bacula File daemon. I use the tmp
 
708
directory on my hard disk (mounted as {\bf /mnt/disk/tmp}) because it is easy.
 
709
Then install into the current directory Bacula by running the {\bf
 
710
restore\_bacula} script from the floppy drive. For example: 
 
711
 
 
712
\footnotesize
 
713
\begin{verbatim}
 
714
cd /mnt/disk
 
715
mkdir -p /mnt/disk/tmp
 
716
mkdir -p /mnt/disk/tmp/working
 
717
/mnt/floppy/restore_bacula
 
718
ls -l
 
719
\end{verbatim}
 
720
\normalsize
 
721
 
 
722
Make sure {\bf bacula-fd} and {\bf bacula-fd.conf} are both there. 
 
723
 
 
724
Edit the Bacula configuration file, create the working/pid/subsys directory if
 
725
you haven't already done so above, and start Bacula by entering: 
 
726
 
 
727
\footnotesize
 
728
\begin{verbatim}
 
729
chroot /mnt/disk /tmp/bacula-fd -c /tmp/bacula-fd.conf
 
730
\end{verbatim}
 
731
\normalsize
 
732
 
 
733
The above command starts the Bacula File daemon with the proper root disk
 
734
location (i.e. {\bf /mnt/disk/tmp}. If Bacula does not start correct the
 
735
problem and start it. You can check if it is running by entering: 
 
736
 
 
737
\footnotesize
 
738
\begin{verbatim}
 
739
ps fax
 
740
\end{verbatim}
 
741
\normalsize
 
742
 
 
743
You can kill Bacula by entering: 
 
744
 
 
745
\footnotesize
 
746
\begin{verbatim}
 
747
kill -TERM <pid>
 
748
\end{verbatim}
 
749
\normalsize
 
750
 
 
751
where {\bf pid} is the first number printed in front of the first occurrence
 
752
of {\bf bacula-fd} in the {\bf ps -fax} command. 
 
753
 
 
754
Now, you should be able to use another computer with Bacula installed to check
 
755
the status by entering: 
 
756
 
 
757
\footnotesize
 
758
\begin{verbatim}
 
759
status client=xxxx
 
760
\end{verbatim}
 
761
\normalsize
 
762
 
 
763
into the Console program, where xxxx is the name of the client you are
 
764
restoring. 
 
765
 
 
766
One common problem is that your {\bf bacula-dir.conf} may contain machine
 
767
addresses that are not properly resolved on the stripped down system to be
 
768
restored because it is not running DNS. This is particularly true for the
 
769
address in the Storage resource of the Director, which may be very well
 
770
resolved on the Director's machine, but not on the machine being restored and
 
771
running the File daemon. In that case, be prepared to edit {\bf
 
772
bacula-dir.conf} to replace the name of the Storage daemon's domain name with
 
773
its IP address. 
 
774
 
 
775
\paragraph*{Restoring using the RedHat Installation Disk:}
 
776
 
 
777
Suppose your system was damaged for one reason or another, so that the hard
 
778
disk and the partitioning and much of the filesystems are intact, but you want
 
779
to do a full restore. If you have booted into your system with the RedHat
 
780
Installation Disk by specifying {\bf linux rescue} at the {\bf boot:} prompt,
 
781
you will find yourself in a shell command with your disks already mounted (if
 
782
it was possible) in {\bf /mnt/sysimage}. In this case, you can do much like
 
783
you did above to restore your system: 
 
784
 
 
785
\footnotesize
 
786
\begin{verbatim}
 
787
cd /mnt/sysimage/tmp
 
788
mkdir -p /mnt/sysimage/tmp/working
 
789
/mnt/floppy/restore_bacula
 
790
ls -l
 
791
\end{verbatim}
 
792
\normalsize
 
793
 
 
794
Make sure that {\bf bacula-fd} and {\bf bacula-fd.conf} are both in the
 
795
current directory and that the directory names in the {\bf bacula-fd.conf}
 
796
correctly point to the appropriate directories. Then start Bacula with: 
 
797
 
 
798
\footnotesize
 
799
\begin{verbatim}
 
800
chroot /mnt/sysimage /tmp/bacula-fd -c /tmp/bacula-fd.conf
 
801
\end{verbatim}
 
802
\normalsize
 
803
 
 
804
\paragraph*{Restore Your Files:}
 
805
 
 
806
On the computer that is running the Director, you now run a {\bf restore}
 
807
command and select the files to be restored (normally everything), but before
 
808
starting the restore, there is one final change you must make using the {\bf
 
809
mod} option. You must change the {\bf Where} directory to be the root by using
 
810
the {\bf mod} option just before running the job and selecting {\bf Where}.
 
811
Set it to: 
 
812
 
 
813
\footnotesize
 
814
\begin{verbatim}
 
815
/
 
816
\end{verbatim}
 
817
\normalsize
 
818
 
 
819
then run the restore. 
 
820
 
 
821
You might be tempted to avoid using {\bf chroot} and running Bacula directly
 
822
and then using a {\bf Where} to specify a destination of {\bf /mnt/disk}. This
 
823
is possible, however, the current version of Bacula always restores files to
 
824
the new location, and thus any soft links that have been specified with
 
825
absolute paths will end up with {\bf /mnt/disk} prefixed to them. In general
 
826
this is not fatal to getting your system running, but be aware that you will
 
827
have to fix these links if you do not use {\bf chroot}. 
 
828
 
 
829
\paragraph*{Final Step:}
 
830
 
 
831
At this point, the restore should have finished with no errors, and all your
 
832
files will be restored. One last task remains and that is to write a new boot
 
833
sector so that your machine will boot. For {\bf lilo}, you enter the following
 
834
command: 
 
835
 
 
836
\footnotesize
 
837
\begin{verbatim}
 
838
run_lilo
 
839
\end{verbatim}
 
840
\normalsize
 
841
 
 
842
If you are using grub instead of lilo, you must enter the following: 
 
843
 
 
844
\footnotesize
 
845
\begin{verbatim}
 
846
run_grub
 
847
\end{verbatim}
 
848
\normalsize
 
849
 
 
850
Note, I've had quite a number of problems with {\bf grub} because it is rather
 
851
complicated and not designed to install easily under a simplified system. So,
 
852
if you experience errors or end up unexpectedly in a {\bf chroot} shell,
 
853
simply exit back to the normal shell and type in the appropriate commands from
 
854
the {\bf run\_grub} script by hand until you get it to install. 
 
855
 
 
856
\paragraph*{Reboot:}
 
857
 
 
858
Reboot your machine by entering {\bf exit} until you get to the main prompt
 
859
then enter {\bf ctl-d}. 
 
860
 
 
861
If everything went well, you should now be back up and running. If not,
 
862
re-insert the emergency boot floppy, boot, and figure out what is wrong. 
 
863
 
 
864
At this point, you will probably want to remove the temporary copy of Bacula
 
865
that you installed. Do so with: 
 
866
 
 
867
\footnotesize
 
868
\begin{verbatim}
 
869
rm -f /bacula-fd /bacula-fd.conf
 
870
rm -rf /working
 
871
\end{verbatim}
 
872
\normalsize
 
873
 
 
874
\label{FloppyProblems}
 
875
 
 
876
\subsection*{Linux Problems or Bugs}
 
877
\index[general]{Bugs!Linux Problems or }
 
878
\index[general]{Linux Problems or Bugs }
 
879
\addcontentsline{toc}{subsection}{Linux Problems or Bugs}
 
880
 
 
881
Since every flavor and every release of Linux is different, there are likely
 
882
to be some small difficulties with the scripts, so please be prepared to edit
 
883
them in a minimal environment. A rudimentary knowledge of {\bf vi} is very
 
884
useful. Also, these scripts do not do everything. You will need to reformat
 
885
Windows partitions by hand, for example. 
 
886
 
 
887
Getting the boot loader back can be a problem if you are using {\bf grub}
 
888
because it is so complicated. If all else fails, reboot your system from your
 
889
floppy but using the restored disk image, then proceed to a reinstallation of
 
890
grub (looking at the run-grub script can help). By contrast, lilo is a piece
 
891
of cake. 
 
892
 
 
893
\subsubsection*{Bugs}
 
894
\index[general]{Bugs }
 
895
\addcontentsline{toc}{subsubsection}{Bugs}
 
896
 
 
897
When performing the bare metal recovery using the Red Hat emergency boot disk
 
898
(actually the installation boot disk), I was never able to release the cdrom,
 
899
and when the system came up {\bf /mnt/cdrom} was soft linked to {\bf
 
900
/mnt/disk/dev/hdd}, which is not correct. I fixed this in each case by
 
901
deleting and simply remaking it with {\bf mkdir -p /mnt/cdrom}. 
 
902
 
 
903
\subsection*{tomsrtbt}
 
904
\index[general]{Tomsrtbt }
 
905
\addcontentsline{toc}{subsection}{tomsrtbt}
 
906
 
 
907
This is a single floppy (1.722Meg) that really has A LOT of software. For
 
908
example, by default (version 2.0.103) you get: 
 
909
 
 
910
AHA152X AHA1542 AIC7XXX BUSLOGIC DAC960 DEC\_ELCP(TULIP) EATA
 
911
EEXPRESS/PRO/PRO100 EL2 EL3 EXT2 EXT3 FAT FD IDE-CD/DISK/TAPE IMM INITRD
 
912
ISO9660 JOLIET LOOP MATH\_EMULATION MINIX MSDOS NCR53C8XX NE2000 NFS NTFS
 
913
PARPORT PCINE2K PCNET32 PLIP PPA RTL8139 SD SERIAL/\_CONSOLE SLIP SMC\_ULTRA
 
914
SR ST VFAT VID\_SELECT VORTEX WD80x3 .exrc 3c589\_cs agetty ash badblocks
 
915
basename boot.b buildit.s busybox bz2bzImage bzip2 cardmgr cardmgr.pid cat
 
916
chain.b chattr chgrp chmod chown chroot clear clone.s cmp common config cp
 
917
cpio cs cut date dd dd-lfs debugfs ddate df dhcpcd\verb:--: dirname dmesg domainname
 
918
ds du dumpe2fs e2fsck echo egrep elvis ex false fdflush fdformat fdisk
 
919
filesize find findsuper fmt fstab grep group gunzip gzip halt head hexdump
 
920
hexedit host.conf hostname hosts httpd i82365 ifconfig ile init inittab insmod
 
921
install.s issue kernel key.lst kill killall killall5 ld ld-linux length less
 
922
libc libcom\_err libe2p libext2fs libtermcap libuuid lilo lilo.conf ln
 
923
loadkmap login ls lsattr lsmod lua luasocket man map md5sum miterm mkdir
 
924
mkdosfs mke2fs mkfifo mkfs.minix mknod mkswap more more.help mount mt mtab mv
 
925
nc necho network networks nmclan\_cs nslookup passwd pax pcmcia\_core
 
926
pcnet\_cs pidof ping poweroff printf profile protocols ps pwd rc.0 rc.S
 
927
rc.custom rc.custom.gz rc.pcmcia reboot rescuept reset resolv.conf rm rmdir
 
928
rmmod route rsh rshd script sed serial serial\_cs services setserial
 
929
settings.s sh shared slattach sleep sln sort split stab strings swapoff swapon
 
930
sync tail tar tcic tee telnet telnetd termcap test tomshexd tomsrtbt.FAQ touch
 
931
traceroute true tune2fs umount undeb\verb:--: unpack.s unrpm\verb:--: update utmp vi vi.help
 
932
view watch wc wget which xargs xirc2ps\_cs yecho yes zcat 
 
933
 
 
934
In addition, at 
 
935
\elink{Tom's Web Site}{http://www.toms.net/rb}, you can find a lot of
 
936
additional kernel drivers and other software (such as {\bf sdisk}, which is
 
937
used by Bacula. 
 
938
 
 
939
Building his floppy is a piece of cake. Simply download his .tar.gz file then:
 
940
 
 
941
 
 
942
\footnotesize
 
943
\begin{verbatim}
 
944
- detar the .tar.gz archive
 
945
- become root
 
946
- cd to the tomsrtbt-<version> directory
 
947
- load a blank floppy with no bad sectors
 
948
- ./install.s
 
949
\end{verbatim}
 
950
\normalsize