Processing method for common emergencies in Linux

xiaoxiao2021-03-06  38

1. Maintenance with a first aid disk group

The first aid disk group (also known as a boot / root set) is an indispensable tool for system administrators. Use it to start and run a complete Linux system independently. In fact, there is a complete Linux system on the 2nd plate in the first aid disk group, including the root file system; and the first disk stores the latable kernel. It is very simple to use the first aid disk maintenance system. Just start the system with these two discs, enter the first aid mode, then use 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 Linux file system on / dev / hda2 disk in / mnt directory: # monut -t ext2 / dev / hda2 / mnt

Note: Now the root directory is the root directory on the first aid. In order to access files in the hard disk file system, you must install it into a certain directory first. This way, if the file system is installed on the / mmt directory on the / mmt directory, the path to the original / etc / passwd file is / mnt / etc / passwd.

2. Processing method when the file system is destroyed

When the file system is destroyed, if the EXT2FS type file system is used, the E2FSck command can be fixed from the floppy disk to correct the damaged data in the file system. For other types of file systems, you can use the corresponding fsck command. When checking the file system from the floppy disk, it is best not to install.

Note: Frequently due to the destruction of file systems is that the hyper block is damaged, the super block is the "head" of the file system. It contains information such as status, size, and idle disk blocks of file systems. If the hyper block of a file system (for example, accidentally writing data to the hyper block partition of the file system), the system may not identify the file system, which cannot be installed, even if the e2fsck command is used You cannot handle this problem. However, the EXT2FS type file system has backed up the contents of the super block and stores the block group (Block Group) boundary. You can use the following command to notify E2FSCK Use the backup of the super block: # e2fsck -b 8193

It refers to the partition where the file system is located, and the -b 8193 option is used to display backup data that uses the super block of 8193 blocks in the file system.

3, recover lost files

If you accidentally delete an important file, there is no way to recover. However, you can also copy the corresponding file from the first aid disk to the hard disk. For example, if the file / bin / login is deleted, the system cannot enter the login interface. You can use the first aid disk set to start the system, install the hard disk file system into the / mnt directory, then use the following command: #cp -a / BIN / LOGIN / MNT / BIN

"-A" option is used to tell CP to keep the file accessed when copying. Of course, if the basic file being removed is not in the "First Aid Play", it will not use this method. If you have made the system backup before, you can also recover with previous backups.

4. Processing method when the function library is destroyed

If you accidentally destroy the system function library file, or destroy the symbolic link under the / lib directory, the commands that depend on these libraries cannot be executed. The easiest solution is to start the system with a first aid disc group, install a hard disk file system in the / mnt directory, and then fix the library in / mnt / lib directory.

5, can not log in to the system with the root account

Due to the negligence of the system administrator, or because the system is hacked, the system administrator may not be able to log in to the system with the root account. For the first case, it may be that the system administrator has forgot the root password, and the problem can be solved with a first aid disk. For the second case, since the password is probably being modified by hackers, the system administrator cannot enter the system, that is, the Linux system completely lost control, so it should be re-obtained as soon as possible. After obtaining the root permissions, the system destroyed should be checked to prevent the hacker to invade again. The most important task that needs to be done is to reset the root password to get the control of the Linux operating system. First use the first aid disk group to start the system, then install the hard disk file system to the / mnt directory, edit the / mnt / etc / passwd file, set it empty, as shown below: root: : 0: 0: root: / root: bin / bash Note: If the system uses the Shadow tool, you need to make the above-described operations on file / etc / shadow, so that the root login system does not require a password. In this way, the root account has no password. When you re-start the Linux system from the hard drive, you can log in with the root account (the system will not be required to enter a password). After entering the system, set the new password with the command passwd.

6, Linux system can't start

In general, if the system administrator does not enter the system normally, it is necessary to consider the failure of using the first aid disk to enter the first aid mode to exclude the system. However, if there is no emergency disc group, the Linux system cannot start, what should I do?

When using Linux systems in a PC, it is usually connected to MS Windows 9x or MS Windows NT.

Since the other operating system is reinstalled, the original Linux cannot be started. This is mainly because these operating systems default to no other operating systems in the computer, thereby rewrite the main boot record (MBR) of the hard disk, rushing down the Linux LILO system boot program.

If there is a first aid disk group, then very simple, start the hard disk's Linux system with the first boot disk, re-run the LILO command, you can write back the main boot record of the hard disk. Turn it up again.

If there is no system boot disk, how to restore Linux on your hard disk? In this case, if you know the exact installation partition on the hard disk, and there is a loadlin program, you can re-return Linux. The Loadlin program is the program under DOS, running it can start Linux directly from DOS, quickly enter the Linux environment. There is this program in the dosutil / directory of the Red Hat Linux 6.0 disc. In addition, there is a need for a Linux to start the kernel image file. There is this file in the images / directory of the Red Hat Linux 6.0 CD - Vmlinuz.

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

Loadlin vmlinuz root = / 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 will be booted. After logging in with root, run the libo command, re-load the LILO into the MBR, and return to the previous multi-operating system computers.

转载请注明原文地址:https://www.9cbs.com/read-117743.html

New Post(0)