MBR corruption and grub.conf configuration file loss or error method

Source: Internet
Author: User

In the use of Linux process we may cause damage to the MBR, in my beginner's time, encountered this problem only re-install the system, now think really stupid enough. The following specifically demonstrates the specific practices of MBR corruption and grub.conf configuration file corruption or loss.


System RHEL6.6


Analog one: MBR corruption.

Use dd If=/dev/zero OF=/DEV/SDA count=1 bs=400 to destroy the MBR.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/40/wKiom1UCuFSBhsnqAACul9jO7zg084.jpg "title=" Qq20150313181322.png "alt=" Wkiom1ucufsbhsnqaacul9jo7zg084.jpg "/>


MBR damaged after rebooting the system will not enter, the default from the CD-ROM boot. 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/40/wKiom1UCul6jEAw8AAK_rHHHPqo307.jpg "title=" Qq20150313181741.png "alt=" Wkiom1ucul6jeaw8aak_rhhhpqo307.jpg "/>


Enter rescue mode, and chroot to the root partition, the specific entry is no longer demonstrated.

# Chroot/mnt/sysimage

Install the grub-install command to install grub,--root-directory specify the root,/dev/sda specify the disk.

# Grub-install--root-directory=//DEV/SDA

The system starts normally after a reboot.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/3B/wKioL1UCvc2zaDE5AAGstovwrxE584.jpg "title=" Qq20150313183144.png "width=" 642 "height=" 355 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:642px;height:355px; "alt = "Wkiol1ucvc2zade5aagstovwrxe584.jpg"/>


Analog 2:grub configuration file missing

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/41/wKiom1UCvlyhl1SaAAFEprAA21Y801.jpg "title=" Qq20150313183904.png "alt=" Wkiom1ucvlyhl1saaafepraa21y801.jpg "/>

Enter the grub shell directly after booting. Use Find (hd0,0)/Then the tab key to view the file of the disk partition referred to, (hd0,0) is the first partition of the first hard disk, you can see in the kernel file in this section.

Find (hd0,0)/Knock tab to view this partition file, the first partition of the first disk, my boot partition.

Root (hd0,0) specifies root, which is the location at startup, not the root partition.

KERNEL/VM-----Specify kernel file, the TAB key can be complete

Initrd/init------Specify INITRD file, the TAB key can be complete

Boot boot

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/3B/wKioL1UCxc6hrm9mAAKHnDsHp18614.jpg "style=" float: none; "title=" Qq20150313190313.png "alt=" Wkiol1ucxc6hrm9maakhndshp18614.jpg "/>



Error during startup, kernel panic, check carefully, noor empty root= argument does not specify the root disk partition, shutdown into grub re-specify OK. The specific process is in the next.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/41/wKiom1UCxKyCiKxPAAHEjhLrnCE088.jpg "style=" float: none; "title=" Qq20150313190531.png "alt=" Wkiom1ucxkycikxpaahejhlrnce088.jpg "/>



After the kernel/vmlinux------with ro (read-only, read-only) and root=/dev/sda2 Specify the root directory of the disk partition, using RHEL5 without specifying, here is the use of RHEL6.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/3B/wKioL1UCxc6w3nPXAAKz8IUPcis304.jpg "style=" float: none; "title=" Qq20150313190108.png "alt=" Wkiol1ucxc6w3npxaakz8iupcis304.jpg "/>

Boot can re-enter the system after return.

After entering the system, it is not finished, you need to rebuild the grub.conf configuration file, or the next re-righteousness will still enter the grub shell. This is no longer a demonstration.

MBR corruption and grub.conf configuration file loss or error method

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.