Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the emergency skills of Linux operating system?

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "what are the emergency skills of the Linux operating system", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the emergency skills of the Linux operating system?"

1. Use the first aid panel for maintenance

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, the second disk in the first aid disk group has a complete Linux system, including the root file system, while the first disk holds a bootable kernel.

It is easy to use the emergency disk group maintenance system. Just use these two disks to start the system and enter the first aid mode, where the root account is used. In order to access the files on the hard disk, you need to install the hard disk file system manually. For example, the ext2fs type Linux file system on the / dev/ hda2 disk can be mounted in the / mnt directory with the following command:

# 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. In 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

two。 The handling method when the file system is destroyed

When the file system is corrupted, if you are using an ext2fs type file system, you can run the e2fsck command from the floppy disk to correct the corrupted data in the file system. 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 install mount

Note: the common cause of file system corruption is that the super block is corrupted, which is the "header" of the file system. It contains information such as the status, size, and free blocks of the file system. If a super block of a file system is corrupted (such as accidentally writing data directly to the super block partition of the file system), the file system may not be recognized at all, so it cannot be mounted and cannot be handled even with the e2fsck command.

However, ext2fs-type file systems back up the contents of the super block and store it at the driver's block group (block group) boundary. You can tell e2fsck to use the backup of the super block with the following command

# e2fsck-b 81

ninety-three

Refers to the partition where the file system is located, and the-b 8193 option is used to display backup data using 8193 super blocks stored in the file system

3. Recover lost files

If you accidentally delete an important file, there is no way to restore it directly. However, the corresponding files can also be copied from the first aid disk to the hard drive. For example, if the file / bin/login is deleted and the system does not enter the login interface properly, you can boot the system with the first aid disk group, install the hard disk file system to the / mnt directory, and then use the following command:

# cp-a / bin/log in/ mnt/bin

The "- a" option tells cp to maintain access to the file when copying.

Of course, this method cannot be used if the deleted basic file is not in the first aid disk group. If you have done a system backup before, you can also use the previous backup to restore it. 4. The method of dealing with the destruction of function Library

If you accidentally break the system function library files, or break the symbolic links in the / lib directory, you will cause commands that depend on these libraries to fail to execute. The easiest solution is to boot the system with the first aid disk pack, install the hard disk file system in the / mnt directory, and then repair the libraries in the / mnt/lib directory.

5. Unable to log in to the system with root account

Due to the negligence of the system administrator, or because the system has been hacked, 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 the problem can be solved with a first-aid disk group.

In the second case, the system administrator is unable to enter the system because the password is likely to be changed by a hacker, that is, the Linux system is completely out of control, so control of the system should be regained as soon as possible. After obtaining root authority, you should also check if the system is damaged in order to prevent hackers from invading again.

The most important thing to do is to reset the root password to gain control of the Linux operating system. First boot the system with the first aid disk group, then install the file system of the hard disk into the / mnt directory, edit the / mnt/etc/passwd file, and empty the line of encrypted password fields corresponding to the root account, as follows:

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

Note: if the system uses the shadow tool, you need to do the above on the file / etc/shadow so that the root login system does not need a password.

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

The 6.Linux system cannot be started

In general, if the system administrator cannot enter the system normally, you need to consider using the emergency disk group to enter the first aid mode to troubleshoot the system. But in the absence of a first-aid disk group, the Linux system can not be started, what should I do?

When using a Linux system on a personal computer, Linux and MS Windows 9x or MS Windows NT usually coexist. Reinstalling other operating systems often causes the original Linux to fail to boot. This is mainly because these operating systems default to no other operating system in the computer, so they rewrite the master boot record (MBR) of the hard disk and flush out the LILO system boot program of Linux.

If there is a first-aid disk set, it is simple to start the Linux system of the hard disk with the first boot disk, rerun the LILO command, and write the LILO system boot program back to the master boot record of the hard disk. Just turn it on again.

If there is no system boot disk, how to restore the Linux on the hard disk? In this case, if you know the exact partition where Linux is installed on your hard disk, and you have a loadlin program, you can return to Linux. Loadlin program is a program under DOS. Running it can start Linux directly from DOS and quickly enter the Linux environment. This program can be found in the dosutil/ directory of the Red Hat Linux 6.0CD.

In addition, you need an image file of the Linux boot kernel. This file, vmlinuz, is found in the images/ directory of the Red Hat linux 6.0CD.

For example, under the Windows 98 system, enter the single-user mode of DOS and 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 Linux's root file system is located. After the command is executed, the Linux system is booted. After logging in with root and running the LILO command, the LILO is reloaded into MBR, returning to the previous state of co-use of multiple operating systems.

At this point, I believe you have a deeper understanding of "what are the emergency skills of the Linux operating system?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report