LDP/LDP/howto/docbook/LILO-crash-rescue-HOWTO.xml

1419 lines
50 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY version "0.01">
]>
<article id="LILO-crash-rescue-HOWTO">
<articleinfo>
<title>
LILO, Linux Crash Rescue HOW-TO
</title>
<author>
<firstname>
Al Dev (Alavoor Vasudevan)
</firstname>
<authorblurb>
<para>
<ulink url="mailto:alavoor[AT]yahoo.com">
alavoor[AT]yahoo.com
</ulink>
</para>
</authorblurb>
<affiliation>
<address format="linespecific">
<email>
alavoor[AT]yahoo.com
</email>
</address>
</affiliation>
</author>
<pubdate>
v10.9, 03 May 2003
</pubdate>
<abstract>
<para>
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.
</para>
</abstract>
</articleinfo>
<sect1 id="introduction">
<title>
Introduction
</title>
<para>
<emphasis remap="bf">
(The latest version of this document is at
<ulink url="http://www.milkywaygalaxy.freeservers.com">
"http://www.milkywaygalaxy.freeservers.com"
</ulink>
. You may want to check there for changes).
</emphasis>
</para>
<para>
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.
</para>
<para>
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.
</para>
<sect2 id="tiny">
<title>
Tiny Floppy Linux
</title>
<para>
To recover any Windows 95/NT/2000, OS/2, BeOS or Linux box you may
need the tiny linux which fits on a single floppy disk. See the list
of tiny floppy linux given below -
<itemizedlist>
<listitem>
<para>
The best
<ulink url="http://www.toms.net/~toehser/rb">
Tomsrtbt
</ulink>
</para>
</listitem>
<listitem>
<para>
Second best floppy linux
<ulink url="http://sunsite.dk/mulinux">
MuLinux
</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.trinux.org">
Trinux
</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.wu-wien.ac.at/usr/h93/h9301726/dlx.html">
DLX
</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.zelow.no/floppyfw">
FloppyFW
</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.psychosis.com/linux-router">
Linux Router Proejct floppy
</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.txdirect.net/users/mdfranz/tinux.html">
Tiny Linux distributions
</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://tiny.seul.org/en">
TINYLinux
</ulink>
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
<sect2 id="tinycdrom">
<title>
Tiny Pocket CDROM Linux
</title>
<para>
<itemizedlist>
<listitem>
<para>
Linuxcare Bootable Toolbox
<ulink url="http://lbt.linuxcare.com">
"http://lbt.linuxcare.com"
</ulink>
</para>
</listitem>
<listitem>
<para>
LNX-BBC
<ulink url="http://lnxbbc.org">
"http://lnxbbc.org"
</ulink>
</para>
</listitem>
<listitem>
<para>
Tom's Root and Boot "the most GNU/Linux on one floppy disk"
<ulink url="http://www.toms.net/rb">
"http://www.toms.net/rb"
</ulink>
</para>
</listitem>
<listitem>
<para>
"Innominate-Linux-Rescue-System" - a CD-based rescue system
<ulink url="http://innominate.org/projects/rescueCD">
"http://innominate.org/projects/rescueCD"
</ulink>
</para>
</listitem>
<listitem>
<para>
Irish Linux Users Group (ILUG) BBC: A bootable CD ISO
<ulink url="ftp://ftp.blackstar.co.uk/pub/ILUG/">
"ftp://ftp.blackstar.co.uk/pub/ILUG/"
</ulink>
</para>
</listitem>
<listitem>
<para>
Lubbock: Meant to be the "Tom's Root Boot" of CDs
<ulink url="http://lubbock.sourceforge.net">
"http://lubbock.sourceforge.net"
</ulink>
</para>
</listitem>
<listitem>
<para>
Repairlix: a networked Linux distribution/bootable system
intended to fit in 12MB of media.
<ulink url="http://repairlix.sourceforge.net">
"http://repairlix.sourceforge.net"
</ulink>
</para>
</listitem>
<listitem>
<para>
SuperRescue: a Red Hat-based bootable CD
<ulink url="http://www.kernel.org/pub/dist/superrescue">
"http://www.kernel.org/pub/dist/superrescue"
</ulink>
</para>
</listitem>
<listitem>
<para>
Timo's Rescue CD Set: an easy way of generating el Torito Boot
Cd's
<ulink url="http://rescuecd.sourceforge.net">
"http://rescuecd.sourceforge.net"
</ulink>
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
</sect1>
<sect1 id="crash">
<title>
Crash Recovery
</title>
<sect2 id="tips">
<title>
Preparation Tips
</title>
<para>
It is a good idea to backup the important system files like
/etc/fstab, /etc/lilo.conf after you login using Tomsrtbt floppy or
RedHat Linux CDROM (Rescue option) in following sections. This can be
very handy during crash situation or something happens to system
files.
<programlisting format="linespecific">
bash# cp /etc/fstab /etc/fstab.orig
bash# cp /etc/lilo.conf /etc/lilo.conf.orig
bash# cp /etc/hosts /etc/hosts.orig
bash# cp /etc/hosts.allow /etc/hosts.allow.orig
bash# cp /etc/hosts.deny /etc/hosts.deny.orig
bash# cp /etc/inetd.conf /etc/inetd.conf.orig
bash# cp /etc/inittab /etc/inittab.orig
bash# cp /etc/networks /etc/networks.orig</programlisting>
</para>
</sect2>
<sect2 id="using_linux_cdrom">
<title>
Using Linux CDROM In Rescue Mode
</title>
<para>
Most of the distributions like RedHat, SUSE, Debian provide CDROM
which have "Rescue" option. For this, you have should set the BIOS of
your computer to boot first from IDE CDROM drive. Usually you set the
BIOS (using F8 key during boot) to boot first from CDROM drive, second
from Floppy drive and third from hard disk. Load the Linux cdrom into
the CD drive and reboot the system. The Linux distribution will load
and at the prompt select "Rescue Operation". In the resuce operation
mount the hard disks and try to repair.
<programlisting format="linespecific">
# chroot /mnt/SYSIMAGE
# df </programlisting>
After doing chroot, the system will look as if you had booted the
system from hard disk. You can see all the partitions and you can
repair or recover the files.
</para>
</sect2>
<sect2 id="quick_steps">
<title>
Quick Steps to recovery
</title>
<para>
Follow these steps to recover from LILO or system failures.
</para>
<para>
<orderedlist inheritnum="ignore" continuation="restarts">
<listitem>
<para>
<emphasis remap="bf">
SCENE 1:
</emphasis>
If your system does not boot -
</para>
<para>
Get the tomsrtbt floppy
<ulink url="http://www.toms.net/rb">
"http://www.toms.net/rb"
</ulink>
or MuLinux floppy (see also
<xref linkend="tiny"/>
). Boot with tomsrtbt floppy Use fdisk to find the partitions.
Try to recognise the root and boot partition. Watch out, you may
be having the /boot files on the root partition itself.
</para>
<para>
The Linux's root partition has the following directories
<emphasis remap="bf">
bin
</emphasis>
,
<emphasis remap="bf">
boot
</emphasis>
,
<emphasis remap="bf">
etc
</emphasis>
,
<emphasis remap="bf">
usr
</emphasis>
.
</para>
<para>
And the Linux's boot partition has these directories:
<emphasis remap="bf">
vmlinuz
</emphasis>
,
<emphasis remap="bf">
boot.b
</emphasis>
,
<emphasis remap="bf">
chain.b
</emphasis>
,
<emphasis remap="bf">
map
</emphasis>
.
</para>
<para>
To find out root partition do this :
<programlisting format="linespecific">
bash# fdisk /dev/hda
Command (m for help): m (Gives you help on commands)
Command (m for help): p (Gives you list of partitons)
Command (m for help): q
bash# mkdir /test
bash# mount /dev/hda1 /test
bash# ls /test
You should see root-partition list like this -
bin fd lib mnt proc sbin usr
boot dev etc home lost+found opt root tmp var</programlisting>
If this is not a root partition, then try the next partition
/dev/hda2. Keep trying hda3, hda4, hda5, etc.. untill you find
the root partition. If you do not find root partition in
<emphasis remap="bf">
hda
</emphasis>
device then repeat the above steps for other hard disk devices
like
<emphasis remap="bf">
hdb
</emphasis>
,
<emphasis remap="bf">
hdc
</emphasis>
,
<emphasis remap="bf">
hdd
</emphasis>
etc..
</para>
<para>
Next, you should find the /boot, /usr and /var partitions. The
disk locations of these partitions are needed to create the new
lilo configuration.
</para>
<para>
In my case the root partition is /dev/hda4 which is used in the
examples below:
<programlisting format="linespecific">
bash# mkdir /rootpartition
bash# mount /dev/hda4 /rootpartition
bash# cat /rootpartition/etc/fstab
Read the output of fstab and mount partitions as per fstab file, see below -
bash# mount /dev/hda5 /rootpartition/boot
bash# mount /dev/hda6 /rootpartition/usr
bash# mount /dev/hda7 /rootpartition/var
bash# mount /dev/hda8 /rootpartition/opt
bash# mount /dev/hda9 /rootpartition/root
bash# mount /dev/hda10 /rootpartition/home</programlisting>
In my case, as per fstab file hda5 was
<emphasis remap="bf">
boot
</emphasis>
, hda6 was
<emphasis remap="bf">
usr
</emphasis>
, hda7 was
<emphasis remap="bf">
var
</emphasis>
, hda8 was
<emphasis remap="bf">
opt
</emphasis>
, hda9 was
<emphasis remap="bf">
root
</emphasis>
, hda10 was
<emphasis remap="bf">
home
</emphasis>
and hda11 was windows95 (FAT16 partition).
</para>
<para>
Edit /etc/fstab (not /rootpartition/etc/fstab) and put (sample code
given here) -
<programlisting format="linespecific">
/dev/hda4 /rootpartition ext2 defaults 1 1
/dev/hda5 /rootpartition/boot ext2 defaults 1 1
/dev/hda6 /rootpartition/usr ext2 defaults 1 1
/dev/hda7 /rootpartition/var ext2 defaults 1 1
/dev/hda8 /rootpartition/opt ext2 defaults 1 1
/dev/hda9 /rootpartition/root ext2 defaults 1 1
/dev/hda10 /rootpartition/home ext2 defaults 1 1
/dev/hda11 /rootpartition/win95part vfat defaults 1 1
On my computer hda4 contains the linux root partition, hda5 had boot partition and
hda11 has windows 95 vfat system.
bash# mkdir /rootpartition/win95part
bash# mount /rootpartition/win95part
And repair the problem partitions using fsck or e2fsck commands.
bash# man fsck
bash# man e2fsck</programlisting>
</para>
</listitem>
<listitem>
<para>
<emphasis remap="bf">
SCENE 2:
</emphasis>
If LILO is not working..
</para>
<para>
Follow scene 1 above, if that fails then follow these steps.
After executing steps in scene 1 above, you should have already
mounted /rootpartition and have created /etc/fstab file.
</para>
<para>
Note: It is very important to note how chroot command works
below. The
<emphasis remap="bf">
/sbin/lilo
</emphasis>
file which chroot uses is actually located in
<emphasis remap="bf">
/rootpartition/sbin/lilo
</emphasis>
and NOT in /sbin!! Hence, do not get confused.
<programlisting format="linespecific">
bash# mount -a
bash# chroot /rootpartition /sbin/lilo -q
bash# man chroot
bash# chroot /rootpartition /sbin/lilo </programlisting>
</para>
<para>
Note: New users of chroot will be confused. If chroot command
complains that it cannot find /boot/map file then it actually
means it that it cannot find /rootpartition/boot/map. Because you
gave /rootpartition as the first argument to chroot and all
references are with respect to /rootpartition.
</para>
<para>
Alternatively, you can directly use /sbin/lilo instead of
chroot. The -r option of lilo actually does chroot. It is very
<emphasis remap="bf">
strongly recommended
</emphasis>
that you use chroot, instead of lilo -r, as it is more
convenient and can catch errors more easily.
<programlisting format="linespecific">
bash# man lilo
bash# /sbin/lilo -r /rootpartition</programlisting>
</para>
</listitem>
<listitem>
<para>
<emphasis remap="bf">
SCENE 3:
</emphasis>
If LILO is not working..
</para>
<para>
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. Or get boot
disks for Linux/NT/Windows/DOS/Mac are at
<ulink url="http://www.bootdisk.com">
"http://www.bootdisk.com"
</ulink>
Other option is - get a hold of installation Linux-CDROM. Just
about every Linux distribution provides a image of a rescue disk
on their CD. Under Linux use "dd if=/cdrom/disks/rescue
of=/dev/fd0" to create a rescue floppy disk. Under DOS use
rawrite.exe (included on Linux CD) and then do "rawrite
image-name a:".
</para>
</listitem>
<listitem>
<para>
<emphasis remap="bf">
SCENE 4:
</emphasis>
If 1, 2 and 3 above fails and you do not have boot disk
</para>
<para>
If you have another computer running linux, then login as root
and do -
</para>
<para>
Note: If you compile your own kernel as a bzImage (for instance,
bzImage-2.4.4), then you should create a hard link to
vmlinuz-2.4.4 as follows (note the the z in name vmlinuz and it
is not vmlinux). If you do not do this then mkbootdisk command
may fail.
<programlisting format="linespecific">
bash# cd /boot
bash# ls -l vmlinuz*
bash# ln /boot/bzImage-2.4.4 /boot/vmlinuz-2.4.4</programlisting>
Now that you have bzImage and vmlinuz, give these commands -
<programlisting format="linespecific">
bash$ man mkbootdisk
bash# cp /etc/lilo.conf /etc/lilo-original.conf</programlisting>
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 -
<programlisting format="linespecific">
bash$ mkbootdisk --device /dev/fd0 2.2.12-20</programlisting>
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
</para>
</listitem>
<listitem>
<para>
<emphasis remap="bf">
SCENE 5:
</emphasis>
This is the worst scenerio and hopefully you will never come to
this stage. Scenes from 1 to 4 will take care of majority of
cases. But just in case, all the above scenes 1, 2, 3 and 4 fail
then -
</para>
<para>
<emphasis remap="it">
<emphasis remap="bf">
Step 1:
</emphasis>
</emphasis>
Boot tomsrtbt (see
<xref linkend="tiny"/>
) and mount the partitions and backup the root partition to
another partition having disk space with comamnds -
<programlisting format="linespecific">
Edit /etc/fstab and put (sample code given here, you may have to
change as per your disk layout) -
/dev/hda4 /rootpartition ext2 defaults 1 1
/dev/hda11 /b1 vfat defaults 1 1
bash$ mkdir /rootpartition; mount /rootpartition
bash$ mkdir /b1; mount /b1
bash$ cd /
bash$ df
And see that there is enough disk space in /b1 to tar up the root partition
bash$ tar cvf /b1/root-hda4.tar /rootpartition</programlisting>
</para>
<para>
<emphasis remap="it">
<emphasis remap="bf">
Step 2:
</emphasis>
</emphasis>
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 -
<programlisting format="linespecific">
bash$ man mkbootdisk
bash# cp /etc/lilo.conf /etc/lilo-original.conf</programlisting>
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 -
<programlisting format="linespecific">
bash$ mkbootdisk --device /dev/fd0 2.2.12-20
bash# cp /etc/lilo-original.conf /etc/lilo.conf</programlisting>
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-hda4.tar as in step 1 above.
</para>
</listitem>
</orderedlist>
</para>
</sect2>
<sect2 id="precautionary_measures">
<title>
Precautionary measures
</title>
<para>
You should take the following pre-cautionary measures to tackle the
problems in future.
</para>
<para>
<itemizedlist>
<listitem>
<para>
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 -
<programlisting format="linespecific">
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</programlisting>
</para>
</listitem>
<listitem>
<para>
You MUST backup the partition tables setup to a floppy and to a
hard disk. You should also print this out and paste it on the
computer box.
<programlisting format="linespecific">
bash$ su - root
bash# man fdisk
bash# fdisk -l /dev/sda &gt; partition_table_backup.txt</programlisting>
Very helpful if you need to repartition the hard disk. From the
printout, you would know where your partition starts. During
recovery, after repatitioning and formating you can restore data
from the backup.
</para>
</listitem>
<listitem>
<para>
You must keep the tomsrtbt boot floppy handy. Visit
<ulink url="http://www.toms.net/rb">
"http://www.toms.net/rb"
</ulink>
(see also
<xref linkend="tiny"/>
)
</para>
</listitem>
<listitem>
<para>
You must keep the Yard rescue and boot floppy disk handy. Visit
<ulink url="http://www.linuxlots.com/~fawcett/yard">
"http://www.linuxlots.com/~fawcett/yard"
</ulink>
</para>
</listitem>
<listitem>
<para>
Backup /root and /boot directories. Boot the Tomsrtbt floppy
(see also
<xref linkend="tiny"/>
) and then
<programlisting format="linespecific">
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</programlisting>
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
<sect2 id="removing_lilo">
<title>
Removing LILO
</title>
<para>
You can replace the boot sector with the DOS boot loader by issuing
the DOS command at MS DOS prompt:
<programlisting format="linespecific">
FDISK /MBR</programlisting>
where MBR stands for "Master Boot Record".
</para>
<para>
See also LILO documentation on linux at /usr/doc/lilo* for other
methods of uninstalling the LILO. And see also 'man lilo'.
</para>
</sect2>
<sect2 id="common_mistakes">
<title>
Common mistakes
</title>
<para>
After making changes to /etc/lilo.conf you
<emphasis remap="bf">
MUST run lilo
</emphasis>
to make changes to go in effect. It is a very common mistake committed
by newusers. Type -
<programlisting format="linespecific">
bash# lilo -v -v -v</programlisting>
</para>
</sect2>
</sect1>
<sect1 id="disk_partition_rescue">
<title>
Disk Partition Rescue
</title>
<para>
If the disk partition is corrupted then use these techniques given
below:
</para>
<sect2 id="partition_repair">
<title>
Partition Repair Tools
</title>
<para>
The following tools are available:
<itemizedlist>
<listitem>
<para>
rescuept by Andries Brouwer which is included in the
non-installed part of util-linux
<ulink url="http://cvs.kerneli.org/util-linux/rescuept/?sortby=rev">
recuept-download
</ulink>
</para>
</listitem>
<listitem>
<para>
Gordon Chaffees fixdisktable
<ulink url="http://bmrc.berkeley.edu/people/chaffee/fat32.html">
"http://bmrc.berkeley.edu/people/chaffee/fat32.html"
</ulink>
and
<ulink url="ftp://bmrc.berkeley.edu/pub/linux/rescue/fixdisktable-0.3.tar.gz">
mirror site
</ulink>
</para>
</listitem>
<listitem>
<para>
Christophe Greniers Testdisk
<ulink url="http://www.cgsecurity.org/index.html?testdisk.html">
"http://www.cgsecurity.org/index.html?testdisk.html"
</ulink>
and
<ulink url="http://www.gnu.org/directory/sysadmin/conf/TestDisk.html">
mirror site
</ulink>
</para>
</listitem>
<listitem>
<para>
GPart from
<ulink url="http://www.stud.uni-hannover.de/user/76201/gpart">
"http://www.stud.uni-hannover.de/user/76201/gpart"
</ulink>
.
</para>
</listitem>
<listitem>
<para>
See also
<ulink url="http://www.tldp.org/HOWTO/mini/Partition-Rescue/index.html">
"http://www.tldp.org/HOWTO/mini/Partition-Rescue/index.html"
</ulink>
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
<sect2 id="gpart">
<title>
GPart Utility
</title>
<para>
If you're trying to rescue a system with a corrupted partition table
on the main (boot) disk which is unable to boot you have two options:
</para>
<para>
<itemizedlist>
<listitem>
<para>
the easiest way is to find a working system where you can add
your disk. In case the other system cannot report the disk's
correct geometry, note down its geometry prior to moving to the
working system and tell gpart about it (use the "-C c,h,s"
option).
</para>
</listitem>
<listitem>
<para>
download the gpart binary above, rename it to "gpart", store it
on a floppy disk, print out the manual page above, and start
your system by using your prefered boot disk.
</para>
</listitem>
</itemizedlist>
</para>
<para>
After booting, look if your hard disk has been detected by your system
by entering a shell and typing "dmesg". Under e.g. Linux you should
look out for lines like "hdc: ST320430A, 19569MB w/512kB Cache,
CHS=39761/16/63". If you have booted with a rescue disk mount the
floppy disk with gpart on, and cd to the mount point.
</para>
<para>
<programlisting format="linespecific">
# To read the online manual page on gpart do :
bash$ man gpart
bash$ gpart --help
gpart: invalid option -- -
Usage: gpart [options] device
Options: [-b &lt;backup MBR&gt;][-C c,h,s][-c][-d][-E][-e][-f][-g][-h][-i]
[-K &lt;last sector&gt;][-k &lt;# of sectors&gt;][-L][-l &lt;log file&gt;]
[-n &lt;increment&gt;][-q][-s &lt;sector-size&gt;][-t &lt;module-name&gt;]
[-V][-v][-W &lt;device&gt;][-w &lt;module-name,weight&gt;]
gpart v0.1h (c) 1999-2001 Michail Brzitwa &lt;michail@brzitwa.de&gt;.
Guess PC-type hard disk partitions.
</programlisting>
</para>
<para>
Now run "gpart /dev/[lt ]your disk[gt ]", e.g. "gpart /dev/hdc".
Without any options, gpart performs a standard scan, and merely looks
if it can guess a consistent primary partition table. A typical
positive output looks like:
</para>
<para>
<programlisting format="linespecific">
Begin scan...
Possible partition(DOS FAT), size(3999mb), offset(0mb)
Possible extended partition at offset(4000mb)
Possible partition(Windows NTFS), size(3999mb), offset(4000mb)
Possible partition(Linux ext2), size(3072mb), offset(8000mb)
Possible partition(Linux ext2), size(3072mb), offset(11072mb)
Possible partition(Linux ext2), size(3072mb), offset(14144mb)
Possible partition(Linux ext2), size(2353mb), offset(17216mb)
End scan.
Checking partitions...
Partition(DOS or Windows 95 with 32 bit FAT): primary
Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): logical
Partition(Linux ext2 filesystem): logical
Partition(Linux ext2 filesystem): logical
Partition(Linux ext2 filesystem): primary
Partition(Linux ext2 filesystem): primary
Ok.
Guessed primary partition table:
Primary partition(1)
type: 011(0x0B)(DOS or Windows 95 with 32 bit FAT)
size: 3999mb #s(8191953) s(63-8192015)
chs: (0/1/1)-(1023/15/63)d (0/1/1)-(8126/15/63)r
Primary partition(2)
type: 005(0x05)(Extended DOS)
size: 10144mb #s(20775888) s(8192016-28967903)
chs: (1023/15/63)-(1023/15/63)d (8127/0/1)-(28737/15/63)r
Primary partition(3)
type: 131(0x83)(Linux ext2 filesystem)
size: 3072mb #s(6291456) s(28967904-35259359)
chs: (1023/15/63)-(1023/15/63)d (28738/0/1)-(34979/8/24)r
Primary partition(4)
type: 131(0x83)(Linux ext2 filesystem)
size: 2353mb #s(4819248) s(35259840-40079087)
chs: (1023/15/63)-(1023/15/63)d (34980/0/1)-(39760/15/63)r</programlisting>
</para>
<para>
Now if after the check-phase it says Ok, you should check the proposed
partition table very carefully. After that you may write back the
guessed table by calling "gpart -W /dev/hdc /dev/hdc" (exchange
/dev/hdc with your disk device). When gpart has successfully written
the new primary partition table, cross your fingers and reboot.
</para>
<para>
If gpart says it found inconsistencies, you are a bit on your own.
What you can do is to fiddle with gparts numerous options. For
example, to scan on sector boundaries instead of head boundaries, give
it the "-n s" option. Normally gpart skips the disk space a possible
partition seems to occupy, to really scan the whole disk, add the "-f"
option. Read the man page and improvise.
</para>
<para>
The gpart tries to guess which partitions are on a hard disk. If the
primary partition table has been lost, overwritten or destroyed the
partitions still exist on the disk but the operating system cannot
access them.
</para>
<para>
gpart ignores the primary partition table and scans the disk (or disk
image, file) sector after sector for several filesystem/partition
types. It does so by "asking" filesystem recognition modules if they
think a given sequence of sectors resembles the beginning of a
filesystem or partition type. Currently the following filesystem types
are known to gpart (listed by module names) : beos, bsddl, ext2, fat,
hmlvm, lswap, minix, ntfs, qnx4, rfs, s86dl, xfs.
</para>
</sect2>
<sect2 id="partition_mini_howto">
<title>
Partition Rescue Mini-Howto
</title>
<para>
See also
<ulink url="http://www.tldp.org/HOWTO/mini/Partition-Rescue/index.html">
"http://www.tldp.org/HOWTO/mini/Partition-Rescue/index.html"
</ulink>
</para>
</sect2>
</sect1>
<sect1 id="related_urls">
<title>
Related URLs
</title>
<para>
Visit following locators which are related to LILO, Rescue Linux, crash
recovery -
<itemizedlist>
<listitem>
<para>
Mini Lilo HOWTO at
<ulink url="http://www.tldp.org/HOWTO/mini/LILO.html">
"http://www.tldp.org/HOWTO/mini/LILO.html"
</ulink>
</para>
</listitem>
<listitem>
<para>
Bootdisk-HOWTO at
<ulink url="http://www.tld.org/LDP/HOWTO/Bootdisk-HOWTO/index.html">
"http://www.tld.org/LDP/HOWTO/Bootdisk-HOWTO/index.html"
</ulink>
</para>
</listitem>
<listitem>
<para>
Pre-made boot disks at
<ulink url="http://www.tldp.org/HOWTO/Bootdisk-HOWTO">
"http://www.tldp.org/HOWTO/Bootdisk-HOWTO"
</ulink>
</para>
</listitem>
<listitem>
<para>
Boot disks for Linux/NT/Windows/DOS/Mac at
<ulink url="http://www.bootdisk.com">
"http://www.bootdisk.com"
</ulink>
</para>
</listitem>
<listitem>
<para>
Tomsrtbt boot floppy disk
<ulink url="http://www.toms.net/rb">
"http://www.toms.net/rb"
</ulink>
and (see also
<xref linkend="tiny"/>
)
</para>
</listitem>
<listitem>
<para>
Yard rescue and boot floppy disk
<ulink url="http://www.linuxlots.com/~fawcett/yard">
"http://www.linuxlots.com/~fawcett/yard"
</ulink>
</para>
</listitem>
<listitem>
<para>
BootPrompt-HOWTO at
<ulink url="http://www.tldp.org/HOWTO/BootPrompt-HOWTO.html">
"http://www.tldp.org/HOWTO/BootPrompt-HOWTO.html"
</ulink>
</para>
</listitem>
<listitem>
<para>
Multiboot with LILO mini HOWTO at
<ulink url="http://www.tldp.org/HOWTO/mini/Multiboot-with-LILO.html">
"http://www.tldp.org/HOWTO/mini/Multiboot-with-LILO.html"
</ulink>
</para>
</listitem>
<listitem>
<para>
Linux+WinNT mini HOWTO at
<ulink url="http://www.tldp.org/HOWTO/mini/Linux+WinNT.html">
"http://www.tldp.org/HOWTO/mini/Linux+WinNT.html"
</ulink>
</para>
</listitem>
<listitem>
<para>
Linux goodies main site
<ulink url="http://www.milkywaygalaxy.freeservers.com">
"http://www.milkywaygalaxy.freeservers.com"
</ulink>
Mirror sites are at -
<ulink url="http://aldev0.webjump.com">
"http://aldev0.webjump.com"
</ulink>
,
<ulink url="http://www.angelfire.com/country/aldev0">
angelfire
</ulink>
,
<ulink url="http://www.geocities.com/alavoor/index.html">
geocities
</ulink>
,
<ulink url="http://aldev0.virtualave.net">
virtualave
</ulink>
,
<ulink url="http://aldev0.50megs.com">
50megs
</ulink>
,
<ulink url="http://members.theglobe.com/aldev1/index.html">
theglobe
</ulink>
,
<ulink url="http://members.nbci.com/alavoor">
NBCi
</ulink>
,
<ulink url="http://aldev.terrashare.com">
Terrashare
</ulink>
,
<ulink url="http://members.fortunecity.com/aldev">
Fortunecity
</ulink>
,
<ulink url="http://aldev.freewebsites.com">
Freewebsites
</ulink>
,
<ulink url="http://members.tripod.lycos.com/aldev">
Tripod
</ulink>
,
<ulink url="http://members.spree.com/technology/aldev">
Spree
</ulink>
,
<ulink url="http://www.escalix.com/freepage/aldev">
Escalix
</ulink>
,
<ulink url="http://www.httpcity.com/aldev/index.html">
Httpcity
</ulink>
,
<ulink url="http://aldev.freeservers.com">
Freeservers
</ulink>
.
</para>
</listitem>
<listitem>
<para>
Vim color text editor for C++, C
<ulink url="http://www.tldp.org/LDP/HOWTO/Vim-HOWTO.html">
"http://www.tldp.org/LDP/HOWTO/Vim-HOWTO.html"
</ulink>
</para>
</listitem>
</itemizedlist>
</para>
</sect1>
<sect1 id="other_formats">
<title>
Other Formats of this Document
</title>
<para>
This document is published in 14 different formats namely - DVI,
Postscript, Latex, Adobe Acrobat PDF, LyX, GNU-info, HTML, RTF(Rich Text
Format), Plain-text, Unix man pages, single HTML file, SGML (Linuxdoc
format), SGML (Docbook format), MS WinHelp format.
</para>
<para>
This howto document is located at -
<itemizedlist>
<listitem>
<para>
<ulink url="http://www.tldp.org">
"http://www.tldp.org"
</ulink>
and click on HOWTOs and search for howto document name using
CTRL+f or ALT+f within the web-browser.
</para>
</listitem>
</itemizedlist>
</para>
<para>
You can also find this document at the following mirrors sites -
<itemizedlist>
<listitem>
<para>
<ulink url="http://www.caldera.com/LDP/HOWTO">
"http://www.caldera.com/LDP/HOWTO"
</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.linux.ucla.edu/LDP">
"http://www.linux.ucla.edu/LDP"
</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.cc.gatech.edu/linux/LDP">
"http://www.cc.gatech.edu/linux/LDP"
</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.redhat.com/mirrors/LDP">
"http://www.redhat.com/mirrors/LDP"
</ulink>
</para>
</listitem>
<listitem>
<para>
Other mirror sites near you (network-address-wise) can be found at
<ulink url="http://www.tldp.org/mirrors.html">
"http://www.tldp.org/mirrors.html"
</ulink>
select a site and go to directory /LDP/HOWTO/xxxxx-HOWTO.html
</para>
</listitem>
</itemizedlist>
</para>
<para>
<itemizedlist>
<listitem>
<para>
You can get this HOWTO document as a single file tar ball in HTML,
DVI, Postscript or SGML formats from -
<ulink url="ftp://www.tldp.org/pub/Linux/docs/HOWTO/other-formats/">
"ftp://www.tldp.org/pub/Linux/docs/HOWTO/other-formats/"
</ulink>
and
<ulink url="http://www.tldp.org/docs.html#howto">
"http://www.tldp.org/docs.html#howto"
</ulink>
</para>
</listitem>
<listitem>
<para>
Plain text format is in:
<ulink url="ftp://www.tldp.org/pub/Linux/docs/HOWTO">
"ftp://www.tldp.org/pub/Linux/docs/HOWTO"
</ulink>
and
<ulink url="http://www.tldp.org/docs.html#howto">
"http://www.tldp.org/docs.html#howto"
</ulink>
</para>
</listitem>
<listitem>
<para>
Single HTML file format is in:
<ulink url="http://www.tldp.org/docs.html#howto">
"http://www.tldp.org/docs.html#howto"
</ulink>
</para>
<para>
Single HTML file can be created with command (see man sgml2html) -
sgml2html -split 0 xxxxhowto.sgml
</para>
</listitem>
<listitem>
<para>
Translations to other languages like French, German, Spanish,
Chinese, Japanese are in
<ulink url="ftp://www.tldp.org/pub/Linux/docs/HOWTO">
"ftp://www.tldp.org/pub/Linux/docs/HOWTO"
</ulink>
and
<ulink url="http://www.tldp.org/docs.html#howto">
"http://www.tldp.org/docs.html#howto"
</ulink>
Any help from you to translate to other languages is welcome.
</para>
</listitem>
</itemizedlist>
The document is written using a tool called "SGML-Tools" which can be
got from -
<ulink url="http://www.sgmltools.org">
"http://www.sgmltools.org"
</ulink>
Compiling the source you will get the following commands like
<itemizedlist>
<listitem>
<para>
sgml2html xxxxhowto.sgml (to generate html file)
</para>
</listitem>
<listitem>
<para>
sgml2html -split 0 xxxxhowto.sgml (to generate a single page html
file)
</para>
</listitem>
<listitem>
<para>
sgml2rtf xxxxhowto.sgml (to generate RTF file)
</para>
</listitem>
<listitem>
<para>
sgml2latex xxxxhowto.sgml (to generate latex file)
</para>
</listitem>
</itemizedlist>
</para>
<sect2 id="acrobatpdf">
<title>
Acrobat PDF format
</title>
<para>
PDF file can be generated from postscript file using either acrobat
<emphasis remap="bf">
distill
</emphasis>
or
<emphasis remap="bf">
Ghostscript
</emphasis>
. And postscript file is generated from DVI which in turn is generated
from LaTex file. You can download distill software from
<ulink url="http://www.adobe.com">
"http://www.adobe.com"
</ulink>
. Given below is a sample session:
<programlisting format="linespecific">
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 &amp;</programlisting>
Or you can use Ghostscript command
<emphasis remap="bf">
ps2pdf
</emphasis>
. 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.
<emphasis remap="bf">
ps2pdf
</emphasis>
is implemented as a very small command script (batch file) that
invokes Ghostscript, selecting a special "output device" called
<emphasis remap="bf">
pdfwrite
</emphasis>
. 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.
</para>
</sect2>
<sect2 id="linuxdoc2docbook">
<title>
Convert Linuxdoc to Docbook format
</title>
<para>
This document is written in linuxdoc SGML format. The Docbook SGML
format supercedes the linuxdoc format and has lot more features than
linuxdoc. The linuxdoc is very simple and is easy to use. To convert
linuxdoc SGML file to Docbook SGML use the program
<emphasis remap="bf">
ld2db.sh
</emphasis>
and some perl scripts. The ld2db output is not 100[percnt] clean and
you need to use the
<emphasis remap="bf">
clean[lowbar]ld2db.pl
</emphasis>
perl script. You may need to manually correct few lines in the
document.
<itemizedlist>
<listitem>
<para>
Download ld2db program from
<ulink url="http://www.dcs.gla.ac.uk/~rrt/docbook.html">
"http://www.dcs.gla.ac.uk/~rrt/docbook.html"
</ulink>
or from
<ulink url="http://www.milkywaygalaxy.freeservers.com">
Milkyway Galaxy site
</ulink>
</para>
</listitem>
<listitem>
<para>
Download the cleanup[lowbar]ld2db.pl perl script from
<ulink url="http://www.milkywaygalaxy.freeservers.com">
Milkyway Galaxy site
</ulink>
</para>
</listitem>
</itemizedlist>
The ld2db.sh is not 100[percnt] clean, you will get lots of errors
when you run
<programlisting format="linespecific">
bash$ ld2db.sh file-linuxdoc.sgml db.sgml
bash$ cleanup.pl db.sgml &gt; db_clean.sgml
bash$ gvim db_clean.sgml
bash$ docbook2html db.sgml</programlisting>
And you may have to manually edit some of the minor errors after
running the perl script. For e.g. you may need to put closing tag &lt;
/Para&gt; for each &lt; Listitem&gt;
</para>
</sect2>
<sect2 id="mswinhelp">
<title>
Convert to MS WinHelp format
</title>
<para>
You can convert the SGML howto document to Microsoft Windows Help
file, first convert the sgml to html using:
<programlisting format="linespecific">
bash$ sgml2html xxxxhowto.sgml (to generate html file)
bash$ sgml2html -split 0 xxxxhowto.sgml (to generate a single page html file)</programlisting>
Then use the tool
<ulink url="http://javadocs.planetmirror.com/htmltohlpe.html">
HtmlToHlp
</ulink>
. You can also use sgml2rtf and then use the RTF files for generating
winhelp files.
</para>
</sect2>
<sect2 id="readformats">
<title>
Reading various formats
</title>
<para>
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 [verbar] Applications
[verbar] Publishing [verbar] TeX menu buttons. To read dvi document
give the command -
<screen format="linespecific">
xdvi -geometry 80x90 howto.dvi man xdvi
</screen>
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'.
</para>
<para>
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 [verbar] Applications [verbar] 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.
</para>
<para>
<itemizedlist>
<listitem>
<para>
Get ghostscript for Windows 95, OS/2, and for all OSes from
<ulink url="http://www.cs.wisc.edu/~ghost">
"http://www.cs.wisc.edu/~ghost"
</ulink>
</para>
</listitem>
</itemizedlist>
</para>
<para>
To read postscript document give the command -
<screen format="linespecific">
gv howto.ps ghostscript howto.ps
</screen>
</para>
<para>
You can read HTML format document using Netscape Navigator, Microsoft
Internet explorer, Redhat Baron Web browser or any of the 10 other web
browsers.
</para>
<para>
You can read the latex, LyX output using LyX a X-Windows front end to
latex.
</para>
</sect2>
</sect1>
<sect1 id="copyright">
<title>
Copyright
</title>
<para>
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.
</para>
</sect1>
</article>