Dd command, which is defined in manual as convertandcopyafile, is to convert and copy a file, which can be used to back up and convert data. If you enter: ddif =/dev/zeroof =/dev/hdabs = 500 MBcount = 1, the first MB of data on the hard disk will be deleted. It is very powerful and can be used to initialize the disk, it can also be used to back up key data, such as MBR input ddif =/dev/hdaof =/
Dd command, in manual, is defined as convert and copy a file, which is to convert and copy a file and can be used to back up and convert data.
If you enter dd if =/dev/zero of =/dev/hda bs = 500 MB count = 1, the first MB of data on the hard disk is deleted, this can be used to initialize disks or back up key data, such as MBR.
Enter dd if =/dev/hda of =/root/mbr. bak bs = 446 count = 1 to back up MBR (master boot record)
If indicates the input file, of indicates the output file, bs indicates the size of bytes, and count indicates the count.
After the backup is complete, you can delete the MBR and use the dd command.
Dd if =/dev/zero of =/dev/hda bs = 446 count = 1
It should be taken into consideration here. bs can only write 446. If you write 512, it will be troublesome. Even if you back up the first 512 data of the first IDE hard disk, do not write 512 here, or it will be difficult to fix it. I have tried VMware! Because the 64-byte (512-446) Partition Table cannot be found when chroot is repaired using the CD, it is natural that chroot/mnt/sysimage cannot be mounted to the original file system, but I think there should be other ways. Next time I ask Tang Sir, haha...
After the above commands are entered, the MBR will be cleared and the system will not be able to start after reboot. This is for sure!
Next, boot the system with a CD, enter the linux rescue at startup to enter the fault repair mode, and select the language or keyboard to disable the network, during this process, the system will prompt that the original file system is mounted to the/mnt/sysimage directory. To use the chroot command to mount the file system
Chroot/mnt/sysimage
Dd if =/root/mbr. bak of =/dev/hda bs = 446 count = 1
Reboot
After restarting, You can boot the system normally! This is part of RH_133 troubleshooting, but since we talk about the dd command, we should simply read it as an extension!