embed a MBR into a NTFS disk

Nov 6, 2009 at 8:21 AM


when I add the MBR BootCode byte[] via the NTFS Format function of DiscUtils build 33883, it is not included into the MBR of the vhd.
The later extracted MBR has only \0 at the BootCode part (first 440 Byte).

Here the format call:

private string VolumeLabel = "BlaFoo";
private byte[] MBR = { 0x33, 0xC0 .... <508 0xXX> ... 0x55 0xAA };

PhysicalVolumeInfo[] pvi = VolumeManager.GetPhysicalVolumes(vhdDisk);
vhdFs = NtfsFileSystem.Format(pvi[index], VolumeLabel, MBR);

Ciao Ephraim

Nov 8, 2009 at 3:30 PM

Hi Ephraim,

I think you've got MBR and windows boot code confused.  For an example of specifying the MBR code, partitioning a disk and then formatting a partition, see the OSClone sample utility.



Dec 3, 2009 at 12:18 PM
Edited Dec 3, 2009 at 12:19 PM

Hey Ken,

once again, thanks for your answer. I misunderstood the bootCode parameter of the format function and formatted a physical volume and not the logical :(

Thanks for your help!

Ciao Ephraim