[Disk Management and partition]--MBR destruction and Repair

Source: Internet
Author: User

Destruction and recovery of gurb (recovery with backup body)
(1) Backup

DD if=/dev/sda of=grub.bak bs=446 count=1   // back up the bootstrapper portion of the MBR

(2) Destroying the first 446 bytes in the MBR

DD if=/dev/zero of=/dev/sda bs=446 count=1

(3) Restore the first 446 bytes of MBR

===> into rescue mode (at this point on the bootable CD, the system will mount our hard drive system to the/mnt/sysimage on the disc)

chroot // Enter the hard drive DD if=root/grub.bak of=/dev/sda bs=446 count=1// Restore Backup

Gurb Destruction and recovery (no backup body)
(1) Destroying the first 446 bytes in the MBR

DD if=/dev/zero of=/dev/sda bs=446 count=1

(2) Restore the first 446 bytes of MBR (the method of reloading the GRUB program)

===> into rescue mode

chroot /mnt/sysimage# Grub-Install /DEV/SDA

DPT Destruction and recovery (recovery with backup)
(1) Backup DPT
Note here: It is useless to put the backup on the current hard drive! Since we are going to destroy its partition later, the backup will be lost!
So you can choose to place the partition on another hard disk or on another computer or on an FTP server by:
A. Partitioning, formatting, and mounting another hard drive: fdisk/dev/sdb;mkfs.ext4/dev/sdb1;mount/dev/sdb1/mnt
B. SCP to another computer or upload an FTP server (step slightly)

DD if=/dev/sda of=/mnt/dpt.bak skip=446 bs=1 count=  //

(2) Destroy DPT

DD if=/dev/zero of=/dev/sda seek=446 bs=1 count=

Error 22 Errors When restarting after ===> is destroyed

(3) Restore dpt===> into rescue mode

(Note: Because SDA does not have a disk partition, the hard disk system does not automatically mount to the/mnt/sysimage under the disc, meaning that only the pseudo-root of the disc can be entered)

(Check the disk partition table of/DEV/SDA and/dev/sdb at this time, you will find that the SDA has not seen the disk partition, but SDB also maintains a DPT)

mkdir Mount /dev/sdb1 AA; ls  SCP [email protected]10.0. 2.253:/mnt/dpt.bak./
DD if=aa/dpt.bak of=/dev/sda seek=446 bs=1 count=// Restore Backup 



[Disk Management and partition]--MBR destruction and Repair

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.