Handling of Linux operating system emergencies

Source: Internet
Author: User
Article Title: How to Handle Linux operating system emergencies. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
   1. Use an emergency disk group for maintenance
  
An emergency disk group (also known as the boot/root disk group) is an essential tool for system administrators. It can be used to independently start and run a complete Linux system. In fact, there is a complete Linux system, including the root file system, on the first-aid disk group's 2nd disks, while the 1st disks store the boot kernel.
It is easy to use an emergency disk group to maintain the system. You only need to use these two disks to start the system and enter the emergency mode. The root account is used.
To access files on a hard disk, you must manually install the hard disk file system. For example, run the following command to install the ext2fs Linux File System on the/dev/hda2 disk in the/mnt directory:
# Monut-t ext2/dev/hda2/mnt
  
Note: the root directory is the root directory on the First Aid Board. To access files in the hard drive file system, you must first install them in a directory. In this way, if the file system on the hard disk is installed in the/MT directory, the path of the original/etc/passwd file on the hard disk is
/Mnt/etc/passwd.
  
   2. Handling methods when the file system is damaged
  
When the file system is damaged, if the ext2fs file system is used, 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 corresponding 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 damage is that the super block is damaged, and the super block is the "Header" of the file system ". It contains information such as the status, size, and idle disk block of the file system. If a file system's super block is damaged (for example, accidentally writing data directly to the file system's super block partition), the system may not recognize the file system at all, in this way, you cannot install it, even if you use the e2fsck command.
However, the ext2fs File System backs up the contents of the super block and stores the contents at the boundary of the block group of the driver. You can use the following command to notify e2fsck to use the super block backup.
# E2fsck-B 8193
It refers to the partition where the file system is located. The-B 8193 option is used to display the backup data of 8193 Super blocks stored in the file system.
  
   3. Restore Lost files
  
If you accidentally delete important files, you cannot recover them directly. However, you can also copy the corresponding files from the First Aid disk to the hard disk. For example, if the/bin/login file is deleted and the system cannot normally enter the logon interface, you can use the First Aid disk group to start the system and install the hard disk file system in the/mnt directory, run the following command:
# Cp-a/bin/login/mnt/bin
The "-a" option is used to tell cp to maintain the object access permission during copy. Of course, this method cannot be used if the basic file to be deleted is not in the "First Aid disk group. If you have performed a system backup before, you can also use the previous backup to restore it.
  
   4. How to Deal with function library damage
  
If the system function library file is accidentally damaged or the symbolic link in the/lib directory is broken, the commands dependent on these libraries cannot be executed. The simplest solution is to start the system with an emergency disk group, install the hard disk file system in the/mnt directory, and fix the library in the/mnt/lib directory.
  
   5. You cannot log on to the system using the root account.
  
Due to System Administrator negligence or hacker intrusion, the system administrator may not be able to log on to the system using the root account.
In 1st cases, the system administrator may have forgotten the root password. The problem can be solved by using an emergency disk group.
In 2nd cases, the system administrator is unable to access the system because the password may have been modified by a hacker. That is to say, the Linux system is completely out of control, so the system control should be obtained as soon as possible. After obtaining the root permission, check the damage to the system to prevent further intrusion by hackers.
The main task to be done is to reset the root password to gain control of the Linux operating system. First, start the system with an emergency disk group, then install the hard disk file system in the/mnt directory, and edit the/mnt/etc/passwd file, leave the domain blank by setting the one-line encryption port corresponding to the root account, as shown below:
Root: 0: 0: root:/root: bin/bash
  
Note: If the system uses the shadow tool, you need to perform the above operations on the file/etc/shadow so that the root user does not need a password to log on to the system. In this way, the root account has no password. When you restart the Linux system from the hard disk, you can log on with the root account (the system does not require a password ). After entering the system, run passwd to set a new password.
  
   6. Linux cannot be started.
  
Generally, if the system administrator cannot access the system normally, you need to consider using the First Aid disk group to enter the first aid mode to eliminate system faults. But the Linux system cannot be started without an emergency disk group. What should I do? When a personal computer uses a Linux system, it usually coexist in Linux and MS Windows 9x or MS Windows NT.
Because you reinstall other operating systems, the original Linux cannot be started. This is mainly because, by default, these operating systems are no other operating systems in the computer, so the Master Boot Record (MBR) of the hard disk is rewritten and the Linux LILO boot program is washed out.
If there is an emergency disk group, it is very simple. Use the first boot disk to start the Linux System of the hard disk and run the LILO command again to write the LILO system boot program back to the Master Boot Record of the hard disk. Start the instance again.
If there is no system boot disk, how can I recover Linux on the hard disk? In this case, if you know the exact installation partition of Linux on the hard disk and there is a loadlin program, you can return to Linux again. Loadlin is a DOS program. You can run it to directly start Linux from DOS to quickly enter the Linux environment. This program is available in the dosutil/directory of the Red Hat Linux 6.0 CD. In addition, a Linux kernel startup image file is required. The file vmlinuz is available in the images/directory of the Red H at linux 6.0 CD.
For example, in Windows 98, enter the 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 of the Linux root file system. After the command is executed, the Linux system is guided. After you log on with the root user and run the LILO command, reload LILO into the MBR and return to the state where multiple operating systems were used in the past.
Related Article

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.