Jump to content

FixMBR


FastScan
 Share

Recommended Posts


If you want something that's already integrated with WINPE then you can use Diskpart's CLEAN command.

Diskpart /s foo.txt

<foo.txt>

sel dis 0

clean

ce par pri

active

assign

</foo.txt>

Upside: known good state to start your deployment/install

Downside: It destroys all partitions/data on the drive, so keeping existing data won't work.

...Further upside: No additional tools required. :)

Link to comment
Share on other sites

<sigh> Typed too fast. the foo.txt should read:

<foo.txt>

sel dis 0

cre par pri

active

assign

</foo.txt>

If the syntax looks weird, note: Diskpart accepts the first three letters of most commands in place of the full command.

select disk 0 == "sel dis 0"

create partition primary == "cre par pri"

etc..

Link to comment
Share on other sites

  • 1 month later...

I ended up in the same problem, but my experience is that the diskpart command doesn't insert the boot code into the MBR. That it leaves for the setup program.

I was using Win PE to create a primary partition on a disk, acitvate, assign it. Then formatted using format C: /fs:ntfs.

Lastly copying in a Windows Embeded XP installation to C:.

Would not boot, just booted to a black screen without any errors, hanging around :(

So it seems that diskpart does not insert the bootcode into the MBR, just defines the partitions.

fdisk /mbr wont work since it is a DOS (heaven forbid) utility.

I found some info on the Internet and set out to make my own utility to write boot code into the MBR. Was finished after a few hours, yesterday.

The utility is written for Win PE, and is tested in Win XP and Win PE. Should work with any version above NT 4.0, including W2K, Win 2003, XP.

Commands:

   MbrFix /drive <num> driveinfo              Display drive information
   MbrFix /drive <num> listpartitions         Display partition information
   MbrFix /drive <num> savembr <file>         Save MBR and partitions to file
   MbrFix /drive <num> restorembr <file>      Restore MBR and partitions from file
   MbrFix /drive <num> fixmbr                 Update MBR code to W2K/XP/2003
   MbrFix /drive <num> clean                  Delete partitions in MBR
   MbrFix /drive <num> readsignature {/byte}  Read disk signature from MBR
   MbrFix /drive <num> generatesignature      Generate disk signature in MBR
   MbrFix /drive <num> writesignature hex     Write disk signature to MBR
   MbrFix /drive <num> readstate              Read state from byte 0x1b0 in MBR
   MbrFix /drive <num> writestate <state>     Write state to byte 0x1b0 in MBR
   MbrFix /drive <num> drivesize              Returns drive size in MB as return value
   MbrFix volumeinformation driveletter       Get volume information for partition

fixmbr is the command to run. It do keep the partition table, so any partitions should stay! The readstate and writestate commands are meant to have a place to store a status number between 0 and 255, if you have no other place to store it during the installation phase. The state is stored in a byte not used for other purposes in the MBR.

Se the htm file in the zip-file.

Use at your own risk :)

3. december: Uploaded a new version of the program, which doesn't popup the HTML documentation everytime one make a typo. No functional changes!

9. september 2005: Uploaded a new version of the program. A couple of new commands, no other changes. About 1470 had downloaded the previous version!

MbrFix.zip

Edited by kaares
Link to comment
Share on other sites

  • 1 month later...

kaares,

very good tool, I made a few tests with it and it works like a charm.

I did my test on win2k.

I think it deserves to get "in the open".

Can you host it on some web page?

Or would you allow me to host it on mine?

I am going to write down a pseudo-GUI for it, I'll post it here as soon as it is done, but I would like to put it on my page together with your prog.

Here is a link to the other pseudo-GUI I have written:

http://home.graffiti.net/jaclaz:graffiti.n...ts/VDM/vdm.html

Cheers,

jaclaz

Link to comment
Share on other sites

  • 2 weeks later...
Nice idea to create a small GUI. Let us know when it's ready.
Ok, I'll post it as soon as I make it.
Have you sent a PM to kaares for hosting his tool ?

I'm not sure he will read your proposition on this forum. Only 2 posts 'til he joined MSFN.

Doh! Stupid of me, I'll PM him, you are right.

jaclaz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...