Post #127,120
11/21/03 3:45:31 PM
|
Repairing MBR from Linux
I've got my students working on their Linux networks and one on each team has to take their Linux box and re-load it as a dual-boot Win2K/Linux desktop. (I'm trying to demonstrate interoperability on mixed networks.)
Anyway, since the default RH install has us putting Grub into the MBR, we need to clear that out to load Win2K. I'd like to do this from Linux. I've given my students Knoppix CDs and persuaded them to use qtparted to re-do the partitions, but there doesn't seem to be an easy tool to clean out the MBR.
I did a little googling and have come up with a possible answer, though:
dd if=/dev/zero bs=512 count=1 of=/dev/hda
I'm thinking that writing zeros to the first 512 bytes of the physical disk should do it. However, I'd like somebody here to check my work before we dive into this.
NOTE: I realize that a Windows boot floppy and FDISK /MBR three times will probably do it as well, but I'm trying to encourage the use of Linux (via the Knoppix or similar CD) as a cross-platform toolkit.
Tom Sinclair
Sometimes it's better to light a flamethrower than curse the darkness. -- (Terry Pratchett, Men at Arms)
|
Post #127,121
11/21/03 3:50:50 PM
|
Asking the wrong question, IMO
As a practical matter, no one who only has a Linux box wants to add Windows to it. It always goes the other way. And starting from a Windows box, Linux installers will offer to repartition and preserve the existing OS. Installing Windows tends to want to take over the whole disk.
Which doesn't answer your question at all, of course.
===
Implicitly condoning stupidity since 2001.
|
Post #127,161
11/21/03 7:12:30 PM
|
Understood
However, as this is a classroom situation, I wanted them to start with a Linux-only installation. Plus, only one member of the team does the dual-boot install and we don't know which one at the start of the term.
You raise a good point, though, in terms of real-world scenarios.
Tom Sinclair
The class was learning about some revolt in which some peasants had wanted to stop being peasants and, since the nobles had won, had stopped being peasants *really quickly*. -- (Terry Pratchett, Soul Music)
|
Post #127,165
11/21/03 7:27:42 PM
|
Re: Asking the wrong question, IMO
Actually I did just that today :) I was upgrading (finally) my old Windows 98 install after Peter goaded me, and had to remove evidence of other operating systems - so I installed, booted from a rescue floppy, and was back in business.
-drl
|
Post #127,130
11/21/03 4:45:39 PM
|
The way I would do it
keep in mind that I am a noob to Linux, but the way I would do it is to use KNOPPIX CFDISK to create a new partition and make that partition as active before installing W2K to it. Then after installing W2K, mark the partition that has GRUB on it as Active and point GRUB to load the partition on the W2K partition. Also I would most likely make all Linux partitions as "Hidden" before doing a W2K install. Then unhide them afterwords.
But hey, I am a complete Linux f*ckwit, what do I know? ;)
"Lady I only speak two languages, English and Bad English!" - Corbin Dallas "The Fifth Element"
|
Post #127,162
11/21/03 7:15:11 PM
|
We're okay on the partitioning
qtparted seems to handle that bit just fine.
I was just trying to confirm what FDISK /MBR actually does. If it clears the contents of the MBR, then using dd to write 0s there should work.
Tom Sinclair
He did of course sometimes have people horribly tortured to death, but this was considered to be perfectly acceptable behaviour for a civic ruler and generally approved of by the overhelming majority of citizens. [footnote: The overhelming majority of citizens being defined in this case as everyone not currently hanging upside down over a scorpion pit] -- (Terry Pratchett, Sourcery)
|
Post #127,175
11/21/03 8:04:37 PM
|
No, FDISK /MBR does more than that.
It puts a little pre-loader in there. This looks at the partition table and finds out which partition is marked as Active, then loads the first sector from there as a boot sector.
If you want to dual-boot, you will probably want GRUB or LILO in there, anyway. They are far more capable than Microsoft's MBR pre-loader. So if Windows doesn't stomp on it, leave GRUB there. But before you start the Windows install, configure GRUB to know about booting the Windows partition.
Wade.
Is it enough to love Is it enough to breathe Somebody rip my heart out And leave me here to bleed
| | Is it enough to die Somebody save my life I'd rather be Anything but Ordinary Please
| -- "Anything but Ordinary" by Avril Lavigne. |
|
Post #127,192
11/21/03 8:58:28 PM
11/22/03 10:23:22 AM
|
For Windows 9x, I would agree
My understanding (I'm not a Windows pro) is that Win2K gets all cranky if the MBR isn't available.
Per [link|http://www.linuxorbit.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=470|this article] it seems we have to install Win2K first, then let Linux and Grub pick up on the boot situation.
(Edited to change 'Morpock' to 'Morpork')
Tom Sinclair
No enemies had ever taken Ankh-Morpork. Well *technically* they had, quite often; the city welcomed free-spending barbarian invaders, but somehow the puzzled raiders found, after a few days, that they didn't own their horses any more, and within a couple of months they were just another minority group with its own graffiti and food shops. -- (Terry Pratchett, Eric)
Edited by tjsinclair
Nov. 22, 2003, 10:23:22 AM EST
|
Post #127,209
11/21/03 10:55:35 PM
|
Same but different
The DOSWIN boot sector says "go here and bootstrap io.sys". The NTX2000 boot sector says "go here and bootstrap ntldr". It's the same in practice - if you can dual boot 98 you can dual boot NTX2000 the same way. The thing on the screen comes from the acutal loader, not the boot sector. When you pick 9x from the NTX2000 menu, it bootstraps io.sys indirectly.
-drl
|
Post #127,216
11/22/03 12:09:14 AM
|
Hmmm.. that helps explain some stuff
Tom Sinclair
"Chain letters," said the Tyrant. "The Chain Letter to the Ephebians. Forget Your Gods. Be Subjugated. Learn to Fear. Do not break the chain -- the last people who did woke up one morning to find fifty thousand armed men on their lawn." -- (Terry Pratchett, Small Gods)
|
Post #127,232
11/22/03 6:23:19 AM
|
But that's not the MBR.
That's the OS boot sector. Different animal.
I've seen an MS MBR load a LILO boot sector from a Linux partition. Works flawlessly. Of course, the partition in question had to be a) a primary partition and b) marked as Active.
Then, too, the old DOS boot sector actually just loaded the first file from the root directory... :-) I remember in the days of boot floppies re-ordering the root directory entries and finding that that diskette no longer booted.
Wade.
Is it enough to love Is it enough to breathe Somebody rip my heart out And leave me here to bleed
| | Is it enough to die Somebody save my life I'd rather be Anything but Ordinary Please
| -- "Anything but Ordinary" by Avril Lavigne. |
|
Post #127,239
11/22/03 6:49:49 AM
|
point!
-drl
|
Post #127,218
11/22/03 12:31:05 AM
|
Morpock or Morpork?
Darrell Spice, Jr. [link|http://www.spiceware.org/cgi-bin/spa.pl?album=./Artistic%20Overpass|Artistic Overpass]\n[link|http://www.spiceware.org/|SpiceWare] - We don't do Windows, it's too much of a chore
|
Post #127,249
11/22/03 10:22:56 AM
|
Typo noted and corrected
Tom Sinclair
The question seldom addressed is *where* Medusa had snakes. Underarm hair is an even more embarassing problem when it keeps biting the top of the deodorant bottle. -- (Terry Pratchett, Soul Music)
|
Post #127,164
11/21/03 7:25:31 PM
|
Re: Repairing MBR from Linux
When you first install LILO, it writes the original boot sector (512 bytes) to a file called "boot.MMmm" where nnnn represents the disk/partition combination of the place it was installed, as UNIX device numbers (MMajor and mminor). When you do "lilo -u" it writes that file back - so if you preserve it (rename it bootsector.win say) you can always put it back with
lilo -u -s bootsect.win
If you install a new kernel and rerun lilo, the boot.MMnn file will get clobbered, so you have to preserve the original boot sector right after installing.
I don't know how GRUB works (and don't much care :). GRUB is a little pre-os so it may be more complicated.
-drl
|
Post #127,193
11/21/03 9:01:05 PM
|
Looks like FDISK /MBR
is our choice, then?
Damn.
Tom Sinclair
The question seldom addressed is *where* Medusa had snakes. Underarm hair is an even more embarassing problem when it keeps biting the top of the deodorant bottle. -- (Terry Pratchett, Soul Music)
|
Post #127,208
11/21/03 10:42:09 PM
|
Re: Looks like FDISK /MBR
You can make GRUB burrow into the nether regions and install LILO, which I would recommend anyway, because I have an absolutely irrational disgust for GRUB :) (based however on the sane principle that one should not have pre-OSes on one's machines, because it is ugly and inelegant.)
-drl
|
Post #127,217
11/22/03 12:11:09 AM
|
Well, the first step to healing
is admitting you have a problem.
>I have an absolutely irrational disgust for GRUB :)
Tom Sinclair
The question seldom addressed is *where* Medusa had snakes. Underarm hair is an even more embarassing problem when it keeps biting the top of the deodorant bottle. -- (Terry Pratchett, Soul Music)
|
Post #127,227
11/22/03 2:58:11 AM
|
what can I say - it just *sucks* :)
I sort of laughed and screamed at the same time when I saw GRUB. First of all, the "grand unified" physics theories are all horseshit, other than SU(5), second, it put a damn miniature Linux on my machine, third, the documentation was written by someone who failed English and probably everything else, fourth, LILO is almost as good as OS/2 Boot Manager :)
And the notation is stupid - ide(x,y) - don't put metachars in object names!!! IDIOTS!
:)
-drl
|