DD 克隆/恢复 Linux 分区

The MBR is stored in the the first 512 bytes of the disk. It consist of 3 parts:

  • The first 446 bytes contain the boot loader.
  • The next 64 bytes contain the partition table (4 entries of 16 bytes each, one entry for each primary partition).
  • The last 2 bytes contain an identifier

Clone the MBR as mbr.img:

dd if=/dev/sdX of=/path/mbr_file.img bs=512 count=1

Clone partition as pX.img

dd if=/dev/sdX of=/path/pX.img bs=1024

Restore the MBR to new disk

dd if=/path/mbr_file.img of=/dev/sdY bs=512

Restore Partition to new disk

dd if=/path/pX.img of=/dev/sdX bs=1024