RHCE footprint: Fixed bad boot partitions and grub
Source: Internet
Author: User
Environment: The/boot partition is completely damaged, and the MBR is also damaged. (Rm-rf/boot; fdisk/mbr) 1. Fixed Grub: a. Start the disc and enter rescue mode. Keywords: linuxrescue. B. Enter the real system environment. Keywords: chroot/mnt/sysimagec. Install grub in the/boot partition. In this tutorial, the grub folder is installed under the boot partition, including the stag environment:
The/boot partition is completely damaged, and the MBR is also damaged. (Rm-rf/boot; fdisk/mbr)
1. Repair Grub:
A. Start the disc and enter rescue mode. Keywords: linux rescue.
B. Enter the real system environment. Keywords: chroot/mnt/sysimage
C. Install grub to the/boot partition. In this tutorial, the grub folder is installed under the boot partition, including stage1, stage2, and other files. Kewords: grub-install (hdx). If there is only one hard disk, It is 0. If you have multiple hard disks and the hard disk where the/boot partition is located is unknown, check fdisk-l first (the partition with the Id category of 83 and marked as Boot, and the hard disk)
D. Enter grub shell, keywords: grub.
E. Specify the root partition (that is, the boot partition) of grub ). Keywords: root (hdx, y). If there is only one hard disk, It is 0. If there are multiple hard disks and the hard disk where the/boot partition is located is unknown, refer to the fdisk-l check method above to obtain the x and y values. You can also press the tab key to view the hard disks and partitions detected by grub.
F. Install grub to MBR (actually copy stage1 to MBR ). Keywords: setup (hdx ).
2. Install kernel and initrd:
A. Attach the first disc. Keywords: # mdkir/mnt/cdrom; # mount-o loop/dev/hdc/mnt/cdrom
B. Find and install the rpm package of the kernel, and then install the vmlinuz, initrd, and other files required for the startup. Keywords: # cd/mnt/cdrom/Server; # rpm-ivh -- force kernel-2.6xxxxx.rpm
3. Create/boot/grub. conf. At least the following lines are required:
Timeout 5 # I think it is necessary not to enable it, but it cannot be automatically restarted.
Title RedHat Linux EL5 # title you can write any text, but this line is required.
Root (hdx, y) # note the space behind the root. For more information about x and y, see the preceding section.
Kernel/vmlinuz-2.6.18-8.el5 ro # standard installation, followed by a possible root = LABEL =/class options, but it is not actually necessary, and, on a system with raid + lvm configured, this option may cause the system to fail to start. The reason is that the root partition and its partition cannot be found. "/" Indicates the boot partition.
Initrd/initrd-2.6.18-8.el5.img # specifies the location of the initrd image file. "/" Indicates the boot partition.
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.