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

Will an XP Repair Install mess up MBR?

- - - - -

  • Please log in to reply
27 replies to this topic

#1
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

I need to reinstall or repair-install XP Pro on a multibooting PC that also has Vista Business (32-bit) and Netrunner 12.12 (x64) on it. The booting process appears to be controlled by a version of GRUB that came into existence on my computer when I installed Netrunner (the third OS on the machine). If I reinstall or repair-install XP, will it screw up the MBR such that I'll lose the option to boot into Vista or Netrunner, or can I expect the MBR to be left alone by the XP reinstallation process?

 

Thanks!

 

--JorgeA

 




How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,211 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

A "normal" install of any MS system will always try to (and usually succeed  ;))  "take control" of the booting sequence.

Particularly an XP setup is made of 2 steps, the first one where the $WIN_NT$.~BT and $WIN_NT$.~LS are created on a hard disk volume and the second where files from it are actually booted from.

The usual procedure is:

  1. fully understand your current boot sequence
  2. save/backup, etc.
  3. install the Windows XP
  4. restore the previous situation

If you installed Netrunner, it is likely to be using either GRUB (the real. good ol' thing that the good Linux guy senselessly now call "GRUB legacy") or GRUB2 (the new thing that the good Linux guys senselessly now call GRUB, thus creating a lot of confusions/misunderstindings).

 

Procedure to restore/reinstall the one or the other is different, most probably Netrunner installer/.iso does have a "repair" provision, point is that it may not find your old configuration file (menu.lst or grub.cfg) and find only the just reinstalled XP, so that the result will be a dual boot XP/Netrunner and Vista will be inaccessible/unbootable.

 

I would personally make an "external" media (like a USB stick or a floppy, or even a CD) with grub4dos, NTLDR, NTDETECT.COM, BOOT.INI, BOOTMGR and /boot/BCD capable of booting all three systems as they are now, to be on the "safe side" and reinstall the XP only after you have tested and verified working this solution (BTW, I would have made this anyway, even if no reinstall of XP is foreseen/foreseeable).

 

jaclaz



#3
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

Thank you very much, jaclaz, this is a great help.

 

The XP partition (C: drive) and the Vista partition (F: drive) each have their own BOOTMGR file. Same size (326 KB) but different dates. Which one should I put on the boot CD that I'd be creating? (I'm guessing the one from the XP partition.)

 

--JorgeA



#4
bpalone

bpalone

    Member

  • Member
  • PipPip
  • 179 posts
  • Joined 04-March 09
  • OS:Windows 2000 Professional
  • Country: Country Flag

Donator

Yes, XP will leave you with a XP only boot option.  Jaclaz has a good suggestion.  Here is another option or maybe better said, a thought.  Use a live CD of most any flavor of Linux and use "dd" to copy the MBR to a safe place.  Then after the repair/reinstall, just reverse the process.   The Linux Journal had an article about this three or so years ago, so you could probably find how to use dd to this there.  I mentioned this on another thread here some time ago, maybe I'll go see if I can find it and post back.

 

 

Found the post and the link still works, so here it is: http://www.linuxjour...ter-boot-record

 

edit to place link to article.

 

bpalone


Edited by bpalone, 25 January 2014 - 10:32 AM.


#5
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,467 posts
  • Joined 14-September 05
  • OS:none specified
  • Country: Country Flag

Installation was in this order, correct?

1 - XP from Bootable CD

2 - Vista from Bootable DVD

3 - Netrunner from Bootable CD/DVD

None of which will "understand" time zones, only what's on the CD/DVD at the time of Build, wherever it was "built, and in the case of Windows will be "specifically" set using (usually) GMT/UTC as basis and a Time Zone Offset.

 

The one on "C-drive" (probably) came from the WinPE (within BOOT.WIM) and the one on the "F-drive" undoubtedly came from the INSTALL.WIM. A Binary Compare will probably reveal they're exactly the same.

 

Followup - bpalone just suggested something (before I posted). I might suggest that you get the whole front of the MBR/"Reserved" (sectors 0-62) since Netrunner "could" be using several sectors, and even made a "backup" of the original (Vista, since it was installed second) somewhere. :unsure:


Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#6
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

The "dd" method sounds conceptually simpler, thanks. Although I will still implement jaclaz's idea as a precaution, as a CD is "forever" (can't be erased by mistake).

 

