Linux Common emergency handling methods

Source: Internet
Author: User

The use of First Aid disk group for maintenance of First Aid disk group (also known as Boot/root Disk Group) is an essential tool for system administrators. With it can be started and run independently of a

A complete Linux system. In fact, there is a complete Linux system on the 2nd disk of the first aid disk group, including the root file department

And 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 in the/MNT directory

The EXT2FS type of Linux file system on the/DEV/HDA2 disk:

# 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 to a directory

Under This way, if the file system on your hard disk is installed in the/MMT directory, the path to the original/etc/passwd file on your hard disk is

/MNT/ETC/PASSWD.

The processing method when the file system is corrupted when the file system is corrupted, if the EXT2FS type file system is used, the file can be modified from the floppy disk transport e2fsck command

Corrupted data in the EC. For other types of file systems, you can use the appropriate fsck command.

When you check the file system from a floppy disk, it is best not to mount it.

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 the file system's

Information such as status, dimensions, and free disk blocks. If a file system's Super block is corrupted (for example, accidentally writing data directly to the

File system's Super block partition), the system may not recognize the filesystem at all, so it cannot be installed, even if

Using the E2FSCK command also fails to address this issue.

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

Refers to the partition where the file system resides, and the-B 8193 option is used to display the backup data that uses the 8193 blocks that are stored in the file system.

Recover lost files If you accidentally delete important files, there is no way to recover directly. But you can also copy the appropriate files from the first aid disk to the hard drive

On For example, if you delete the file/bin/login, the system does not normally go to the login interface, you can use the first Aid disk group to start the system,

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 base file is not in the "First Aid disk group,"

It's not going to work that way. If you have previously done a system backup, you can also use the previous backup to restore. The processing method of the function library failure 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

Law enforcement. 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 fix the/mnt/lib

The library under the directory.

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

For the 1th case, the system administrator may have forgotten the root password, and the problem can be solved by using the first Aid disk group.

For the 2nd case, the system administrator cannot access the system because it is likely that the password was modified by the hacker, which means that the Linux system

Completely out of control and therefore should regain control of the system as soon as possible. After you obtain root permissions, you should also check that the system is compromised.

In case the hacker is invaded again.

The main task that needs to be done is to reset the root password to gain control of the Linux operating system. First start the system with the first aid disk group,

Then install the hard drive file system into the/mnt directory, edit the/mnt/etc/passwd file, and match it to the root account's one-line encryption port

Make the field 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 loss

into the password). 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 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 the computed

There are no other operating systems in the machine, thus overwriting the master boot record (MBR) of the hard drive and flushing the Linux Lilo system boot.

If there is a first aid disk group, then it is very simple, with the first boot disk to start the hard drive of the Linux system, rerun the Lilo command, you can put the LILO system

The master boot record of the drive to write back to the hard disk. Reboot again.

If you don't have a system boot disk, how do you restore Linux on your hard drive? In this case, if you know the exact installation partition of Linux on your hard disk,

And there is the Loadlin program, you can return to Linux. Loadlin program is a DOS program, run it can start Linux directly from the DOS,

Fast access to the Linux environment. This program is available in the dosutil/directory of the Red Hat Linux 6.0 CD. In addition, we need a

The Linux boot kernel image file. In Red H

At the images/directory of the Linux 6.0 CD has this file--vmlinuz.

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. After logging in with Root, run

Lilo command, the Lilo is then loaded back into the MBR, returning to the same state of 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.