Well-known Linux operating system Emergency processing method

  

The rescue disk group (also known as boot/root disk group) is an indispensable tool for system administrators. Use it to start and run a complete Linux system independently. In fact, the second disk in the rescue disk group has a complete Linux system, including the root file system; and the first disk holds the bootable kernel.

It is easy to maintain the system with a rescue disk set. Just use these two disks to boot the system and enter the rescue mode, which is the root account.

In order to access files on the hard disk, you need to manually install the hard disk file system. For example, use the following command to install the ext2fs type of Linux file on the /dev/hda2 disk in the /mnt directory:

#monut-text2/dev/hda2/mnt

Note : The root directory is now the root directory on the rescue disk. In order to access files in the hard disk file system, you must first install it in a directory. Thus, if the file system on the hard disk is installed in the /mmt directory, the path to the original /etc/passwd file on the hard disk is /mnt/etc/passwd.

When the file system is corrupted

When the file system is corrupted, if you use the ext2fs type file system, you can use the e2fsck command from the floppy disk to fix the file system. Damaged data. For other types of file systems, the corresponding fsck command can be used. When checking the file system from a floppy disk, it is best not to mount it.

Note: A common cause of file system corruption is that the superblock is corrupted. The superblock is the file system's "head". It contains information such as the state, size, and free disk blocks of the file system. If you damage a file system's super block (for example, if you accidentally write data directly to the file system's super block partition), then the system may not recognize the file system at all, so you can't install it, even with the e2fsck command. I can't handle this problem either.

However, the ext2fs type of file system backs up the contents of the superblock and stores it in the driver's blockgroup boundary. You can use the following command to notify e2fsck to use the super block backup

#e2fsck

-b8193 refers to the partition where the file system is located, and the -b8193 option is used to display the 8193 stored in the file system. Backup data for the block's super block.

Recover lost files

If you accidentally delete important files, there is no way to recover them directly. However, you can also copy the corresponding files from the rescue disk to the hard disk. For example, if the file /bin/login is deleted, the system cannot enter the login interface normally. You can use the rescue disk group to boot the system, install the hard disk file system to the /mnt directory, and then use the following command:

#cp-a/bin/login/mnt/bin

The “-a” option is used to tell cp to keep access to files when copying. Of course, if the deleted basic file is not in the "first aid disk group", this method cannot be used. If you have done a system backup before, you can also use the previous backup to restore.

Processing methods when the library is destroyed

If you accidentally destroy the system library file, or destroy the symbolic link in the /lib directory, then the commands that depend on these libraries will not be executed. . The easiest solution is to boot the system with the rescue disk set, install the hard disk file system in the /mnt directory, and then repair the libraries in the /mnt/lib directory.

Unable to log in to the system with the root account

Due to the negligence of the system administrator or the system being compromised by the hacker, the system administrator may not be able to log in to the system with the root account.

For the first case, the system administrator may have forgotten the root password and use the rescue disk set to solve the problem.

For the second case, since the password is likely to be modified by the hacker, the system administrator cannot enter the system, that is, the Linux system completely loses control, so the system should be regained control as soon as possible. . After obtaining root privileges, you should also check the system for damage, in case it is hacked again.

The main job you need to do is to reset the root password and gain control of the Linux operating system. First boot the system with the rescue disk set, then install the file system of the hard disk to the /mnt directory, edit the /mnt/etc/passwd file, and empty the line of the encrypted password field corresponding to the root account, as shown below:

root::0:0:root:/root:bin/bash

Note: If the system uses the shadow tool, you need to perform the above operations on the file /etc/shadow to log in to the system. No password is required. This way, the root account has no password. When you restart the Linux system from the hard disk, you can log in with the root account (the system does not ask for a password). After entering the system, use the command passwd to set a new password.

Linux system can't start

Generally speaking, if the system administrator can't enter the system normally, you need to consider using the rescue disk group to enter the emergency mode to troubleshoot the system. But if the Linux system cannot be started without creating a rescue disk set, what should I do? When a personal computer uses a Linux system, Linux and MSWindows9x or MSWindowsNT usually coexist.

Due to the reinstallation of other operating systems, it often causes the original Linux to fail to start. This is mainly because these operating systems default to no other operating system on the computer, thus overwriting the hard disk's master boot record (MBR), flushing out the Linux LILO system bootloader.

If there is a rescue disk set, it is very simple, use the first boot disk to boot the hard disk Linux system, re-run the LILO command, you can write the LILO system boot program back to the hard disk master boot record. Turn it on again.

If there is no system boot disk, how to recover Linux on the hard disk? In this case, if you know the exact installation partition of Linux on the hard disk and there is a loadlin program, you can return to Linux. The loadlin program is a program under DOS. Run it to boot Linux directly from DOS and quickly enter the Linux environment. This program is available in the dosutil/directory of the RedHatLinux 6.0 CD. In addition, you need an image file for the Linux boot kernel. In the images/directory of the RedHatlinux6.0 CD, there is this file ——vmlinuz.

For example, under Windows 98 system, enter the single-user mode of DOS, and then run the following loadlin command to re-enter the Linux system:

loadlinvmlinuzroot=/dev/hda8

/dev/hda8 is the hard disk partition location where Linux's root file system is located. After the command is executed, the Linux system is booted. After logging in as root and running the LILO command, LILO will be loaded into the MBR again, returning to the state where multiple operating systems were used together.

Copyright © Windows knowledge All Rights Reserved