embed a MBR into a NTFS disk

Nov 6, 2009 at 9:21 AM

Hey,

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

Coordinator
Nov 8, 2009 at 4: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.

Cheers,

Ken

Dec 3, 2009 at 1:18 PM
Edited Dec 3, 2009 at 1: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