- Copy the start sectors, before the first partition: "
dd if=/dev/sdb of=/dev/sda bs=512 count=63". I could have just copied the MBR with "
- Run fdisk and delete the data partition from the new drive. As a side effect, this causes Linux to recognize the newly written partition table.
- Copy the system partition to the new drive: "
dd if=/dev/sdb1 of=/dev/sda1 bs=1M".
- Run fdisk and change the ID of the old drive. This is one of the advanced functions. There's a bug in fdisk: it doesn't save the partition table after this. To work around the bug, make another change. I set the type of the old system partition to NTFS hidden.
- Reboot into Windows. It should boot off the new drive and mount the partition there as the system partition.
- In Windows Disk Management, extend the new partition. Windows can always use more space, and new drives are usually bigger.
- Still in Disk Management, create the new data partition.
- Copy data to the new data partition.
- Remove the old hard drive. It is no longer needed.
dd if=/dev/sdb of=/dev/sda bs=1M".
When working with modern large hard drives and not moving partitions relative to the start of the disk, the NT boot sector doesn't need to be altered. If moving a partition (for example, to align it for Advanced Format on the new drive) it would be necessary to change "Number of Hidden Sectors" at offset 0x1C in the boot sector.
If the new drive fails, and the old drive has to be used again, the procedure is simple: just change the disk ID to its former ID and unhide the system partition.