MBR sector is also known as the main boot sector, a total of 512 bytes, not only the system contains the boot program data 446 bytes, as well as the entire hard disk partition table records. When the primary boot sector fails, the boot menu cannot be entered to load the system. The following begins the experiment of making a backup of the MBR sector, simulating destruction, repairing.
First prepare a hard disk to do MBR sector data backup, use the Fdisk tool to view the hard disk list information, and then use the Fdisk tool to plan the new hard disk/DEV/SDB partition, SDB hard disk is divided into SDB1 partition.
The experimental steps are as follows:
The first step is to start backing up the MBR sector data
The input DD command backs up the MBR sector of the first hard disk SDA to the SDB1 partition of the second hard drive and mounts it to the/backup directory.
Second step, simulating MBR sector failure
Still enter the DD command to read 512 bytes of data from the device file zero. , overwriting it to the first hard drive SDA, which artificially overwrites the records of the MBR sector, thereby destroying the data in the MBR sector.
Once this is done, restarting the Linux system, unable to find an available operating system, will not start the host.
Step three, recover MBR sector data from backup files
Since the MBR sector is destroyed and the Linux system cannot be booted from the hard disk, it is necessary to boot from the operating system on the other hard disk, so you need to obtain a shell environment that can execute the command and recover the data from the MBR sector from the backup file. The operation steps are as follows.
First, when the Installation Wizard interface appears, select "Rescue installed system" to boot the Linux system from the CD in First aid mode.
Then press ENTER to select the default language, keyboard format, prompt to configure the network card when you select "No", select "Continue" Confirm and continue, next appears rescue window, click "OK".
Then go to the Bash shell environment with the "bash-4.1#" prompt, mount the hard disk partition sdb1 that saved the backup file, and restore the data to the hard disk "/DEV/SDA". After the recovery operation is complete, exit the temporary shell environment by executing the exit command.
Finally, the reboot command is executed and the system restarts automatically.
In general, the way to solve the problem of MBR sector is generally: make a backup file in advance to install the CD-ROM boot into the first aid mode, recover from the backup file.
Linux excludes MBR sector failures