linux dd命令

dd if=/dev/hda of=disk.mbr count=1 bs=512

It copies 1 chunk of 512 bytes which is the amount of info that the MBR of the disk takes.

and for restoring the MBR:
dd if=disk.mbr of=/dev/hda

It overwrites the first 512 bytes of your /dev/hda drive.

Just another command that I use to do afterwards for saving the partitions:

sfdisk -d /dev/hda > disk.sf
It dumps the partitions of the /dev/hda disk to a text file, which you’ll be able to recover easily.
sfdisk /dev/hda < disk.sf

猜你喜欢

转载自j4s0nh4ck.iteye.com/blog/2217518