An initial Web search for information on the Linux "dd" method led me to TestDisk, which apparently can be used to fix the MBR. Wonder if I could do the XP reinstallation with no preliminary steps, :ph34r: and then use TestDisk as needed.

 

--JorgeA


Edited by JorgeA, 25 January 2014 - 10:45 AM.


#7
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

Installation was in this order, correct?

1 - XP from Bootable CD

2 - Vista from Bootable DVD

3 - Netrunner from Bootable CD/DVD

 

Yup, that's exactly the order in which they were installed. The only (possible) difference from your description is that XP was factory-installed. The computer came with both XP and Vista disks. There is also a pre-installed D: recovery drive based on XP.

 

--JorgeA



#8
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

How about the instructions given in post #7 from this thread? They sound especially relevant because I'd be doing precisely what he says -- copying to the same disk with the same unchanged partitions.

 

--JorgeA


Edited by JorgeA, 25 January 2014 - 11:05 AM.


#9
bpalone

bpalone

    Member

  • Member
  • PipPip
  • 179 posts
  • Joined 04-March 09
  • OS:Windows 2000 Professional
  • Country: Country Flag

Donator

An initial Web search for information on the Linux "dd" method led me to TestDisk, which apparently can be used to fix the MBR. Wonder if I could do the XP reinstallation with no preliminary steps, ph34r.png and then use TestDisk as needed.

 

 

First rule to follow is number 1, which is Make Backups.  Rule Number 2. See Rule Number 1.

 

It is much less stressful, to have a good quality backup setting on a drive, disks or whatever.  Using a tool designed to help save data and installations as a front line defense item would make me quite nervous.  I don't know if you have ever experienced a hard drive failure or not. But, I have and it was a complete failure.  I had to to redo an entire years worth book keeping, because I didn't have a backup.  Needless to say, I came upon a whole new religion about the use of and necessity of backups.

 

Probably wouldn't hurt have the tool available, as you can't have to many tools.

 

bpalone



#10
bpalone

bpalone

    Member

  • Member
  • PipPip
  • 179 posts
  • Joined 04-March 09
  • OS:Windows 2000 Professional
  • Country: Country Flag

Donator

How about the instructions given in post #7 from this thread? They sound especially relevant because I'd be doing precisely what he says -- copying to the same disk with the same unchanged partitions.

 

--JorgeA

 

That is the correct answer.  I was assuming you were not going to be changing anything other than just repairing/reinstalling XP.  Speaking of that, be careful with using Vendors installation media.  I don't know if they did during the XP era, but I had an instance with a Windows 7 reinstallation that it took the ENTIRE disk without even asking.  I had pre-partitioned it to have a Linux partition and a NTFS Windows partition.  No data loss, just some time, but I was not a happy camper.

 

So to repeat myself:

 

1.) Make backups.

 

2.) See Rule Number 1.

 

bpalone



#11
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,467 posts
  • Joined 14-September 05
  • OS:none specified
  • Country: Country Flag

...and a Follow-Up - betting that your Restore (Recovery) Partition will no longer function because you have already wiped the Vendor-Specific MBR code, unless you can find a method of recreating it -or- knowing a method of utilizing the Restore Partition depending on the Image Type made by the Vendor.

 

 

The computer came with both XP and Vista disks. There is also a pre-installed D: recovery drive based on XP.

How odd, seeing as how it has the D-RecoveryPartition.

 

edit - typos.


Edited by submix8c, 25 January 2014 - 11:36 AM.

Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#12
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

 

First rule to follow is number 1, which is Make Backups.  Rule Number 2. See Rule Number 1.

 

 

Excellent advice, which I will follow.  :)

 

--JorgeA

 

P.S. I forgot to comment about HDD failures. I've had two of them (in laptops) in the last year, on different machines. Macrium Reflect (free edition) has been a very good friend in these cases. (OTOH, I had a Seagate Replica external drive which claimed to keep a "bare metal" image that could be restored if disaster struck. Well, disaster did strike my laptop and the Replica software was worthless. Macrium to the rescue!)
 


Edited by JorgeA, 26 January 2014 - 12:54 AM.


#13
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

