HOWTO.6: How to recover from trashed file systems (boot and mount problems)


HOWTO.6: Boot and mount problems: recovering from trashed file systems

Troubleshooting booting problems with LILO:

Case 1: The installation of LILO in the Master Boot record is not successful.
If Linux replaces another operating system previously installed on the same computer, erase the old master boot record by issuing the command fdisk /mbr prior to beginning the Linux install. This must be done under DOS.

Case 2: When attempting to reboot from the hard disk, you get a disk boot failure because it didn’t detect any active partition in HDD.
Make sure to activate the main Linux partition with the toggle bootable flag. To do this, boot Linux with your boot floppy, then issue the command fdisk as root , and activate the boot drive.

Fixing trashed filesystems:

If Linux detect a corrupt file system while attempting to mount the root file system and aborts the mount process by dumping you into a basic bash shell, it is likely that the damage is superblock corruption which can be repaired. Enter the root password when prompted, and issue a command such as:

e2fsck –b 8193 (partition)

After logging in as root, Linux logs you out immediately:

Most likely a shell problem. Make sure that root has a valid shell to run under. In order to check for this problem you need to boot linux in single user mode. Issue the command linux single at the “LILO Boot:” prompt and at the “bash#” prompt , check the /etc/passwd file to make sure that root has a valid shell to run.

Booting aborts because of problems with one or more initialization files:

Any problem with a system initialization file such as /etc/inittab or any of the files in /etc/rc.d (especially rc.sysinit!) may prevent the booting process to complete successfully. This can occur when one or more initialization files have been modified and Linux detects an error (most often a syntax, no-execute permission, or the file was just deleted!). Depending on where the error occurs, the boot process may not even be able to mount the root file system! If this occurs and the error is fatal (the booting process cannot continue to the login prompt), you will need to use the rescue disk. See HOWTO.6 to create a rescue diskette after the Linux 5.2 install.

Boot your system with the boot diskette . At the “LILO Boot:” prompt, enter the word “rescue”. You will see the usual kernel messages as the Linux kernel starts up. Eventually, it will ask you to insert the root floppy disk ( the rescue diskette), and press . The rescue diskette contents will be read into memory. After a minute or so, you will see a “bash#” prompt. You now have access to a stripped-down version of the root file system containing the basic commands. You can now mount the complete root file system contained on the hard disk by issuing the following commands:
mkdir /mnt/root
mount /dev/hda2
(use the actual name of the file system contained on the hard disk; it could be hda1 or hda3 or something else).
After mounting the hard disk, you can access the system initialization files and fix whatever damage you inflicted by editing the appropriate file, or copying the original one from somewhere else (floppy or CDROM for instance). Note that neither the vi nor the emacs editors is accessible in the stripped-down version of the root file system you just loaded into memory; you will need to use the full path to the root file system contained on the hard disk (after mounting it) to make use of an editor. vi is usually located in /bin. So to edit /etc/inittab, you could use the command:

/mnt/root/bin/vi /mnt/root/etc/inittab

Booting process hangs while trying to start some network-related services:

If the networking option was installed successfully during the initial Linux 5.2 install, but network connectivity is not available (or the network is down) while booting, there should not be a hang when network services are started. Most of the time you will find that hangs are due to the fact that the service being started cannot determine the local hostname. This may happen if modifications were made to the domain name or gateway with the network configuration panel, after the initial install. Unfortunately, it appears that , when activated with the network panel, not all changes get passed on to the network scripts. The files /etc/hosts and /etc/resolv.conf are normally updated without problem through the network configuration panel. However, check the file /etc/sysconfig/network to make sure the domain name and gateway IP settings are also correct.

File names on zip disk are truncated because of MSDOS:

This should not be a problem when the zip drive is mounted automatically at boot time (of course, there has to be a disk in the drive). Notice that in the file /etc/fstab, the type of the file system expected by LINUX on the zip disk is vfat. This type is fully compliant with UNIX’s unrestricted length for file naming. If mounting the drive manually, make sure to mount it by using the vfat type, not the msdos type (when using the –t option) . Or just issue the command :
mount /mnt/zipdrive (if this is where your mount point is) , or use the long-hand command:
mount –t vfat /dev/hdd4 /zipdrive (for a built-in drive), or
mount –t vfat /dev/sda4 /zipdrive (for a parallel port zip drive)
The command:
mount /dev/hdd4 /zipdrive (for a built-in hard drive) , or
mount /dev/sda4 /zipdrive (for a parallel port zip drive)
will default to the MSDOS file system type!

Zip drive and/or floppy cannot be mounted by user other than root:

To make the zip drive and/or floppy drives mountable and unmountable by any user, the file /etc/fstab must be edited while logged in as root. Locate the lines for the floppy and zip drive and make sure the 4th field contains the following options: rw,noauto,user,unhide. Reboot and the new settings in /etc/fstab will take effect.



Article ID: 271
Created: December 9, 2009
Last Updated: December 9, 2009
Author: Beth Bartel

Online URL: https://kb.unavco.org/article/howto-6-how-to-recover-from-trashed-file-systems-boot-and-mount-problems-271.html