New tip: Linux system common 6 kinds of emergency processing methods _unix Linux

Source: Internet
Author: User

How to deal with several emergency situations in Linux system

1. Use the first Aid disk group for maintenance

The first Aid disk group (also known as the Boot/root Disk group) is an essential tool for system administrators. It allows you to start and run a complete Linux system independently. In fact, there is a complete Linux system on the 2nd disk of the first aid disk group, including the root file system, while the 1th disk holds the bootable kernel.

It is easy to use the first Aid Disk group maintenance system. 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 first aid disk. In order to access 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

2, the file system is destroyed when the processing method

When the file system is corrupted, if you are using a EXT2FS type of file system, you can modify the corrupted data in the file system from the floppy disk transport e2fsck command. 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 the installation

Note: The 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 you damage a file system's Super block (for example, accidentally writing data directly to the file system's Super block partition), the system may not be able to recognize the file system at all, so you can't install it, even with the e2fsck command.

However, the EXT2FS type of file system backs up the contents of the Super block and resides in the driver's block group boundary. You can notify e2fsck to use a backup of a super block with the following command

# E2fsck-b 8193

is the partition where the file system is located, and the-B 8193 option is used to display backup data using a super block of 8193 blocks stored in the file system

3, recover the lost files

If you accidentally delete an important document, there is no way to recover it directly. However, you can also copy the appropriate files from the first aid disk to your hard disk. For example, if you delete the file/bin/login, the system does not normally go to the login interface, you can start the system with the first Aid disk 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 is used to tell the CP to maintain access to files while copying. Of course, if the deleted basic file is not in the "First Aid disk group", this method can not be used. If you have previously done a system backup, you can also use the previous backup to restore.

4. The processing method when the function storehouse destroys

If you accidentally destroy the system library files or destroy the symbolic links in the/lib directory, the commands that depend on these libraries will not execute. The simplest solution is to start the system with the first Aid disk group, install the hard disk file system in the/mnt directory, and then repair the library under the/mnt/lib directory.

5, unable to use the root account login system

The system administrator may not be able to log on to the system with the root account because of the negligence of the system administrator or because the system is hacked by hackers.

For the 1th case, the system administrator may have forgotten rootfrethem/index.htm "target=" _blank "style= ' Text-decoration:underline;color: #0000FF ' > Password, The problem can be solved by using the first aid panel.

In the 2nd case, because the password is likely to be modified by hackers, so the system administrator can not access the system, that is, the Linux system is completely out of control, so should regain control of the system as soon as possible. After you obtain root permissions, you should also check the system for damage to prevent the hacker from invading again.

The main task that needs to be done is to reset the root password to gain control of the Linux operating system. First use the first Aid disk group to start the system, and then install the hard disk file system to the/mnt directory, edit the/mnt/etc/passwd file, it corresponds to the root account of a line of encryption password domain empty, as follows:

Root::0:0:root:/root:bin/bash Note: If the system uses the shadow tool, you need to do this for the file/etc/shadow so that the root login system does not require a password.

In this way, the root account will have no password. When you restart the Linux system from the hard drive, you can log in with the root account (the system does not require a password). After entering the system, use the command passwd to set the new password.

6, Linux system can not start

In general, if the system administrator does not enter the system properly, you need to consider using the first Aid disk group into the first aid mode to troubleshoot the system. But what if the Linux system does not boot without making the first aid disk group?

When a personal computer uses a Linux system, it is usually compatible with Linux and MS Windows 9x or MS Windows NT. Due to the reinstallation of other operating systems, it often causes the original Linux to not start. This is mainly because these operating systems default to no other operating system on the computer, overwriting the hard drive's master boot Record (MBR), and flushing out the Linux Lilo system boot.

If you have a first aid disk group, it is simple to start the Linux system on the hard drive with the first boot disk and rerun the Lilo command to write the Lilo system boot back to the master boot record on your hard disk. Reboot again.

If there is no system boot disk, how to restore Linux on the hard drive? In this case, if you know that Linux is on the hard disk to install the exact partition, and there are loadlin programs, you can return to Linux. Loadlin program is a DOS program, run 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 is--vmlinuz in the images/directory of the Red Hat Linux 6.0 CD.

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

Loadlin Vmlinuz root=/dev/hda8

/DEV/HDA8 is the location of the hard disk partition where the Linux root file system resides. After the command is executed, the Linux system is booted. When you log in with root, run the Lilo command, then reload the Lilo into the MBR, back to the same state as the previous multiple operating systems.

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.