...and a Follow-Up - betting that your Restore (Recovery) Partition will no longer function because you have already wiped the Vendor-Specific MBR code, unless you can find a method of recreating it -or- knowing a method of utilizing the Restore Partition depending on the Image Type made by the Vendor.

 

Huh, that's interesting. Good thing I have an image of that whole disk (all three OS's).

 

--JorgeA



#14
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,211 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

JorgeA

You seemingly miss some background.

A MBR is made of three main parts:

  1. CODE
  2. Disk Signature (only on NT based systems) (DATA)
  3. Partition Table (DATA)

A "normal" MBR has additionally these two characteristics:

  1. it is 512 bytes long (i.e. it fits entirely in the first sector)
  2. its only scope is to chainload the first sector (PBR) of the Primary partition marked as actiive in the partition table.

Booting sequence for a "normal" MBR:

BIOS->MBR->PBR of Active Primary partition->loader or system file->OS

In XP:

BIOS->MBR->PBR of Active Primary partition->NTLDR->BOOT.INI choices->NTDETECT.COM-> XP OS

In Vista:

BIOS->MBR->PBR of Active Primary partition->BOOTMGR->\boot\BCD choices->WINLOAD.EXE-> Vista OS

 

A Linux behaves differently.

The GRUB or GRUB2 can be installed BOTH to the MBR (but in this case it will take more than the first sector) or to the Volume/Partition (PBR).

IF the GRUB is installed to the MBR, it will look for it's own files, and then access it's configuration file (either menu.lst or grub.cfg) where the "choices" are. 

IF the GRUB is installed to the PBR, the MBR may remain a "normal" one, still only chainloading the PBR of the active partition, which will then load GRUB.

 

We have to understand if your MAIN bootmanager is currently the Vista BOOTMGR or either GRUB or GRUB2, and how EXACTLY they are set.

 

TESTDISK (as well as other data recovery oriented tools) will only care about the partition table of a MBR (completely ignoring both the code and the disk signature).

Of course any install will NOT change the partition table (nor the Disk Signature, unless it is empty or having a collision with another disk).

 

The XP install will change the CODE of the MBR, replacing it with a "normal" MBR simply chainloading the PBR of the active primary partition.

It will also change the CODE in the PBR writing one that will load NTLDR.

It will "keep" the contents of BOOT.INI.

 

But if you installed those three Operating Systems in that order, the Vista install will have:

  • replaced the MBR with some slighly different code (but that still chainloads the PBR of the active partition)
  • replaced the PBR code with one loading BOOTMGR
  • added to the \boot\BCD an entry corresponding to the one(s) you had before in BOOT.INI

The point is then which bootmanager Netrunner uses and HOW EXACTLY it was installed.

It could have been installed at least in two ways:

  1. to the MBR (and hidden sectors) and become the "main" bootmanager
  2. to the PBR (of another partition dedicated to the Linux OS) and added as an entry to the \boot\BCD

 

jaclaz 

 

 



#15
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,467 posts
  • Joined 14-September 05
  • OS:none specified
  • Country: Country Flag

Excellent explanation! (Keep it for future questions/reference)

...bearing in mind the OEM's "special" MBR Code is now long-gone with the advent of Vista's "replacement", hence the references to that "RecoverPartition" (possibly no longer "useable"). :unsure:


Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#16
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

Very well. The question then becomes: how to find out which of those two ways Netrunner used to install its boot manager. How do we do that?

 

As to which version of GRUB is in use, I'm thinking it must be GRUB2. The reason is that last year I had Zorin OS 5.2 installed in that Linux partition. The options during boot were different than they are now -- I remember that they gave both XP and Vista in the initial selection menu, but then also that if you selected the XP option from that menu, it would screw up the booting afterward. (If you wanted to go into XP, it was better to select Vista and then the "previous OS" option in the next menu.)

 

When I installed Netrunner 12.12 in place of Zorin 5.2, there was a new boot menu with more sensible (less dangerous) options: now in the first menu you select either Netrunner or "Vista," and then if you select the "Vista" option the next menu offers a choice of Vista or a "previous" version of Windows. So whether it's GRUB2 specifically I don't know, but it is definitely a different version, and a better one in that respect at least.

 

Hope this helps in our detective work.

 

--JorgeA



#17
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,211 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Hope this helps in our detective work.

 

--JorgeA

