An NTFS partition has a BIOS Parameter Block at its start where one field (a DWORD at offset 0x1C, the "Number of Hidden Sectors") says where on the disk it is located.
You must either (a) restore the partition at the exact same sector in the harddisk, or (b) patch this field (writing number in Little-Endian style), if you want to boot from it.
E.g. to state that a partition is loaded at sector 63 (default in XP), use:
echo 63 | gawk '' | dd bs=1 count=4 seek=28 of=/dev/sda1
where /dev/sda1
is the partition in question.
You can use fdisk
to view current partitions:
# fdisk -l /dev/sda ... Device Boot Start End Blocks Id System /dev/sda1 * 321300 192089204 95883952+ 7 HPFS/NTFS/exFAT /dev/sda2 192089210 408998834 108454812+ 7 HPFS/NTFS/exFAT /dev/sda3 409001982 625141759 108069889 5 Extended /dev/sda4 63 321299 160618+ 83 Linux ... # dd bs=1 count=4 skip=28 if=/dev/sda1 | hd ... 00000000 14 e7 04 00 ...
In this example I have NTFS partition /dev/sda1 (with Win Vista) at sector 321300 (0x0004e714).