old-www/LDP/LG/issue39/bennet.html

163 lines
9.2 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>Boot Disk Failure and Recovery LG #39</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Boot Disk Failure and Recovery</font></H1>
<H4>By <a href="mailto:chguy@chguy.net">Bill Bennet</a></H4>
</center>
<P> <HR> <P>
So you think it can't happen to you? Well, this is the scene:
<ol>
<li> First, get bored while waiting around for something.
<li> Even worse, read a Y2K warning that says you can change your system
time manually to avoid trouble.
<li> Next, decide to go into the system setup and look at your CMOS settings
to see what you can see.
<li> Then make a terrible decision; like "Hey, the system time is off by a
few minutes. I will correct the time."
<li> Then do a dumb thing, like change the system time in the CMOS settings.
<li> Reboot and get this message:"BOOT DISK FAILURE. Please insert a system
disk and reboot."
</ol>
<P>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What did I do? I
recovered the system with linux, thats what I did. The system here is set up
to dual boot with Windows95 and three different Linux distributions via
<a href="#lilo">LILO</a>,
the Linux boot loader.
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Since the Master Boot
Record on sector 0 is booting DOS and Linux, I thought it was <a href="#scared">
prudent </a>to use
the DOS version of fdisk to try to recover the partition table. Ha! "What a
lack of features you have, Grandma."said little Red LinuxHat.
<h2><font color=blue>Sys a:</font></h2>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The job I tried to do
was to boot with my Windows95 rescue disk, which you make before this ever
happens. You do have one, don't you? For a simple boot diskette, pop a floppy
in the "A:" drive and type "sys a:".
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Once the diskette
boots, you try to cd to "C:" drive. Ha! It is not there. It is gone. The first
thing to try is fdisk (DOS), to see what it can do. The upshot is that it don't
do much. All that fdisk (DOS) said to me was that the hard disk was empty,
with no partitions. Yikes, what a mess. The other hard disk, which has two DOS
partitions, was fine. BUT, the Master Boot Record was gone. I used the command
fdisk /MBR and nothing happened, nothing changed. According to
<a href="#fdisk">fdisk</a> (DOS), there was no partition table, no partition
and you are out of luck. I suppose this lack of features is designed to have
me running to a data recovery specialist to get "saved" for a fair exchange
of dollars.
<h2><font color=blue>Enter Linux</font></h2>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Now that you have
proved that the other system is lacking some power, it is time to boot linux.
I grabbed a boot disk, which you make before this ever happens. You do have
one, don't you? In RedHat you simply put a blank diskette in the floppy drive
and type mkbootdisk. Man oh man, I love linux! No clickety-clicks, no waiting,
just service and super powers. I guess it helps when your software is written
by the best and brightest minds in a free thought environment.
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The RedHat boot image
for installation is also a rescue diskette. Tell it you are doing the "expert"
mode (I am not but you may be one) and press "Enter". Tell it if you have a
colour terminal and configure the keyboard. Now put in the supp.img diskette
and press "Enter". You get a "# _" prompt. Type this:<pre>
mknod /dev/hda b 3 0</pre>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Now you have a new
device called /dev/hda. It is your original old hard disk drive.
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
The next thing is to mount your old root partition and run lilo. So cd to /
and make a new directory to mount the thing: mkdir any_name_will_do.
Type this:<pre>
mount /dev/hd_your_root_partition_here /any_name_will_do</pre>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Then cd to /any_name_will_do/sbin and run lilo. Type this:<pre>
./lilo -C /any_name_will_do/etc/lilo.conf</pre>
<h2><font color=blue>Super Powers</font></h2>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The fdisk
(GNU/Linux) is able to make your partitions and set the file type for them.
Also, it can verify the partition table. So, in my time of need this is what
I did. I typed "v" for verify.
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The program reported
to me that the partition table had been altered! No kidding. Then I typed "w"
to write the table to the disk and quit fdisk.
<h2><font color=blue>Reboot and hope</font></h2>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The system rebooted
perfectly as usual. Linux wins again.
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<h2><font color=blue><a name=lilo>Leeloo</a>'s name was a peek at the future</font></h2>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Yeah, I watched the
Fifth Element several times. The LILO boot loader can easily re-write the
Master Boot Record just by running it once on its /etc/lilo.conf file. Type
/sbin/lilo and the job is done. You may now boot from the hard disk drive.
<h2><font color=blue>There can be only <a name="fdisk">One</a></font></h2>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
The DOS fdisk can alter your view of the world. When
you have only one hard disk drive it will let you make one and only one
primary partition. If you have a second HDD it will let you make the four
primary partitions allowed by the PC's designers or three primary and one
extended.
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
When you have only one primary partition then you can't be trying to boot
more than one type of Operating System. Normally, that is. Linux can boot from
a logical drive on an extended partition with loadlin.exe.
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
I guess it must be too hard to compete on the merits of the product, so the
DOS Borg must use this type of anti-competitive approach in order to maintain
market share. Just imagine one primary partition covering 100% of the disk.
"Yeah, that will keep them from even <i>trying </i>to get a real OS".
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Frighten them with dire
warnings, too. Tell them their system has performed illegal operations and
general protection faults.
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;In my mind, Microsoft
is the illegal operation and the DOJ is guilty of general protection faults
from not protecting the public in general.
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<hr>
<h2><a name=scared><font color=blue>Scared of the Beast</font></a></h2>
<p>With good reason, too. DOS always writes over the Master Boot Record when you
install it. The beast has the arrogance to exclude all other possible operating
systems when it is time to install. This is not an oversight, it is not a test.
You are caught square in the middle of the cut-throat world of big business.
Get used to it gentle linuxian, your system has been discovered by the rest of
the world. They say "Defend your turf or die". I say "remember the Apple" and
let us not have it happen again that an excellent system gets shoved aside and
marginalized as a specialty item. Linux can do EVERYTHING. Lets bring it on!
<hr><h2><a name=xfree><font color=blue>Reference reading:</font></a></h2>
<P>Clock mini-HOWTO -- required reading for real-time Linuxians
<P>Large Disk mini-HOWTO -- excellent Master Boot Record discussion
<P>Linux+DOS+Win95 mini-HOWTO -- here's a good /etc/lilo.conf example
<P>Partition mini-HOWTO -- required reading for all linuxians
<hr><br><P>
<center><font color=blue><strong>made with mcedit on an i486 with GNU/Linux 2.0.35</strong></font><P><font color=blue><strong>The adamant position of the author is in no way meant as an affront to sincere readers.</strong></font></center>
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1999, Bill Bennet <BR>
Published in Issue 39 of <i>Linux Gazette</i>, March 1999</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./lg_tips39.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./bullington.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->