when DOS fdisk \MBR executes does it write the MBR according to
the geomentry of the specific disk ? Or can I copy the MBR from
another disk ?
All 5 of my IDE drives have become non-DOS-bootable.
Which is not a great problem, since I boot my prefered OS
(oberon: native or DOSbased or LinuxBased) and Linux via fd0.
When I tried to partition a friend's hda to take linux as well as his
W95, again his hda became non-DOS-bootable !
I used linux fdisk. I need to fix his disk !!
For some of the disks which I've investigated, DOS's fdisk doesn't
even see the device although the BIOS auto detect sees the correct
CHS, and linux or Oberon can read the various partitons & files.
A DOS 'officinado' tells me that if DOS-fdisk can't see it, I can't
restore the MBR ?
Since linux can extract the first sector with dd (and presumably
write a modified one) I should be able to create a MBR ?
I've also used DOS's debug.exe (remember this old utility) to:
* read the first sector
* disassemble it
* try to relate the contents to documentation on hand.
Questions:
Would ver 6.22 DOS debug.exe disassemble 3/4/5-86 code ?
Perhaps disks are pc compatible, hence must use only 8086 code
in the MBR ?
Thanks for any advice, also emailed to cg...@onwe.co.za
--Chris Glur.
> Hi,
>
> when DOS fdisk \MBR executes does it write the MBR according to
> the geomentry of the specific disk ? Or can I copy the MBR from
> another disk ?
MS-DOS command "fdisk /mbr", not "\MBR", writes the Microsoft boot
loader to the first 446 bytes of absolute sector 0 on the hard drive.
It does nothing to the next 64 bytes, which is the partition table.
The last 2 bytes on that sector are aa55, which is the code identifying
it as a boot sector.
BIOS executes the boot loader, the boot loader finds the first
partition which is marked "active", loads the first sector from that
partition to memory and executes it. That sector must also have aa55
in its last 2 bytes.
IIRC MS-DOS-6.22 was released prior to Intel's release of the i486 CPU.
Its version of debug can disassemble i386 code. But you really have
no need for such tools to fix the MBRs. Just run the fdisk command
correctly.
Actually, I think it'd give a message similar to "Invalid argument."
Perhaps you meant "FDISK /MBR"?
If you use the undocumented /MBR switch to FDISK.EXE, the first 446
bytes of the first sector on the disk are overwritten and replaced with
a "standard" DOS bootsector. It doesn't overwrite the partition table
or otherwise fiddle with it. This standard DOS bootsector examines the
partition table, finds the first primary partition that's marked active,
then loads the first sector from that partition and executes it. Under
DOS and derived (Lose9x/ME) the first sector of the DOS partition
contains the first sector of IO.SYS.
> Or can I copy the MBR from another disk ?
Not the entire MBR, just the first 446 bytes.
> All 5 of my IDE drives have become non-DOS-bootable.
> Which is not a great problem, since I boot my prefered OS
> (oberon: native or DOSbased or LinuxBased) and Linux via fd0.
That's not a great idea. Floppies die, and they're slow.
> When I tried to partition a friend's hda to take linux as well as his
> W95, again his hda became non-DOS-bootable !
> I used linux fdisk. I need to fix his disk !!
Booting DOS and derived systems from LILO or GRUB is covered extremely
well in several HOWTOs. If you've got a Linux/DOS dual-boot
system, the best thing to do is to have LILO or GRUB boot both OSes.
You can do this all from Linux.
> For some of the disks which I've investigated, DOS's fdisk doesn't
> even see the device although the BIOS auto detect sees the correct
> CHS, and linux or Oberon can read the various partitons & files.
> A DOS 'officinado' tells me that if DOS-fdisk can't see it, I can't
> restore the MBR ?
Not with FDISK, you can't. Fortunately, you can get a valid DOS MBR by
doing "dd if=/dev/hda of=/somewhere/dos.mbr.raw bs=446 count=1" if you
have a /dev/hda with a valid DOS MBR on it. Reverse the if= and of=
arguments to put this valid DOS MBR anywhere.
> Thanks for any advice, also emailed to cg...@onwe.co.za
You mailed a copy of this Usenet post to yourself? Or are you trying to
say, "Please CC: me a copy of any replies,"? If it's the latter,
there's a time-honored tradition in Usenet that goes, "Post here, Read
here." If your NNTP feed is flaky, then
http://groups.google.com/advanced_group_search is very nice for tracking
down posts you made and any replies.
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /
http://www.brainbench.com / "He is a rhythmic movement of the
-----------------------------/ penguins, is Tux." --MegaHAL
<dancesw...@usa.net> wrote:
> If you use the undocumented /MBR switch to FDISK.EXE, the first 446
> bytes of the first sector on the disk are overwritten and replaced with
> a "standard" DOS bootsector. It doesn't overwrite the partition table
> or otherwise fiddle with it. This standard DOS bootsector examines the
> partition table, finds the first primary partition that's marked active,
> then loads the first sector from that partition and executes it. Under
> DOS and derived (Lose9x/ME) the first sector of the DOS partition
> contains the first sector of IO.SYS.
> > All 5 of my IDE drives have become non-DOS-bootable.
> > Which is not a great problem, since I boot my prefered OS
> > (oberon: native or DOSbased or LinuxBased) and Linux via fd0.
> That's not a great idea. Floppies die, and they're slow.
I'll die before the M$-MBR/fdisk/LILO mess is replaced/fixed !
Life is too short for cosmetics, and I only opened this canOworms
because I 'damaged' some one elses hda.
> Booting DOS and derived systems from LILO or GRUB is covered extremely
> well in several HOWTOs. If you've got a Linux/DOS dual-boot
> system, the best thing to do is to have LILO or GRUB boot both OSes.
> You can do this all from Linux.
Yes. I get the impression that each author is writing his interpretation
of the previous author's interpretation/guess. The ones that originally
probed reality with an osilloscope are dead.
Here's some evidence: (don't you love gpm & mc ?)
Sun Apr 28 15:30:51 2002
-- this is a 'working' W95 single partiton machine seen by mulinux via fd0:-
00000 EB 58 90 4D 53 57 49 4E 34 2E 31 00 02 08 20 00 .X.MSWIN4.1... .
00010 02 00 00 00 00 F8 00 00 3F 00 40 00 3F 00 00 00 ........?.@.?...
00020 01 F0 3E 00 B9 0F 00 00 00 00 00 00 02 00 00 00 ..>.............
00030 01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00040 80 00 29 F8 07 47 3A 4E 4F 20 4E 41 4D 45 20 20 ..)..G:NO NAME
00050 20 20 46 41 54 33 32 20 20 20 FA 33 C9 8E D1 BC FAT32 .3....
00060 F8 7B 8E C1 BD 78 00 C5 76 00 1E 56 16 55 BF 22 .{...x..v..V.U."
00070 05 89 7E 00 89 4E 02 B1 0B FC F3 A4 8E D9 BD 00 ..~..N..........
00080 7C C6 45 FE 0F 8B 46 18 88 45 F9 38 4E 40 7D 25 |.E...F..E.8N@}%
00090 8B C1 99 BB 00 07 E8 97 00 72 1A 83 EB 3A 66 A1 .........r...:f.
000A0 1C 7C 66 3B 07 8A 57 FC 75 06 80 CA 02 88 56 02 .|f;..W.u.....V.
000B0 80 C3 10 73 ED BF 02 00 83 7E 16 00 75 45 8B 46 ...s.....~..uE.F
000C0 1C 8B 56 1E B9 03 00 49 40 75 01 42 BB 00 7E E8 ..V....I@u.B..~.
000D0 5F 00 73 26 B0 F8 4F 74 1D 8B 46 32 33 D2 B9 03 _.s&..Ot..F23...
000E0 00 3B C8 77 1E 8B 76 0E 3B CE 73 17 2B F1 03 46 .;.w..v.;.s.+..F
000F0 1C 13 56 1E EB D1 73 0B EB 27 83 7E 2A 00 77 03 ..V...s..'.~*.w.
00100 E9 FD 02 BE 7E 7D AC 98 03 F0 AC 84 C0 74 17 3C ....~}.......t.<
00110 FF 74 09 B4 0E BB 07 00 CD 10 EB EE BE 81 7D EB .t............}.
00120 E5 BE 7F 7D EB E0 98 CD 16 5E 1F 66 8F 04 CD 19 ...}.....^.f....
00130 41 56 66 6A 00 52 50 06 53 6A 01 6A 10 8B F4 60 AVfj.RP.Sj.j...`
00140 80 7E 02 0E 75 04 B4 42 EB 1D 91 92 33 D2 F7 76 .~..u..B....3..v
00150 18 91 F7 76 18 42 87 CA F7 76 1A 8A F2 8A E8 C0 ...v.B...v......
00160 CC 02 0A CC B8 01 02 8A 56 40 CD 13 61 8D 64 10 ........V@..a.d.
00170 5E 72 0A 40 75 01 42 03 5E 0B 49 75 B4 C3 03 18 ^r.@u.B.^.Iu....
00180 01 27 0D 0A 49 6E 76 61 6C 69 64 20 73 79 73 74 .'..Invalid syst
00190 65 6D 20 64 69 73 6B FF 0D 0A 44 69 73 6B 20 49 em disk...Disk I
001A0 2F 4F 20 65 72 72 6F 72 FF 0D 0A 52 65 70 6C 61 /O error...Repla
001B0 63 65 20 74 68 65 20 64 69 73 6B 2C 20 61 6E 64 ce the disk, and
001C0 20 74 68 65 6E 20 70 72 65 73 73 20 61 6E 79 20 then press any
001D0 6B 65 79 0D 0A 00 00 00 49 4F 20 20 20 20 20 20 key.....IO
001E0 53 59 53 4D 53 44 4F 53 20 20 20 53 59 53 7E 01 SYSMSDOS SYS~.
001F0 00 57 49 4E 42 4F 4F 54 20 53 59 53 00 00 55 AA .WINBOOT SYS..U.
-------------------------------
This is an old Conner 80m which complains: 'no OS' & can't fdisk.exe via A:
00000 EB 3C 90 4D 53 44 4F 53 35 2E 30 00 02 04 01 00 .<.MSDOS5.0.....
00010 02 00 02 1B A0 F8 28 00 11 00 09 00 11 00 00 00 ......(.........
00020 00 00 00 00 80 00 29 02 0D 3E 39 4E 4F 20 4E 41 ......)..>9NO NA
00030 4D 45 20 20 20 20 46 41 54 31 36 20 20 20 FA 33 ME FAT16 .3
00040 C0 8E D0 BC 00 7C 16 07 BB 78 00 36 C5 37 1E 56 .....|...x.6.7.V
00050 16 53 BF 3E 7C B9 0B 00 FC F3 A4 06 1F C6 45 FE .S.>|.........E.
00060 0F 8B 0E 18 7C 88 4D F9 89 47 02 C7 07 3E 7C FB ....|.M..G...>|.
00070 CD 13 72 79 33 C0 39 06 13 7C 74 08 8B 0E 13 7C ..ry3.9..|t....|
00080 89 0E 20 7C A0 10 7C F7 26 16 7C 03 06 1C 7C 13 .. |..|.&.|...|.
00090 16 1E 7C 03 06 0E 7C 83 D2 00 A3 50 7C 89 16 52 ..|...|....P|..R
000A0 7C A3 49 7C 89 16 4B 7C B8 20 00 F7 26 11 7C 8B |.I|..K|. ..&.|.
000B0 1E 0B 7C 03 C3 48 F7 F3 01 06 49 7C 83 16 4B 7C ..|..H....I|..K|
000C0 00 BB 00 05 8B 16 52 7C A1 50 7C E8 92 00 72 1D ......R|.P|...r.
000D0 B0 01 E8 AC 00 72 16 8B FB B9 0B 00 BE E6 7D F3 .....r........}.
000E0 A6 75 0A 8D 7F 20 B9 0B 00 F3 A6 74 18 BE 9E 7D .u... .....t...}
000F0 E8 5F 00 33 C0 CD 16 5E 1F 8F 04 8F 44 02 CD 19 ._.3...^....D...
00100 58 58 58 EB E8 8B 47 1A 48 48 8A 1E 0D 7C 32 FF XXX...G.HH...|2.
00110 F7 E3 03 06 49 7C 13 16 4B 7C BB 00 07 B9 03 00 ....I|..K|......
00120 50 52 51 E8 3A 00 72 D8 B0 01 E8 54 00 59 5A 58 PRQ.:.r....T.YZX
00130 72 BB 05 01 00 83 D2 00 03 1E 0B 7C E2 E2 8A 2E r..........|....
00140 15 7C 8A 16 24 7C 8B 1E 49 7C A1 4B 7C EA 00 00 .|..$|..I|.K|...
00150 70 00 AC 0A C0 74 29 B4 0E BB 07 00 CD 10 EB F2 p....t).........
00160 3B 16 18 7C 73 19 F7 36 18 7C FE C2 88 16 4F 7C ;..|s..6.|....O|
00170 33 D2 F7 36 1A 7C 88 16 25 7C A3 4D 7C F8 C3 F9 3..6.|..%|.M|...
00180 C3 B4 02 8B 16 4D 7C B1 06 D2 E6 0A 36 4F 7C 8B .....M|.....6O|.
00190 CA 86 E9 8A 16 24 7C 8A 36 25 7C CD 13 C3 0D 0A .....$|.6%|.....
001A0 4E 6F 6E 2D 53 79 73 74 65 6D 20 64 69 73 6B 20 Non-System disk
001B0 6F 72 20 64 69 73 6B 20 65 72 72 6F 72 0D 0A 52 or disk error..R
001C0 65 70 6C 61 63 65 20 61 6E 64 20 70 72 65 73 73 eplace and press
001D0 20 61 6E 79 20 6B 65 79 20 77 68 65 6E 20 72 65 any key when re
001E0 61 64 79 0D 0A 00 49 4F 20 20 20 20 20 20 53 59 ady...IO SY
001F0 53 4D 53 44 4F 53 20 20 20 53 59 53 00 00 55 AA SMSDOS SYS..U.
So yes. Last 2 bytes are 55 AA.
But 446 = 019E hex, and for both hdas the 4 records starting at
019D are text ?
When I look deeper into dissasembling the machine code, I see
there's downloading and *relocating* of binary.
Dave Uhring <dmuh...@yahoo.com> wrote:
> IIRC MS-DOS-6.22 was released prior to Intel's release of the i486 CPU.
> Its version of debug can disassemble i386 code. But you really have
> no need for such tools to fix the MBRs. Just run the fdisk command
> correctly.
Been there, done that, no succcess.
This is a job for the virus hackers ?
Thanks,
Chris Glur.
PS. I'm increasingly confused. Here are some more 1st sectors (all don't
DOSboot any longer). { See what nice stuff you get from oberon at a
fraction of the size of Linux}
Partitions.ShowBlocks IDE0#00 0 2 ~
IDE0#00 0 == Seagate ST340016A
00000000 EB 3E C0 8E D0 BC 00 7C 8B F4 50 07 50 1F FB FC .>.....|..P.P...
00000010 ...
00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 01 ................
000001C0 01 00 06 FE FF FE 3F 00 00 00 00 C5 FA 00 00 00 ......?.........
000001D0 C1 FF 83 FE FF FF 3F C5 FA 00 C3 1C 20 00 00 FE ......?..... ...
000001E0 FF FF 83 FE FF FF 02 E2 1A 01 E6 00 19 00 00 FE ................
000001F0 FF FF 05 FE FF FF E8 E2 33 01 D9 AE 74 03 55 AA ........3...t.U.
-----
Partitions.ShowBlocks IDE1#00 0 2 ~
IDE1#00 0 == westerndigital WDC WD84AA
00000000 33 C0 8E D0 BC 00 7C FB 50 07 50 1F FC BE 1B 7C 3.....|.P.P....|
00000010 ...
00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 01 ................
000001C0 01 00 06 0F FF FE 3F 00 00 00 D1 BB 0F 00 00 00 ......?.........
000001D0 C1 FF 83 0F FF FF 10 BC 0F 00 60 02 19 00 00 0F ..........`.....
000001E0 FF FF 83 0F FF FF 70 BE 28 00 90 83 25 00 00 0F ......p.(...%...
000001F0 FF FF 05 0F FF FF 00 42 4E 00 10 BA AD 00 55 AA .......BN.....U.
-----
Partitions.ShowBlocks IDE0#00 0 2 ~
IDE0#00 0 == FUJITSU MPA3052AT
00000000 FA EB 6C 00 00 00 4C 49 4C 4F 01 00 14 00 5A 00 ..l...LILO....Z.
00000010 ...
00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000001B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 01 ................
000001C0 01 00 06 0E FF FE 3F 00 00 00 10 C0 0E 00 00 00 ......?.........
000001D0 C1 FF 82 0E FF FF 4F C0 0E 00 99 83 01 00 00 0E ......O.........
000001E0 FF FF 83 0E FF FF E8 43 10 00 E6 00 19 00 00 5A .......C.......Z
000001F0 01 A8 05 FE BF 7D CE 44 29 00 30 20 73 00 55 AA .....}.D).0 s.U.
In all cases & 510dec: 55 aa
BTW. in all cases linux and oberon show valid FAT partitions and size OK eg.
Disk: IDE0, 5006MB, FUJITSU MPA3052AT
IDE0#00 5006MB --- (Whole disk)
IDE0#01 472MB 6 * DOS FAT16 >= 32M
IDE0#02 48MB 130 Linux swap
....
Disk: IDE1, 8063MB, WDC WD84AA
IDE1#00 8063MB --- (Whole disk)
IDE1#01 503MB 6 * DOS FAT16 >= 32M
IDE1#02 800MB 131 Linux fs
....
IDE1#22 16MB 76 |Native Oberon, Aos
IDE1#23 4078MB --- |(Free)
Either your Windows Setup floppy is buggered or you are not following
instructions. Boot the Windows floppy and
A:\> fdisk /mbr
A:\> fdisk
and set the partitions correctly, making sure that the Windows
partition (C:) is marked "active".
If the drives have Linux installed on them then boot from the install
CD, enter rescue mode, chroot according to the instructions, run fdisk
if necessary, edit /etc/lilo.conf as required, and execute /sbin/lilo.
The MBR, which is sector 1, head 0, cylinder 0, contains 512 bytes of
data:
446 bytes is the boot loader put in place for Windows with "fdisk /mbr"
and for Linux with /sbin/lilo
64 bytes is the partition table put in place with fdisk
2 bytes is the boot sector code 55 AA
If all this is too complicated then you have to seek the assistance of
someone in your neighborhood who knows what he/she is doing. Nobody on
Usenet can possibly do this work for you.
>When I tried to partition a friend's hda to take linux as well as his
>W95, again his hda became non-DOS-bootable !
>I used linux fdisk. I need to fix his disk !!
Did your friend create a Win95 boot diskette?
>
>For some of the disks which I've investigated, DOS's fdisk doesn't
>even see the device although the BIOS auto detect sees the correct
>CHS, and linux or Oberon can read the various partitons & files.
>A DOS 'officinado' tells me that if DOS-fdisk can't see it, I can't
>restore the MBR ?
I'm not a low level hw afficionado but playing around with
partitioning and installs on a few PC OS I've noticed that
there are some differences or nuances between the
various implementations of "Dos" fdisk. So as a general
rule I recommend, if possible, to use the fdisk that came
on the system, be it Dos or Windows, to do fdisk /mbr.
Just boot the guy's Win95 boot disk to run the command.
Also it's not a bad idea, if you can, to save stuff like partition
info, CMOS settings etc.. so if you hose the guy's system
you have a chance to boot up to default bios settings,
restore CMOS and restore the partition table. Sounds
like a lot but for instance CMOS SAVE utility and the
info it saves is very small and can be added to the
boot diskette.
Good luck.
Mike
--
"I don't want to belong to any club that would have me as a member."
-- Groucho Marx
cg...@onwe.co.za wrote:
>
> > Been there, done that, no succcess.
> > This is a job for the virus hackers ?
> Either your Windows Setup floppy is buggered or you are not following
> instructions. Boot the Windows floppy and
>
> A:\> fdisk /mbr
> A:\> fdisk
1. IDE does not (yet) belong to winblows ! Ie. IDE must be pc-DOS
readable ?
2. since you refuse to accept that an IDE which can be read/written
by linux and oberonOSs, can fail DOS-fdisk, I note that Seagate
has "fail fdisk" as a node on their diagnostic flow chart - with a
procedure to fix it.
3. I don't have a Windows floppy, since I've never (nor care to)
installed W9x.
> and set the partitions correctly, making sure that the Windows
> partition (C:) is marked "active".
>
> If the drives have Linux installed on them then boot from the install
> CD, enter rescue mode, chroot according to the instructions, run fdisk
> if necessary, edit /etc/lilo.conf as required, and execute /sbin/lilo.
All this happens only after the IDE can accept fdisk /mbr and/or fdisk
> The MBR, which is sector 1, head 0, cylinder 0, contains 512 bytes of
> data:
>
> 446 bytes is the boot loader put in place for Windows with "fdisk /mbr"
> and for Linux with /sbin/lilo
> 64 bytes is the partition table put in place with fdisk
> 2 bytes is the boot sector code 55 AA
If you understood my previous post, you'd know that I've read the
first sector, by both linux and oberon, and presented it in hex form
for analysis. And confirmed the: 466 + 64 +2 plus a lot more !
> If all this is too complicated then you have to seek the assistance of
> someone in your neighborhood who knows what he/she is doing.
> Nobody on Usenet can possibly do this work for you.
Although I didn't want to have to know these details, at this stage, I
believe I have deeper knowledge of MBR than you.
Repeating what others have written is no substitute for working
down at binary level; although I really hoped to avoid this.
BTW I've got Seagate's diagnostics which I'll run when I can get
access to a W32 machine (only their SCSI diagnostics run on linux).
Thanks,
Chris Glur.
PS. what I did learn from 'Crows' is that I can still 'catch' the
Newsthread on hi-volume groups like comp.os.linux.misc
by using google.