mirror of https://github.com/tLDP/LDP
updated
This commit is contained in:
parent
8be0d490f0
commit
bf245fd09e
|
@ -43,7 +43,7 @@ LILO, Linux Crash Rescue HOW-TO
|
|||
<author>Al Dev (Alavoor Vasudevan)
|
||||
<htmlurl url="mailto:alavoor[AT]yahoo.com"
|
||||
name="alavoor[AT]yahoo.com">
|
||||
<date>v10.2, 20 Jan 2002
|
||||
<date>v10.3, 21 Jan 2002
|
||||
<abstract>
|
||||
This document discusses methods to recover from Linux system failures.
|
||||
Various reasons for linux system failures can be -
|
||||
|
@ -106,6 +106,14 @@ See the list of tiny floppy linux given below -
|
|||
************ End of Section ***************
|
||||
*******************************************
|
||||
|
||||
-->
|
||||
<sect> Crash Recovery<label id="crash">
|
||||
<p>
|
||||
<!--
|
||||
*******************************************
|
||||
************ End of Section ***************
|
||||
*******************************************
|
||||
|
||||
-->
|
||||
<sect1> Preparation Tips <label id="tips">
|
||||
<p>
|
||||
|
@ -139,9 +147,27 @@ Follow these steps to recover from LILO or system failures.
|
|||
(see also <ref name="Tiny Linux" id="tiny">).
|
||||
Boot with tomsrtbt floppy
|
||||
Use fdisk to find the partitions. Try to recognise the
|
||||
root partition by doing this -
|
||||
root and boot partition. Watch out, you may be having the /boot files on
|
||||
the root partition itself.
|
||||
|
||||
The Linux's root partition has the following directories
|
||||
<bf>bin</bf>,
|
||||
<bf>boot</bf>,
|
||||
<bf>etc</bf>,
|
||||
<bf>usr</bf>.
|
||||
|
||||
And the Linux's boot partition has these directories:
|
||||
<bf>vmlinuz</bf>,
|
||||
<bf>boot.b</bf>,
|
||||
<bf>chain.b</bf>,
|
||||
<bf>map</bf>.
|
||||
|
||||
To find out root partition do this :
|
||||
<code>
|
||||
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
|
||||
|
@ -150,66 +176,79 @@ bin fd lib mnt proc sbin usr
|
|||
boot dev etc home lost+found opt root tmp var
|
||||
</code>
|
||||
If this is not a root partition, then try the next partition /dev/hda2.
|
||||
Next try hda3, hda4, hda5, etc.. untill you find the root partition.
|
||||
Still not found in <bf>hda</bf> then repeat the above steps for other devices
|
||||
like <bf>hdb</bf>, <bf>hdc</bf>, <bf>hdd</bf> etc..
|
||||
Also the /usr, /var, and /boot partition are needed as these are
|
||||
required to create new lilo configuration.
|
||||
Keep trying hda3, hda4, hda5, etc.. untill you find the root partition.
|
||||
If you do not find root partition in <bf>hda</bf> device then repeat the above
|
||||
steps for other hard disk devices like <bf>hdb</bf>, <bf>hdc</bf>, <bf>hdd</bf> etc..
|
||||
|
||||
Next, you should find the /boot, /usr and /var partitions.
|
||||
The disk locations of these partitions are needed to create the new lilo configuration.
|
||||
|
||||
In my case the root partition is /dev/hda4 which is used in the examples below:
|
||||
<code>
|
||||
bash# mkdir /hda4
|
||||
bash# mount /dev/hda4 /hda4
|
||||
bash# cat /hda4/etc/fstab
|
||||
bash# mkdir /rootpart
|
||||
bash# mount /dev/hda4 /rootpart
|
||||
bash# cat /rootpart/etc/fstab
|
||||
Read the output of fstab and mount partitions as per fstab file, see below -
|
||||
bash# mount /dev/hda5 /hda4/boot
|
||||
bash# mount /dev/hda6 /hda4/usr
|
||||
bash# mount /dev/hda7 /hda4/var
|
||||
bash# mount /dev/hda8 /hda4/opt
|
||||
bash# mount /dev/hda9 /hda4/root
|
||||
bash# mount /dev/hda10 /hda4/home
|
||||
bash# mount /dev/hda5 /rootpart/boot
|
||||
bash# mount /dev/hda6 /rootpart/usr
|
||||
bash# mount /dev/hda7 /rootpart/var
|
||||
bash# mount /dev/hda8 /rootpart/opt
|
||||
bash# mount /dev/hda9 /rootpart/root
|
||||
bash# mount /dev/hda10 /rootpart/home
|
||||
</code>
|
||||
In my case, as per fstab file hda5 was boot, hda6 was usr, hda7 was var, hda8 was opt,
|
||||
hda9 was root, hda10 was home and hda11 was windows95 directory.
|
||||
In my case, as per fstab file hda5 was <bf>boot</bf>, hda6 was <bf>usr</bf>,
|
||||
hda7 was <bf>var</bf>, hda8 was <bf>opt</bf>,
|
||||
hda9 was <bf>root</bf>, hda10 was <bf>home</bf> and hda11 was windows95 (FAT16 partition).
|
||||
|
||||
Edit /etc/fstab (not /hda4/etc/fstab) and put (sample code given here) -
|
||||
Edit /etc/fstab (not /rootpart/etc/fstab) and put (sample code given here) -
|
||||
<code>
|
||||
/dev/hda4 /hda4 ext2 defaults 1 1
|
||||
/dev/hda5 /hda4/boot ext2 defaults 1 1
|
||||
/dev/hda6 /hda4/usr ext2 defaults 1 1
|
||||
/dev/hda7 /hda4/var ext2 defaults 1 1
|
||||
/dev/hda8 /hda4/opt ext2 defaults 1 1
|
||||
/dev/hda9 /hda4/root ext2 defaults 1 1
|
||||
/dev/hda10 /hda4/home ext2 defaults 1 1
|
||||
/dev/hda11 /hda4/win95part vfat defaults 1 1
|
||||
/dev/hda4 /rootpart ext2 defaults 1 1
|
||||
/dev/hda5 /rootpart/boot ext2 defaults 1 1
|
||||
/dev/hda6 /rootpart/usr ext2 defaults 1 1
|
||||
/dev/hda7 /rootpart/var ext2 defaults 1 1
|
||||
/dev/hda8 /rootpart/opt ext2 defaults 1 1
|
||||
/dev/hda9 /rootpart/root ext2 defaults 1 1
|
||||
/dev/hda10 /rootpart/home ext2 defaults 1 1
|
||||
/dev/hda11 /rootpart/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 /hda4/win95part
|
||||
bash# mount /hda4/win95part
|
||||
And repair the system using fsck or e2fsck commands.
|
||||
bash# mkdir /rootpart/win95part
|
||||
bash# mount /rootpart/win95part
|
||||
And repair the problem partitions using fsck or e2fsck commands.
|
||||
bash# man fsck
|
||||
bash# man e2fsck
|
||||
</code>
|
||||
<p>
|
||||
<item> <bf>SCENE 2:</bf> If LILO is not working..
|
||||
<p>
|
||||
Follow scene 1 above, if that fails then follow these steps. Now you should have
|
||||
already mounted /hda4 and have created /etc/fstab file.
|
||||
Follow scene 1 above, if that fails then follow these steps.
|
||||
After executing steps in scene 1 above, you should have
|
||||
already mounted /rootpart and have created /etc/fstab file.
|
||||
|
||||
Note: It is very important to note how chroot command works below. The <bf>/sbin/lilo</bf>
|
||||
file which chroot uses is actually located in <bf>/rootpart/sbin/lilo</bf> and
|
||||
NOT in /sbin!! Hence, do not get confused.
|
||||
<code>
|
||||
bash# mount -a
|
||||
bash# chroot /hda4 /sbin/lilo -q
|
||||
bash# chroot /rootpart /sbin/lilo -q
|
||||
bash# man chroot
|
||||
bash# chroot /hda4 /sbin/lilo
|
||||
bash# chroot /rootpart /sbin/lilo
|
||||
</code>
|
||||
|
||||
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 /rootpart/boot/map. Because you gave /rootpart as the
|
||||
first argument to chroot and all references are with respect to /rootpart.
|
||||
|
||||
Alternatively, you can directly use /sbin/lilo instead of chroot. The
|
||||
-r option of lilo actually does chroot.
|
||||
It is very <bf>strongly recommended</bf> that you use chroot, instead of lilo -r,
|
||||
as it is more convenient and can catch errors more easily.
|
||||
<code>
|
||||
bash# man lilo
|
||||
bash# /sbin/lilo -r /hda4
|
||||
bash# /sbin/lilo -r /rootpart
|
||||
</code>
|
||||
<p>
|
||||
<item> <bf>SCENE 3:</bf> If LILO is not working..
|
||||
|
@ -265,14 +304,14 @@ scenes 1, 2, 3 and 4 fail then -
|
|||
<code>
|
||||
Edit /etc/fstab and put (sample code given here, you may have to
|
||||
change as per your disk layout) -
|
||||
/dev/hda4 /hda4 ext2 defaults 1 1
|
||||
/dev/hda4 /rootpart ext2 defaults 1 1
|
||||
/dev/hda11 /b1 vfat defaults 1 1
|
||||
bash$ mkdir /hda4; mount /hda4
|
||||
bash$ mkdir /rootpart; mount /rootpart
|
||||
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 /hda4
|
||||
bash$ tar cvf /b1/root-hda4.tar /rootpart
|
||||
</code>
|
||||
<p>
|
||||
<it><bf>Step 2: </bf></it>
|
||||
|
|
Loading…
Reference in New Issue