Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

FixMBR

- - - - -

  • Please log in to reply
62 replies to this topic

#1
FastScan

FastScan
  • Member
  • 3 posts
Im doing unattended installs from WinPE and I have a need to write a fresh MBR during the process. Anyone know of a tool that runs inside of WinPE that will do this?

thanks!


How to remove advertisement from MSFN

#2
edg21

edg21

    Member

  • Member
  • PipPip
  • 196 posts
Gdisk32.exe from Norton Ghost should do the trick.

http://service1.syma...00030715304425/
"Hey baby, wanna kill all humans?"
HowTo: Unattended Install Using FTP

#3
ChrisBaksa

ChrisBaksa

    Member

  • Member
  • PipPip
  • 230 posts
The Powerquest (now symantec) PQI Deploy Toolkit has a tool that will do it.

If you are doing Xp, then Ghost is fine. But if you are doing servers... you'll need adifferent tool. Ghost is not supported on servers.

Chris

#4
manofdos

manofdos
  • Member
  • 4 posts
fdisk /mbr will do the trick.

#5
ribond

ribond

    pope of preinstall. wizard of winpe. bender of things.

  • Member
  • Pip
  • 51 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. :)

#6
ribond

ribond

    pope of preinstall. wizard of winpe. bender of things.

  • Member
  • Pip
  • 51 posts
<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..

#7
kaares

kaares
  • Member
  • 4 posts
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!

Attached Files


Edited by kaares, 09 September 2005 - 01:32 AM.

Kaare S.
(A lot of english-speaking mistakes me for a woman because of my name!)

#8
Jotnar

Jotnar

    Member

  • Member
  • PipPip
  • 186 posts
I know alot of people will be happy to have this functionality inside PE. Thanks!

#9
likuidkewl

likuidkewl

    [Centos~]$

  • Member
  • PipPipPipPipPip
  • 960 posts
This looks to be a great program! I know it would have been handy for me the other week. I will definately try it and give some info on it. Thanks again, hope to see more of you in the forums.
BLOG...

#10
ChrisBaksa

ChrisBaksa

    Member

  • Member
  • PipPip
  • 230 posts
I use one that we wrote internally as well (sick options and functionality) but corporate guidelines prohibit the distribution of the app.

Chris

#11
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts

I know alot of people will be happy to have this functionality inside PE.  Thanks!

Thanks kaares for joining MSFN forum and post this tool. I will keep it that can help a lot.
And welcome to MSFN forum.
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#12
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,212 posts
  • OS:none specified
  • Country: Country Flag
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...ts/VDM/vdm.html

Cheers,
jaclaz

#13
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts
@jaclaz

Nice idea to create a small GUI. Let us know when it's ready.

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.
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#14
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,212 posts
  • OS:none specified
  • Country: Country Flag

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

#15
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,212 posts
  • OS:none specified
  • Country: Country Flag
OK, guys, here it is:
MBRfix GUI.

Enjoy!

jaclaz

Attached Files



#16
TWiST

TWiST

    Newbie

  • Member
  • 32 posts
Gotta love corporate policy, I know I do. :rolleyes:

#17
manofdos

manofdos
  • Member
  • 4 posts
Boot from a 98 boot disk or the windows 98 cd and run fdisk /mbr. Way easier than learning new utils.

#18
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts

Boot from a 98 boot disk or the windows 98 cd and run fdisk /mbr. Way easier than learning new utils.

Only your 4th post and very valuable input. I will keep your awesome method with my floppyless and CDless notebook. :whistle:
RIS + WinPE or PXELinux is my only way to install / repair / fix problems on my notebook
@jaclaz
Thanks !
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#19
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,212 posts
  • OS:none specified
  • Country: Country Flag

Boot from a 98 boot disk or the windows 98 cd and run fdisk /mbr. Way easier than learning new utils.


By the way, the Windows 98 fdisk /mbr command will write, guess what, a Win98 MBR, NOT a NT/Win2k/XP/2003 one.

The only ways to write a new NT/Win2k/XP/2003 MBR I know of, apart the utility from Kaares here are:
1) Microsoft's FixMBR (that will run in the Recovery Console only)
2) Ranish partition manager (that will work from DOS only) which writes a standard IPL code, not the win2k one

You can extract the MBR IPL code from files on your Win2k/XP and write it manually with an Hex/disk editor:
http://therdcom.com/...br/Win2kmbr.htm

The very good utility MBRwizard by Roger Layton can read (and store) MBR data, then can write it from the stored file, but it DOES NOT create it as the above two do.
To edit/replace the BOOT RECORD (not the MBR) there is this fine Bootpart by Gilles Vollant (that will have direct disk access under DOS only), that works on FAT volumes.


A further step could be to make an unified GUI for the three of them:
Bootpart
MBRfix
MBRwizard
and for some other related utility, so that you have a complete repair solution.

Every suggestion is welcome.

jaclaz

#20
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts
@jaclaz

I really like all the answers you give to us. There are well documented and you don't forget to add link for valuable infos.

Great !
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#21
dman

dman

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 717 posts
thank you kaares for mbrfix. great tool. I made small launcher-gui with vb6 for BartPE.
see next post

#22
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 768 posts
@dman

What is the
Run-time error '380':
invalid property value

I would like to try your GUI under Windows 2000.
comdlg32.ocx is in my %systemroot%\system32 dir and is registered.
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#23
sixpack

sixpack

    Senior Member

  • Member
  • PipPipPipPip
  • 515 posts
Run-time error '53'
Never say, "Oops!" always say, "Ah, interesting!"

#24
dman

dman

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 717 posts
The version of vmbrfix.exe and bat file I posted last night has hard coded paths specific for BartPE. I changed to relative pathing so you should be able to run from anywhere now (must be in path with no long directory names, though), and "should" work under win2k. please let me know.

dman

reposted 2-02 3:15pm - several small changes
reposted 2-02 6:17pm - added "about" box
reposted 2-03 9:25am - added error handler

Attached Files



#25
sixpack

sixpack

    Senior Member

  • Member
  • PipPipPipPip
  • 515 posts
sorry still Run-time error '53'
Never say, "Oops!" always say, "Ah, interesting!"




1 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


    Baidu (1)


How to remove advertisement from MSFN