Article Title: A Brief Introduction to Linuxrescue. 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.
When using Linux, you will often encounter many problems because you do not understand them. After these problems are solved, you can further master the Linux system. This article describes Linux rescue in detail and plays a certain role in learning Linux rescue.
Application Scenario: All files in the/boot directory are deleted by the Administrator by mistake, and the/etc/fstab file is renamed. The system cannot boot and enters the system in repair mode, it is found that all partitions are not properly mounted and accessed. This server has very important services and data and requires quick system repair without damaging any data.
Solution Process:
1. Enable PXE boot from BIOS settings, and select boot from Network
2. After booting from the network, enter the repair mode: Linux rescue
3. Use NFS image to enter. Press enter to enter the system shell.
NFS server: 192.168.0.254
Directory:/var/ftp/pub
4. Because the/etc/fstab file is renamed, the system cannot read the file normally, so partitions cannot be mounted and all data cannot be read, first, restore the/etc/fstab file.
5. Create a directory on the Root partition, for example, mkdir test. mount the root partition to the directory mount/dev/sda3test (/dev/hda3 varies with the system)
6. Run the df command to check whether the/test/etc directory has been mounted to the test directory. Then, you can view the/test/etc directory and change the fstab file back.
7. press exit to restart the system. The file system is automatically mounted when the system reads the/etc/fstab file.
8. Go to the directory cd/mnt/source/Server where the kernel is located.
9. reinstall the kernel (rpm-ivh kernel? 2.6.18? 53. el5.i686. rpm ?? Root =/mnt/sysimage ?? Force)
10. Switch to the system root partition chroot/mnt/sysimage.
11. Install GRUBgrub? Install/dev/sda (/dev/sda varies by system)
12. regenerate initrd? 2.6.18? 53. el5.img
① Rm/boot/initrd-2.6.18-53.el5.img
② Cd/lib/modules
③ Mkinitrd/boot/initrd? 2.6.18? 53. el5.img 2.6.18? 53. el5
13. Edit the/boot/grub. conf file.
1. default = 0
2. timeout = 10
3. title Redhat Enterprise 5
4. root (hd0, 0)
5. kernel/vmlinuz? 2.6.18? 53. el5 ro root = LABEL =/
6. initrd/initrd? 2.6.18? 53. el5.img
14. press exit twice to restart the system and then boot from the hard disk to test whether the system can be started normally.
The preceding section describes Linux rescue.