<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

   
         <link rel="STYLESHEET" href="linux%20boot%20CD_files/trstyle.css" media="screen" type="text/css"></head>





   <body bgcolor="#ffffff" link="#0000cc" vlink="#800080" topmargin="0" marginheight="0"><img src="linux%20boot%20CD_files/c.gif" border="0" height="1" width="1" alt="">
            

         

            <a href="http://www.techrepublic.com/index.jhtml"><img src="linux%20boot%20CD_files/tr_logo.gif" border="0" width="240" height="63" alt="TechRepublic"></a><br>
            
            







      <iframe src="linux%20boot%20CD_files/mac-ad.html" width="728" height="100" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" bordercolor="#000000">
         &lt;script&gt;
         &lt;/script&gt;
      </iframe>

   
<br>

            
            












   
      
            <p>
               <font class="contentTextBigBold">
                  Create a Linux boot CD to recover a failed server
               </font>
               <br><br>
            </p>

            
            <font class="contentText">
               
               Oct 31, 2002
            
               <br>
               Scott Lowe MCSE
            </font>
            <br>
            <div align="center">
            
               

                     
                     

                  
            </div><br>
            
            
                  <font class="contentText">
                     <br>There
are three constants in life: death, taxes, and system crashes. All three
may be inevitable, but at least you can recover from a system crash. While
it can be a painful situation, if you have the right tools, recovery can
be much easier.<br><br>Although Linux is usually known for its rock solid
stability, a Linux server may still sometimes crash and/or become unbootable,
often due to hardware issues. On these occasions, one of the best tools to
have at your disposal is a bootable Linux CD.<br></font><hr size="1" width="100%"><font class="contentText"><font class="articleTipTitle">Linux distribution</font><br><font class="articleTipText">For the purpose of this article, I performed the steps listed below on a minimal Red Hat Linux 8.0 installation.</font></font><hr size="1" width="100%"><font class="contentText"><br><span class="subhead1">Take note at installation</span><br>At
the end of the typical Red Hat Linux installation session, you're asked whether
you want to create a boot disk. If you are serious about system recovery
in the event of a failure, don&#8217;t skip this step. This disk will be your first
step in recovery should disaster strike. If you chose not to do this, you
can do it later using the <i>mkbootdisk</i> utility from the command line.<br><br><span class="subhead1">The many tools of Linux</span><br>One
of the great things about Linux and open source software in general is that
there is a plethora of tools out there just waiting to be discovered. The
chances are good that you will find a utility that almost perfectly suits
your needs if you look hard enough. The same philosophy holds true for tools
that aid in the recovery of a crashed system. Putting together a CD with
all of the appropriate files and utilities would take a long time if you
had to figure out exactly what to put on it. Fortunately, some folks in Belgium
have made this entire process simple and straightforward by putting together
a utility called <a href="http://mkcdrec.ota.be/">mkCDrec</a>.<br><br><span class="subhead1">What is mkCDrec?</span><br>MkCDrec
(Make CD-ROM Recovery) is a utility that creates a bootable disaster recovery
CD for Linux. It supports a number of file systems, RAID, and optional utilities
that can be useful in the event of a failure. Among these utilities are partition
management tools, RAM test tools, and data salvage tools. In addition, mkCDrec
supports the most recently released versions of popular Linux distributions,
such as Red Hat 8 and Mandrake 9<br><br><span class="subhead1">Getting started</span><br>The
first step in creating your recovery CD is to download mkCDrec. At the time
of this writing, the current version is 0.6.7 and is available for download
<a href="http://mkcdrec.ota.be/project/download.html">here</a>. I have saved the file <i>mkCDrec_v0.6.7.tar.gz</i> in my home directory of <i>/home/slow</i>e
on my Red Hat Linux 8.0 server. In addition, you can download the optional
mkCDrec utility package, which contains a number of useful utilities that
can be burned onto the recovery CD. The utilities package is currently also
at version 0.6.7. For the remainder of the installation, you will need to
have root user privileges. Here are the steps:<br></font><ol><li><font class="contentText">cd /home/slowe [Switch to the directory where you stored the download.]</font></li><li><font class="contentText">tar zxvf mkCDrec_v0.6.7.tar.gz [Expand the distribution.]</font></li><li><font class="contentText">cd mkcdrec [Switch to the directory created during the expansion.]</font></li><li><font class="contentText">tar zxvf /home/slowe/mkCDrec_v0.6.7_utils.tar.gz [Expand the utilities.]</font></li><li><font class="contentText">make test [This is a script that checks your system to make sure that all of the utilities required by mkCDrec are available; <a target="_target" href="http://www.techrepublic.com/utils/sidebar.jhtml?id=r00220021031low01.htm&amp;index=1">click here</a> to see an example of the output of this command]</font></li></ol><!--sidebar1<table width="100%" border="0" cellpadding="0"><tr><td class="subhead1">Listing A</td></tr><tr bgcolor="#ff0000"><td height="1"><img src="/images/spacer.gif" width="1" height="1" /></td></tr><tr><td height="5"><img src="/images/spacer.gif" width="1" height="5" /></td></tr><tr><td><pre>make test output of mkCDrec v0.6.7</pre><pre>Test 1:&#160; Are we root?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 2:&#160; missing executables needed by mkCDrec&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>nasm:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Not found</pre><pre>nasm: cannot compile syslinux (use ours)</pre><pre>Test 3:&#160; Filesystem for Initial ramdisk allowed?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 4:&#160; loopback device works?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 5:&#160; ram device available&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 6:&#160; romfs supported&#160; by the kernel?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; N/A</pre><pre>Test 7:&#160; cramfs supported&#160; by the kernel?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; N/A</pre><pre>Test 8:&#160; strip (from binutils) available?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 9:&#160; BOOT_FLOPPY_DENSITY=ED ok?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 10: cdrecord -scanbus&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; FAILED</pre><pre>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Warning: Edit Config.sh and change BURNCDR to "n"</pre><pre>Test 11: Header files present?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 12: DEVFS supported by kernel?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; N/A</pre><pre>Test 13: filesystem tools present?</pre><pre>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ext2:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Passed</pre><pre>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ext3:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 14: initrd must be compiled in kernel!&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 15: Amount of memory available&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 261 Mb</pre><pre>Test 16: scripts/Config.sh a link?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre><pre>Test 17: serial console Passed&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Passed</pre></td></tr></table>sidebarend--><font class="contentText"><br>As you can see from the output, some problems on my server need to be resolved before I can continue. The <i>nasm</i>
error refers to a utility that allows you to work with assembly code on Linux.
I was unable to find this package on my Red Hat Linux 8 CD set, so I downloaded
it <a href="http://dc.qut.edu.au/rpm2html/local/nasm-0.98-8.i386.html">here</a> and installed it with the following command on my Linux server:<br><span class="code">rpm --install nasm-0.98-8.i386.rpm</span><br><br>A
working kernel is required since the recovery CD needs to be able to boot
into an OS that can actually work with your Linux system. The mkCDrec program
comes with a 2.4.18 kernel that it will use to create the recovery CD.<br><br>The
other error indicates that a utility to burn a CD is not present. Since I
do not have a burner on my Linux server, this makes sense. I will be burning
this CD on my Windows machine, so I can take the advice of the installer
and change the configuration to ignore the fact that I do not have a burner.
I can accomplish this by editing the <i>Config.sh</i> file with the command <i>pico Config.sh</i> and then changing the line BURNCDR=y to BURNCDR=n.<br><br>After installing <i>nasm</i> and fixing the configuration file to tell it to ignore the burner, I can run <i>make test</i>
again to see whether there are any more errors. In this example, I do not
have any more errors, so I can continue the installation.<br><br>The next step in the installation is mostly menu driven; the menu is shown in <b><a target="_target" href="http://www.techrepublic.com/utils/sidebar.jhtml?id=r00220021031low01.htm&amp;index=2">Listing B</a></b>.<br><!--sidebar2<table width="100%" border="0" cellpadding="0"><tr><td class="subhead1">Listing B</td></tr><tr bgcolor="#ff0000"><td height="1"><img src="/images/spacer.gif" width="1" height="1" /></td></tr><tr><td height="5"><img src="/images/spacer.gif" width="1" height="5" /></td></tr><tr><td><span class="code">Make CD-ROM recovery (mkCDrec v0.6.7) by Gratien D'haese</span><br /><span class="code">&#160;</span><br /><span class="code">&#160;</span><br /><span class="code">mkCDrec v0.6.7 - Backing up your partitions</span><br /><span class="code">Enter your selection:</span><br /><span class="code">&#160;</span><br /><span class="code">&#160;1) Rescue CD-ROM only (no backups)</span><br /><span class="code">&#160;2) Into /tmp/backup (to burn on CDROM)</span><br /><span class="code">&#160;3) Enter another path (spare disk or NFS)</span><br /><span class="code">&#160;4) Enter (remote) tape device</span><br /><span class="code">&#160;5) Quit</span><br /><span class="code">&#160;</span><br /><pre>Please choose from the above list [1-5]:</pre></td></tr></table>sidebarend--><br>Here is a summary of the menu options:<br></font><ul><li><font class="contentText">Option 1 creates a bootable CD with rescue utilities only. No data from the system is stored on the CD.</font></li><li><font class="contentText">Option
2 creates a bootable CD with rescue utilities as well as backup information
from the system. These can be dangerous to leave lying around, as these CDs
will provide unrestricted access to the data stored on them. This option
will create one or more ISO images, depending on the size of the files. They
are stored in <i>/tmp/backup</i>.</font></li><li><font class="contentText">Option 3 is the same as option 2 except that the ISO images are stored somewhere else instead of <i>/tmp/backup</i>.</font></li><li><font class="contentText">Option 4 uses a tape for the backup instead of the CD. The rescue CD is still created.</font></li></ul><font class="contentText"><br>For
this example, I am going to choose option 1 so that I can copy the generated
ISO file to my Windows machine to be burned onto a CD. If I wanted to back
up my system files and configuration files to CD, I could choose option 2
or 3, but for simplicity and time, option 1 is fine. This will give me with
a CD that I can boot and attempt to recover a crashed system but will not
provide me with any backups of important files from my current Linux server.<br><br>Once
I choose option 1, the mkCDrec script starts its work. This process takes
a while, because the utility needs to build the entire contents of the rescue
CD, including the boot loader, the kernel, and the rescue utilities. The
final few lines of the process will tell you where everything is stored,
as shown in <b><a target="_target" href="http://www.techrepublic.com/utils/sidebar.jhtml?id=r00220021031low01.htm&amp;index=3">Listing C</a></b>.<br><!--sidebar3<table width="100%" border="0" cellpadding="0"><tr><td class="subhead1">Listing C</td></tr><tr bgcolor="#ff0000"><td height="1"><img src="/images/spacer.gif" width="1" height="1" /></td></tr><tr><td height="5"><img src="/images/spacer.gif" width="1" height="5" /></td></tr><tr><td><pre>Calculating and implanting md5sum into CDrec.iso</pre><pre>Read&#160;&#160;&#160;&#160; 0 MB</pre><pre>Inserting md5sum into iso image...</pre><pre>md5 = 71b9b3ec269bd9a879193e1e8cf72f79</pre><pre>Done!</pre><pre>The CDrec image(s) are stored in directory /tmp</pre><pre>-rw-r--r--&#160;&#160;&#160; 1 root&#160;&#160;&#160;&#160; root&#160;&#160;&#160;&#160; 10977280 Oct 19 20:57 /tmp/CDrec.iso</pre><pre>-------------&lt; Leaving makeISO9660.sh &gt;--------------</pre><pre>-------------&lt; Leaving tar-it.sh &gt;-------------</pre><pre>Done.</pre></td></tr></table>sidebarend-->
                  </font>
               
                  <font class="contentText">
                     <br><span class="subhead1">Burning the CD</span><br>If
