Linux Common Emergency handling methods

Source: Internet
Author: User

Maintenance using the first Aid tray group

The first Aid disk group (also known as the Boot/root Disk group) is an essential tool for system administrators. It can be used to start and run a complete Linux system independently.  In fact, a complete Linux system, including the root filesystem, is on the 2nd disk in the first aid pack, and the 1th disk is the bootable kernel.
It is easy to maintain the system using the Emergency disk group. Just use these two disks to start the system, enter the first aid mode, then use the root account. in order to access the files on your 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 system on the/DEV/HDA2 disk in the/mnt directory:
# monut-t Ext2/dev/hda2/mnt Note: The root directory is now the root directory on the emergency disk. In order to access the files in the hard disk file system, you must first install it into a directory. This way, 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. How to handle file systems when they are compromised

When the file system is destroyed, if you are using a file system of type EXT2FS, you can use the floppy disk E2FSCK command to correct the corrupted data in the filesystem.  For other types of file systems, you can use the appropriate fsck command.

When checking the file system from a floppy disk, it is best not to mount Mount. Note: The most common cause of file system corruption is that the super block is corrupted, and the Super block is the "head" of the file system. It contains information such as the state, size, and free disk blocks of the file system.  If a file system's Super block is damaged (such as accidentally writing data directly to the file system's Super block partition), then the system may not recognize the file system at all, so it cannot be installed, even if the use of the E2FSCK command does not handle the problem. However, the EXT2FS type of file system backs up the contents of the Super block and stores it at the block group boundary of the driver . You can use the following command to notify E2fsck using the Super block backup # e2fsck-b 8193
Refers to the partition where the file system resides, and the-B 8193 option is used to display backup data using 8193 blocks of super blocks stored in the file system.
Recover lost Files

If you accidentally delete the important files, then there is no way to recover directly. However, you can also copy the appropriate files from the rescue disk to your hard disk . For example, if the file/Bin/login is deleted and the system does not enter the login screen properly, you can start the system with the first aid group, install the hard disk file system into the/mnt directory, and then use the following command:

#cp-A/bin/login/mnt/bin
The "-a" option tells CP to keep the file access when copying. Of course, if the deleted basic files are not in the "Emergency Disk group", it is not possible to use this method. If you have previously done a system backup, you can also use the previous backup to recover.
How to deal with failure of library if you accidentally destroy the system library file, or destroy the symbolic link in the/lib directory, the command that relies on these libraries will be executed without execution. The simplest solution is to start the system with an emergency disk group, install the hard disk file system in the/mnt directory, and then repair/mnt/lib the library in the directory.
Unable to log in to the system with the root account the system administrator may not be able to log into the system with the root account because of system administrator's negligence, or because the system is compromised by hackers. For the 1th case, the system administrator may have forgotten the root password, and using the first aid pack will solve the problem.
In the 2nd case, because the password is likely to be modified by hackers, so the system administrator can not enter the system, that is, the Linux system is completely out of control, so should regain control of the system as soon as possible. After root permission, you should also check the system is destroyed, in case the hacker again intrusion. the most important thing to do is to reset the root password and gain control of the Linux operating system. First start the system with the first Aid disk group, and then install the hard disk's file system into the/mnt directory, edit/mnt/etc/passwd the file, and place the encrypted password field corresponding to the root account blank, as shown below:
Root::0:0:root:/root:bin/bash Note: If the system uses the shadow tool, you need to do this with the file/Etc/shadow so that the root login system does not require a password. 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 require a password to be entered ). After entering the system, use the command passwd to set the new password.
Linux system does not boot

In general, if the system administrator does not enter the system properly, you need to consider the use of emergency disk group into the first aid mode troubleshooting system. But what do I do if the Linux system does not start without a rescue disk set?  


When using a Linux system on a personal computer, it is common for Linux and MS Windows 9x or MS Windows NT to coexist.
Reinstalling other operating systems often causes the original Linux to fail to boot. This is mainly because these operating systems, by default, have no other operating system in the computer, thus overwriting the master boot record (MBR) of the hard disk, and flushing out the Linux LILO system boot program. If you have an emergency disk set, it is easy to use the first boot disk Linux system to boot the hard disk and rerun the Lilo command to write the LILO system bootloader back to the hard drive's master boot record.  Boot again.
If there is no system boot disk, how to restore Linux on the hard disk? In this case, if you know the exact installation partition of Linux on the hard disk and have the Loadlin program, you can return to Linux again. Loadlin program is a DOS program, running it can start Linux directly from the DOS, quickly into the Linux environment. This program is available in the Dosutil/directory of the Red Hat Linux 6.0 CD. In addition, a Linux boot kernel image file is required.  This file--vmlinuz is available in the images/directory of the Red H at Linux 6.0 CD.
For example, under the Windows 98 system, enter DOS single-user mode and then run the following Loadlin command to re-enter the Linux system:
Loadlin vmlinuz root=/dev/hda8
/DEV/HDA8 is the hard disk partition location where the root file system of Linux resides. After the command executes, the Linux system is booted. After logging in as root and running the Lilo command, the Lilo is re-loaded into the MBR, returning to the previous state of multi-os coexistence.

Read the original

Linux Common Emergency handling methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.