Not really (in detecting if it is GRUB or GRUB2) but it does tell us that your "main" bootmanager is the GRUB or GRUB 2, which has only two entries, one of which chainloads your secondary bootmanager (which is the Vista BOOTMGR).

But still you can get to the GRUB (or GRUB2) in two ways:

  1. GRUB (or GRUB2) code in the MBR + hidden sectors <- please read as "installed to the disk"
  2. "normal" MBR and GRUB (or GRUB2) code in the PBR of the active partition <- please read as "installed to the partition"

 

Now, HOW (EXACTLY) is your hard disk partitioned?

WHICH is the active partition?

Can you find (likely on the "Linux" partition) files core.img and grub.cfg (possibly in a \boot\ folder? <- this would mean that it is GRUB2 alright

 

jaclaz



#18
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,467 posts
  • Joined 14-September 05
  • OS:none specified
  • Country: Country Flag

Apologies for the "bump" again, but I felt it may be necessary to cross-post this. See my post#2.

http://www.msfn.org/...al-boot-with-7/

 

@jaclaz - please correct me if I'm wrong and (maybe) update the above fantastic sequence for posterity(?).


Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#19
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,211 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Apologies for the "bump" again, but I felt it may be necessary to cross-post this. See my post#2.

http://www.msfn.org/...al-boot-with-7/

 

@jaclaz - please correct me if I'm wrong and (maybe) update the above fantastic sequence for posterity(?).

Which "fantastic" sequence?

There is nothing fantastic in it, everything is very, very "normal".

There is also a nice graphical version of it:

http://www.multiboot.../multiboot.html

 

jaclaz



#20
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,467 posts
  • Joined 14-September 05
  • OS:none specified
  • Country: Country Flag

HAH! Noted! :thumbup


Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#21
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

 

Hope this helps in our detective work.

 

--JorgeA

Not really (in detecting if it is GRUB or GRUB2) but it does tell us that your "main" bootmanager is the GRUB or GRUB 2, which has only two entries, one of which chainloads your secondary bootmanager (which is the Vista BOOTMGR).

But still you can get to the GRUB (or GRUB2) in two ways:

  1. GRUB (or GRUB2) code in the MBR + hidden sectors <- please read as "installed to the disk"
  2. "normal" MBR and GRUB (or GRUB2) code in the PBR of the active partition <- please read as "installed to the partition"

 

Now, HOW (EXACTLY) is your hard disk partitioned?

WHICH is the active partition?

Can you find (likely on the "Linux" partition) files core.img and grub.cfg (possibly in a \boot\ folder? <- this would mean that it is GRUB2 alright

 

jaclaz

 

 

  • For the sake of completeness, I should report that the initial boot menu also contains three other choices: Netrunner with "advanced options" and then two memory test items.
  • With that out of the way, according to the KDE Partition Manager this is the info for the HDD. I don't think we can do tables on the forum here, but I'll do what I can.

 

PARTITION, TYPE, SIZE, FLAGS   [<--- REMARKS]

/dev/sda1, ntfs, 58.59 GiB, boot  <--- this is the XP partition (primary)

/dev/sda3, ntfs, 195.01 GiB, ---  <--- this is the Vista partition (primary)

/dev/sda4, extended, 28.49 GiB, ---  <--- this is the Netrunner partition, which contains the following two logical partitions --

  /dev/sda5, ext4, 25.53 GiB, ---  <--- this contains the Netrunner OS, applications, and data

  /dev/sda6, linuxswap, 2.96 GiB, ---  <--- self-explanatory

/dev/sda2, ntfs, 16.00 GiB, ---  <--- this is the HP Recovery partition (primary)

 

I can provide more details about these partitions if you need them.

  • Had to boot back into Windows to get the active partition information, but here it is: the XP partition is the active drive. Disk Management (in Vista) also reports that drive (C:) as "system," whereas the Vista partition (F:) is "boot." (Which seems to differ from what the KDE Partition Manager said, that the XP partition was "boot," but that may be simply because the Vista drive was the one I ultimately booted into today (?). :unsure: )
  • I did indeed find the two files, core.img (in boot > grub > i386-pc) and grub.cfg (in boot > grub), so according to what you said it must in fact be GRUB2.

Let me know what I need to do next, thanks!

 

--JorgeA



#22
jaclaz

jaclaz

    The Finder

  • Developer
  • 15,211 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
Well, not-so-surprisingly, Microsoft decided to use common terms the other way around from the rest of the world (or from elementary logic), JFYI:
http://www.multiboot....uk/system.html
 
A partition is marked as "boot" or "active" in the MBR, the way MS calls the partitions is simply one of the other ways they manage to make a mess of otherwise quite simple terminology.
 
Easiest would be to make a copy of :

1.first track (first 63 sectors, the GRUB2 will probably occupy only a bunch of them but it costs nothing to save the whole lot),
and a copy of relevant files from the various partitions:

2.from the first one: NTLDR, NTDETECT.COM and BOOT.INI
3.from the second one: BOOTMGR and the \boot\BCD folder
4.from the "linux" one, the whole /boot folder

The only item that you will actually need to restore after XP re-install/repair will be #1, but having a copy of the other items allows (in case of some unexpected issue) to fix the whole stuff anyway (or to create a "recovery media" as hinted earlier).

I hope you understand that since the time you installed any of those OS's you have most probably lost (possibly in a non recoverable way) boot-time access to the HP recovery partition (as hinted before by submix8c) don't you?

I would personally use dsfo from the DSFOK toolkit from the booted XP:
http://members.ozema...eezip/freeware/
to save those 63 sectors to a file, but you can well use any tool/utility with direct disk access that you may have handy or are more familiar with.

jaclaz

#23
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,467 posts
  • Joined 14-September 05
  • OS:none specified
  • Country: Country Flag

...and a Follow-Up - Lucky you! I may very well have an "original" HP MBR -CODE- if you ever need it, barring my being banned, croak, or get sent to an insane asylum.

 

FYI - Beware! Using -any- HP Recover Software within the Running XP will proably -not- work as your RecoveryParition is in a different location. Also, -if- it even worked then the MBR -CODE- could very well be overwritten with HP's "special" Code.

 

Jaclaz is, indeed, leading you in the correct direction. I will now bow out. Good luck. ;)


Edited by submix8c, 26 January 2014 - 04:42 PM.

Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#24
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

...and a Follow-Up - Lucky you! I may very well have an "original" HP MBR -CODE- if you ever need it, barring my being banned, croak, or get sent to an insane asylum.

 

LOL! But thanks. Hopefully we won't need it. As a Plan B (and C), I also have a set of Recovery Disks created via Windows, plus an image of the HDD.

 

Also, I appreciate the warning about that recovery partition. I shouldn't count on it. Maybe I should try and test it, to see what happens.

 

You're welcome to bow back in anytime.  :)  Thanks again.

 

--JorgeA



#25
JorgeA

JorgeA

    FORMAT B: /V /S

  • MSFN Sponsor
  • 3,453 posts
  • Joined 08-April 10
  • OS:Vista Home Premium x64
  • Country: Country Flag

Well, not-so-surprisingly, Microsoft decided to use common terms the other way around from the rest of the world (or from elementary logic), JFYI:
http://www.multiboot....uk/system.html
 
A partition is marked as "boot" or "active" in the MBR, the way MS calls the partitions is simply one of the other ways they manage to make a mess of otherwise quite simple terminology.
 
Easiest would be to make a copy of :

1.first track (first 63 sectors, the GRUB2 will probably occupy only a bunch of them but it costs nothing to save the whole lot),
and a copy of relevant files from the various partitions:

2.from the first one: NTLDR, NTDETECT.COM and BOOT.INI
3.from the second one: BOOTMGR and the \boot\BCD folder
4.from the "linux" one, the whole /boot folder

The only item that you will actually need to restore after XP re-install/repair will be #1, but having a copy of the other items allows (in case of some unexpected issue) to fix the whole stuff anyway (or to create a "recovery media" as hinted earlier).

I hope you understand that since the time you installed any of those OS's you have most probably lost (possibly in a non recoverable way) boot-time access to the HP recovery partition (as hinted before by submix8c) don't you?

I would personally use dsfo from the DSFOK toolkit from the booted XP:
http://members.ozema...eezip/freeware/
to save those 63 sectors to a file, but you can well use any tool/utility with direct disk access that you may have handy or are more familiar with.

jaclaz

 

This is great, thank you very much!

 

Since I'm not familiar (AFAIK) with any tool that provides direct disk access, I may as well start learning with the one you recommend.

 

--JorgeA






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users