you are new to Linux or have not delved deeply into the operating system
to understand how it works, what is happening can be a little confusing.
You just created a CD image file that contains a bootable Linux kernel, as
well as a whole host of utilities that are extremely useful in the event
of a system failure. But to be useful, this image needs to be burned to a
CD on a system with a CD burner.<br><br>In my case, I just copied the ISO
image file to a Windows machine where I have both Roxio Easy CD Creator and
Ahead Nero CD burning software packages. Using either package, I can burn
the ISO image to a CD.<br><br>At this point, I have a bootable CD that I
need to test. It&#8217;s critical to test the CD you create to make sure that it
actually works. Nothing would be worse than skipping this step only to find
out that it won&#8217;t boot when you need it in an emergency.<br><br>Start by
making sure that the BIOS on your Linux server is properly configured to
support booting from CD. After you verify that, you're ready to test the
new recovery CD. Pop in the CD and restart the machine. (It is best to test
this on a lab machine.) Once the disk loads, you will be presented with a
special boot loader used by mkCDrec (<b>Figure A</b>) as well as some helpful instructions on how to proceed.<br></font><div align="center"><font class="contentText"><br><table><tbody><tr><td class="fighead">Figure A</td></tr><tr><td align="center"><img src="linux%20boot%20CD_files/r00220021031low01_B.gif" width="543" height="416"></td></tr><tr><td class="caption">mkCDrec boot loader</td></tr></tbody></table></font></div><font class="contentText"><br><br>When
the system finishes loading from the CD, you need to be aware of a couple
of things. First, you have a bare-bones Linux system running from a RAM disk.
Second, you have the mkCDrec boot CD already mounted as <i>/cdrom</i>.<br><br>You
also have the ability to mount any devices on your Linux server, assuming
mkCDrec supports them. If you don&#8217;t know the device names and file systems
of your Linux server, you can get this information by using the <i>cfdisk</i> (configure disk) command. This will display a list of devices on your system, as shown in <b>Figure B</b>.<br></font><div align="center"><font class="contentText"><br><table><tbody><tr><td class="fighead">Figure B</td></tr><tr><td align="center"><img src="linux%20boot%20CD_files/r00220021031low01_D.gif" width="543" height="363"></td></tr><tr><td class="caption">The cfdisk utility</td></tr></tbody></table></font></div><font class="contentText"><br><br>To mount the / (root) partition on my Linux server, I use the following command:<br><span class="code">mount -t ext2 /dev/sda2 /mnt/local</span><br><br>The mount point <i>/mnt/local</i> now points to the root of my Linux server, and I can browse around the file system if I need to simply by changing to the <i>/mnt/local</i>
directory. The ability to mount the file system is critical in the event
that the boot loader becomes corrupt on your server and you need to fix it
or offload data to a different server.<br><br><span class="subhead1">What else can be done?</span><br>Once
booted with mkCDrec CD, you can do a variety of things. Most notably, if
you selected the option to create a backup of your system rather than simply
creating a rescue CD, you can execute <i>/etc/recovery/start-restore.sh</i>,
which will prompt you for the complete process in restoring your system to
the state it was in when you created the CD set. Note that if you try to
execute this script without having first created a backup (i.e., you created
only a rescue CD), you will be told that this is the case and that there
is no data to restore.<br><br>The <i>/etc/recovery</i> directory contains many other utilities that can help restore or fix a corrupt system. The mkCDrec Web site has <a href="http://mkcdrec.ota.be/project/etc_recovery.html">details</a> on these utilities.<br><br>If you chose to download the mkCDrec utilities and properly installed them, they'll be available at <i>/cdrom/utilities</i> and include some real lifesavers, such as <i>parted</i> (a partition editor), <i>memtest</i> (a memory testing utility), and <i>e2salvage</i> (a utility to salvage data from a damaged ext2 partition). For more details on these additional utilities, look at the <a href="http://mkcdrec.ota.be/project/utilities.html">mkCDrec Web site</a>.<br><br><span class="subhead1">Summary</span><br>Unfortunately,
system crashes are a part of life. But having the right tools to recover
from them can make all the difference. One of the things that I like about
mkCDrec is that you can create the CD even after a crash (on a different
system, of course) and have the full range of recovery utilities available
in one place. And with its ability to back up your entire system onto CD(s),
mkCDrec can be an invaluable a part of every Linux administrator&#8217;s disaster
recovery toolkit.<br>
                  </font>
               
            
         
      
   

<p>
   <font class="contentText">
      <center>
      
         





          




      
            <a class="contentLink" href="http://www.techrepublic.com/legal/copyright_info.jhtml">Copyright</a>
         
      <font class="contentText">
         ©1995-



2002 CNET Networks, Inc.
         All Rights Reserved.
      </font>
   

 
         <br>
         Visit us at 
         
         
               <a href="http://www.techrepublic.com/">www.TechRepublic.com</a>
            
         
      </center>
   </font>
</p>

<br><br>


         </body></html>