Re: Writing a correct MBRfrom User Mode

V.V.Gatt_at_nospam.com
Date: 03/01/04


Date: Mon, 1 Mar 2004 09:31:13 -0800


>Subject: Re: Writing a correct MBRfrom User Mode 2/29/2004 6:16 PM PST
>>By: Rhett Gong [MSFT] (search by author)
>>Hi VV,
>Could you check following articles to see if it could help you in some way?
>>Since your problem is raised by your deleting the linux partitions and recreate a new partition under Win2K/XP, I suggest you taking a look at following article
>to see if it could help.
>[Removing the Linux LILO Boot Manager--This article describes how to remove the LILO boot manager from the Master Boot Record (MBR).]
>http://support.microsoft.com/default.aspx?scid=kb;en-us;171611

This helps somewhat, but as I need the operation to be unattended, this is not a solution.
My users won't have the possibility to use a DOS based system.
>>For more information about fdisk/mbr in the KB article above:
>[FDISK /MBR Rewrites the Master Boot Record]
>http://support.microsoft.com/default.aspx?scid=kb;en-us;69013
>>thanks,
>Rhett Gong [MSFT]
>Microsoft Online Partner Support
>>This posting is provided "AS IS" with no warranties, and confers no rights.
>Please reply to newsgroups only. Thanks.
>>Subject: Re: Writing a correct MBRfrom User Mode 2/29/2004 7:45 PM PST
>>By: Phil Barila
>>> This problem did never happen when using the TextBased setup, yet it is
>> not obvious that it will never happen, we could not perform enough tests
>> with Text Based setup, and we must be able to create an correct set of
>> MBR/BootSectors under Windows.
>>So do you want to do it unattended, or do you want to attach it to a Windows
>box and use the GUI Disk Management MSC? You can't have it both ways.
>Which do you want?

In fact, what I want:
The user used DiskManagement to create a system partition on a secondary disk.
This disk's MBR must be correct, what ever its previous step was.
>>>From your complaints, it appears that your process is to install the disk
>into a working Windows, repartition and quick format, then take it out, put
>it into a new system and install windows on it.

That is quite right, except that the system will already be installed on the
disk at the end of the operation, no need for a new install on the disk !

>If that's the case, you
>don't need it. Just put it in the new system and install. If you can't
>boot the system from a CD, there are lots of ways to boot directly from a
>network, or even boot and start a network from a floppy.
>
...
>>>> I already looked at these, but I suspect that in fact, diskmanager uses
>> these IOCTLs and then I won't be able to do very better than what MS does.
>>Keep in mind that Disk Manager is not attempting to create a bootable
>partition, since it already has one.

I guess you mean "create a correct MBR", because, in fact, DiskManager creates
a bootable partition. Being bootable means that the partition
is activated, that the partition BootSector is correctly written in the partition first sectors
and that the needed files and components of the OS to be booted are available.

OK then, how can I be sure that the MBR is correctly written on an extra disk
(not the system disk actually used to boot the OS) ?

>It's just creating a disk that it can
>use. Why it apparently does a Read Modify write operation on the MBR,
>instead of completely specifying the MBR, I'm not sure, unless it was an
>attempt at generalizing code which might have to leave some existing
>partitions in place.

But DiskManagement DOES modify some of the MBR (the partition table
for instance), but does not modify entirely the executable portion of the MBR.
>>On the other hand, the text mode setup must create a bootable partition, so
>I would expect it to ensure that by writing a bootable MBR. Any reason why
>you don't use the automation support in Windows Setup to unconditionally
>allocate everything on the disk?

This is not an option either. I cannot disclose too much of the process, but
using the standard Windows Installation (from the Windows CD-ROM) is not
an option.
>>> I planned to use direct access (opening \\.\PhysicalDriveX) and write by
>> myself the executable portion of the MBR in sector 0. Yet, I would like to
>> know WHERE I can find a binary source for this code. I know where to find
>> the binary sources for FAT32 and NTFS BootSectors but not for the MBR...
>> Anyone knows where I can dig this binary information ?
>>Read Sector 0?

If I am sure that the exectutable portion of the MBR in current booted disk can be duplicated on the extra disk, I plan to do so.

>>Phil
>--
>Philip D. Barila Windows DDK MVP
>Seagate Technology, LLC
>(720) 684-1842
>



Relevant Pages

  • Re: xp on intel Mac from usb stick?
    ... Would it be possible to run windows xp native from a usb stick? ... A custom slipstreamed CD is required to install XP on a Mac. ... partition managers but if you're feeling adventurous you may ... This procedure WILL WIPE YOUR iMAC DISK CLEAN. ...
    (comp.sys.mac.apps)
  • Re: Cloning a disk using dd
    ... It seems to have cloned the MBR correctly and the partition layout ... inaccessible boot disk error. ... The drives have to be almost identical to work, ... especially with Windows in the mix. ...
    (comp.os.linux.misc)
  • Re: Move space from one partition to another
    ... Which partition contains Windows XP Pro? ... To increase you free space on your Windows XP partition select Start, ... Programs, Accessories, System Tools, Disk CleanUp, More Options, System ... Create a My Documents folder in another partition and copy the ...
    (microsoft.public.windowsxp.general)
  • Re: 2 versions of win2000 on disk
    ... I have windows200 and winnt on disk, ... either boot the Windows 2000 install CD-Rom or setup ... existing partition, If you press D to delete an existing partition, you must ...
    (microsoft.public.win2000.general)
  • Re: New HDD Installation
    ... Right clicking on the partition or using the | Action> All Tasks menu at the top of the console should show the option, either greyed out or usable to make the partition active. ... Do the fixboot and fixmbr things in the Recovery Console then see if things change. ... There are other ways to mark the partition active, either with a Windows 98 startup disk or using the DISKPART command while in Windows XP. ...
    (microsoft.public.windowsxp.general)