LDP/LDP/howto/linuxdoc/LILO-crash-rescue-HOWTO.sgml

433 lines
14 KiB
Plaintext

<!doctype linuxdoc system>
<!--
************************** begin comment *****************************
The following is the HOW-TO for recovering from linux crash, if
linux fails to boot, LILO is destroyed and to rescue the system.
This document is in the SGML format. You must use sgml package to
process this document
************************* end of comment *****************************
-->
<!--
************************** SGML USER GUIDE *****************************
The SGML user guide on linux is located at /usr/doc/sgml-tools
Read the example.sgml and guide.html documents.
Usage:
HTML sgml2html foo (Do not give extension .sgml here!!)
Text sgml2txt foo.sgml
Latex sgml2latex foo.sgml
(note: put extra dash - before language below, removed to compile)
Postscript sgml2latex -language=english -o ps foo.sgml
DVI sgml2latex -d foo.sgml
Lyx sgml2lyx foo.sgml
Richtext sgml2rtf foo.sgml
gnuinfo sgml2info foo.sgml
man sgml2txt -man foo.sgml
SGML sgmlcheck foo.sgml
************************* end of comment *****************************
-->
<article>
<!-- Title information -->
<title>LILO, Linux Crash Rescue HOW-TO
<!-- chapt change
LILO, Linux Crash Rescue HOW-TO
-->
<author>Al Dev (Alavoor Vasudevan)
<htmlurl url="mailto:alavoor@yahoo.com"
name="alavoor@yahoo.com">
<date>v4.0, 12 Nov 2000
<abstract>
This document discusses methods to recover from Linux system failures.
Various reasons for linux system failures can be -
LILO is destroyed, or linux fails to boot, or Master Boot Record (MBR)
is damaged or linux fails to boot when another
operating system like Windows NT is installed which erases LILO or MBR.
</abstract>
<!-- Table of contents -->
<toc>
<!-- Begin the document -->
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt>Introduction
-->
<sect>Introduction
<p>
You cannot avoid accidents and if it happens to linux systems then it
may damage the
master boot record (MBR) or LILO (Linux boot Loader).
There may be cases where linux will not boot due to hard disk
failures. The LILO may also fail if you accidentally re-partition the
hard disk or you install another additional operating system like
Windows 98/NT on the linux computer.
This document gives you some ideas, tips and quick guide to recover
fast without wading through hundreds of pages of documentation on
LILO or Linux.
<!--
*******************************************
************ End of Section ***************
*******************************************
-->
<sect1> Quick Steps to recovery
<p>
Follow these steps to recover from LILO or system failures.
<enum>
<item> <bf>SCENE 1:</bf> If your system does not boot -
<p>
Get the tomsrtbt floppy <url url="http://www.toms.net/rb">
Boot with tomsrtbt floppy
Use fdisk /dev/hda to find the partitions
Edit /etc/fstab and put (sample code given here) -
<code>
/dev/hda4 /a4 ext2 defaults 1 1
/dev/hda1 /a1 vfat defaults 1 1
On my computer hda4 contains the linux boot/root partition and
hda1 has windows 95 vfat system.
bash# mkdir /a4 /a1
bash# mount /a4
bash# mount /a1
and repair the system
</code>
<p>
<item> <bf>SCENE 2:</bf> If LILO is not working..
<p>
Follow scene 1 above, if that fails then
<code>
bash# mkdir /a4 /a1
bash# mount /a4
bash# mount /a1
bash# chroot /a4 /sbin/lilo -q
bash# man chroot
bash# chroot /a4 /sbin/lilo
</code>
Alternatively, you can directly use /sbin/lilo instead of chroot. The
-r option of lilo actually does chroot.
<code>
bash# man lilo
bash# /sbin/lilo -r /a4
</code>
<p>
<item> <bf>SCENE 3:</bf> If LILO is not working..
<p>
If scene 1 and 2 failes, then
if you made the boot disk with 'mkbootdisk' (during install or
by using 'man mkbootdisk'), boot with it and repair your partitions.
The mkbootdisk is in mkbootdisk*.rpm package, you must install this.
<p>
<item> <bf>SCENE 4:</bf> If 1, 2 and 3 above fails and you do not have boot disk
<p>
If you have another computer running linux, then
login as root and do -
<code>
bash$ man mkbootdisk
bash# cp /etc/lilo.conf /etc/lilo-original.conf
</code>
Edit the /etc/lilo.conf and put the root partition name as you
obtained in 'scene 1' above and insert a blank floppy and give -
<code>
bash# mkbootdisk /dev/fd0
</code>
The mkbootdisk is in mkbootdisk*.rpm package, you must install this.
Make sure you move the /etc/lilo-original.conf back to /etc/lilo.conf!! And
then take this floppy and goto scene 3
<p>
<item> <bf>SCENE 5: </bf>If scenes 1, 2, 3 and 4 above fails then
<p>
<it><bf>Step 1: </bf></it>
Boot tomsrtbt and mount the partitions and backup the root
partition to another partition having disk space with comamnds -
<code>
Edit /etc/fstab and put (sample code given here) -
/dev/hdb1 /b1 vfat defaults 1 1
bash$ mkdir /b1; mount /b1
bash$ cd /
bash$ tar cvf /b1/root-a4.tar a4
</code>
<p>
<it><bf>Step 2: </bf></it>
Insert Linux cdrom, reboot and install the redhat linux
on /dev/hda4 (but DO NOT install any extra packages, you just
need to install only the root, boot systems and LILO manager that is, a very
bare minimum). This will also install the LILO on hard disk.
Boot linux now and login as root and do -
<code>
bash$ man mkbootdisk
bash# cp /etc/lilo.conf /etc/lilo-original.conf
</code>
Note: You MUST remember to copy back lilo-original.conf to lilo.conf!!
Edit the /etc/lilo.conf and put the root partition name as you
obtained in 'scene 1' above and insert a blank floppy and give -
<code>
bash# mkbootdisk /dev/fd0
bash# cp /etc/lilo-original.conf /etc/lilo.conf
</code>
Take this floppy to problem machine and
test this boot floppy to see that this works and then
restore back the all the files which you backedup using tar on
/b1/root-a4.tar as in step 1 above.
</enum>
<!--
*******************************************
************ End of Section ***************
*******************************************
-->
<sect1> Precautionary measures
<p>
You should take the following pre-cautionary measures to tackle the
problems in future.
<itemize>
<item> You MUST make emergency boot disk from time to time and whenever you
make changes to the partition. Insert a blank floppy and do this -
<code>
bash$ man mkbootdisk
The mkbootdisk is in mkbootdisk*.rpm package, you must install this.
bash$ mkbootdisk --help
bash$ mkbootdisk --device /dev/fd0 2.2.12-20
</code>
<p>
<item>
You must keep the tomsrtbt boot floppy handy. Visit
<url url="http://www.toms.net/rb">
<p>
<item>
You must keep the Yard rescue and boot floppy disk handy. Visit
<url url="http://www.croftj.net/~fawcett/yard">
<p>
<item> Backup /root and /boot directories. Boot the Tomsrtbt floppy and
then
<code>
bash# vi /etc/fstab
And put these lines -
/dev/hda1 /a1 vfat defaults 1 1
/dev/hdb1 /b1 vfat defaults 1 1
In my case hda1 had the linux root partition '/'
bash# cd /
bash# tar cvf /b1/linux-root-partition-hda1.tar a1
bash# tar cvf /b1/linux-boot-partition-hda1.tar a1/boot
</code>
</itemize>
<!--
*******************************************
************ End of Section ***************
*******************************************
-->
<sect1> Removing LILO
<p>
You can replace the boot sector with the DOS boot loader by issuing the DOS command:
<code>
FDISK /MBR
</code>
where MBR stands for "Master Boot Record".
See also LILO documentation on linux at /usr/doc/lilo* for other methods of
uninstalling the LILO. And see also 'man lilo'.
<!--
*******************************************
************ End of Section ***************
*******************************************
-->
<sect1> Common mistakes
<p>
After making changes to /etc/lilo.conf you MUST run lilo to make changes
to go in effect. It is a very common mistake committed by newusers. Type -
<code>
bash# lilo -v -v -v
</code>
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt change> Related URLs
-->
<sect> Related URLs
<p>
Visit following locators which are related to LILO, Rescue Linux, crash recovery -
<itemize>
<item> Mini Lilo HOWTO at <url url="http://www.linuxdoc.org/HOWTO/mini/LILO.html">
<item> Bootdisk-HOWTO at <url url="http://www.metalab.unc.edu/LDP/HOWTO/Bootdisk-HOWTO/index.html">
<p>
<item> Pre-made boot disks at <url url="http://www.linuxdoc.org/HOWTO/Bootdisk-HOWTO/a1277.html">
<item> Tomsrtbt boot floppy disk <url url="http://www.toms.net/rb">
<item> Yard rescue and boot floppy disk <url url="http://www.croftj.net/~fawcett/yard">
<p>
<item> BootPrompt-HOWTO at <url url="http://www.linuxdoc.org/HOWTO/BootPrompt-HOWTO.html">
<item> Multiboot with LILO mini HOWTO at <url url="http://www.linuxdoc.org/HOWTO/mini/Multiboot-with-LILO.html">
<item> Linux+WinNT mini HOWTO at <url url="http://www.linuxdoc.org/HOWTO/mini/Linux+WinNT.html">
<p>
<item> Linux goodies main site <url url="http://www.aldev.8m.com">
<item> Linux goodies mirror site <url url="http://aldev.webjump.com">
<item> Vim color text editor for C++, C <url url="http://metalab.unc.edu/LDP/HOWTO/Vim-HOWTO.html">
</itemize>
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt change> Other Formats of this Document
-->
<sect> Other Formats of this Document
<p>
This document is published in 11 different formats namely - DVI, Postscript,
Latex, Adobe Acrobat PDF,
LyX, GNU-info, HTML, RTF(Rich Text Format), Plain-text, Unix man pages and SGML.
<itemize>
<item>
You can get this HOWTO document as a single file tar ball in HTML, DVI,
Postscript or SGML formats from -
<url url="ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/other-formats/">
<item>Plain text format is in: <url url="ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO">
<item>Translations to other languages like French, German, Spanish,
Chinese, Japanese are in
<url url="ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO">
Any help from you to translate to other languages is welcome.
</itemize>
The document is written using a tool called "SGML-Tools" which can be got from -
<url url="http://www.sgmltools.org">
Compiling the source you will get the following commands like
<itemize>
<item>sgml2html LILO-crash-rescue-HOWTO.sgml (to generate html file)
<item>sgml2rtf LILO-crash-rescue-HOWTO.sgml (to generate RTF file)
<item>sgml2latex LILO-crash-rescue-HOWTO.sgml (to generate latex file)
</itemize>
LaTeX documents may be converted into PDF files simply by
producing a Postscript output using <bf>sgml2latex</bf> ( and dvips) and running the
output through the Acrobat <bf>distill</bf> (<url url="http://www.adobe.com">) command as follows:
<code>
bash$ man sgml2latex
bash$ sgml2latex filename.sgml
bash$ man dvips
bash$ dvips -o filename.ps filename.dvi
bash$ distill filename.ps
bash$ man ghostscript
bash$ man ps2pdf
bash$ ps2pdf input.ps output.pdf
bash$ acroread output.pdf &
</code>
Or you can use Ghostscript command <bf>ps2pdf</bf>.
ps2pdf is a work-alike for nearly all the functionality of
Adobe's Acrobat Distiller product: it
converts PostScript files to Portable Document Format (PDF) files.
<bf>ps2pdf</bf> is implemented as a very small command script (batch file) that invokes Ghostscript, selecting a special "output device"
called <bf>pdfwrite</bf>. In order to use ps2pdf, the pdfwrite device must be included in the makefile when Ghostscript was compiled;
see the documentation on building Ghostscript for details.
This howto document is located at -
<itemize>
<item> <url url="http://sunsite.unc.edu/LDP/HOWTO/LILO-crash-rescue-HOWTO.html">
</itemize>
Also you can find this document at the following mirrors sites -
<itemize>
<item> <url url="http://www.caldera.com/LDP/HOWTO/LILO-crash-rescue-HOWTO.html">
<item> <url url="http://www.WGS.com/LDP/HOWTO/LILO-crash-rescue-HOWTO.html">
<item> <url url="http://www.cc.gatech.edu/linux/LDP/HOWTO/LILO-crash-rescue-HOWTO.html">
<item> <url url="http://www.redhat.com/linux-info/ldp/HOWTO/LILO-crash-rescue-HOWTO.html">
<item> Other mirror sites near you (network-address-wise) can be found at
<url url="http://sunsite.unc.edu/LDP/hmirrors.html">
select a site and go to directory /LDP/HOWTO/LILO-crash-rescue-HOWTO.html
</itemize>
In order to view the document in dvi format, use the xdvi program. The xdvi
program is located in tetex-xdvi*.rpm package in Redhat Linux which can be
located through ControlPanel | Applications | Publishing | TeX menu buttons.
To read dvi document give the command -
<tscreen><verb>
xdvi -geometry 80x90 howto.dvi
man xdvi
</verb></tscreen>
And resize the window with mouse.
To navigate use Arrow keys, Page Up, Page Down keys, also
you can use 'f', 'd', 'u', 'c', 'l', 'r', 'p', 'n' letter
keys to move up, down, center, next page, previous page etc.
To turn off expert menu press 'x'.
You can read postscript file using the program 'gv' (ghostview) or
'ghostscript'.
The ghostscript program is in ghostscript*.rpm package and gv
program is in gv*.rpm package in Redhat Linux
which can be located through ControlPanel | Applications | Graphics menu
buttons. The gv program is much more user friendly than ghostscript.
Also ghostscript and gv are available on other platforms like OS/2,
Windows 95 and NT, you view this document even on those platforms.
<itemize>
<item>Get ghostscript for Windows 95, OS/2, and for all OSes from <url url="http://www.cs.wisc.edu/~ghost">
</itemize>
To read postscript document give the command -
<tscreen><verb>
gv howto.ps
ghostscript howto.ps
</verb></tscreen>
You can read HTML format document using Netscape Navigator, Microsoft Internet
explorer, Redhat Baron Web browser or any of the 10 other web browsers.
You can read the latex, LyX output using LyX a X-Windows front end to latex.
<!--
*******************************************
************ End of Section ***************
*******************************************
<chapt> Copyright
-->
<sect> Copyright
<p>
Copyright policy is GNU/GPL as per LDP (Linux Documentation project).
LDP is a GNU/GPL project.
Additional requests are that you retain the author's name, email address
and this copyright notice on all the copies. If you make any changes
or additions to this document then you please
intimate all the authors of this document.
Brand names mentioned in this document are property of their respective
owners.
<!--
*******************************************
************ End of Section ***************
*******************************************
-->
</article>