[vox-tech] rescuing winxp? (resolved)
Peter Jay Salzman
p at dirac.org
Fri Sep 24 11:50:57 PDT 2004
On Fri 24 Sep 04, 11:21 AM, Rick Moen <rick at linuxmafia.com> said:
> Quoting Peter Jay Salzman (p at dirac.org):
>
> > I remember Rick Moen's post about the bootable flag from a few years ago.
> >
> > Rebooted Knoppix. Ran fdisk.
> >
> > I toggled the bootable flag on hda4 so now hda1 is the ONLY partition with
> > the bootable flag turned on. Previously, both hda1 and hda4 had the
> > bootable flag.
> >
> > Rebooted.
> >
> > Worked.
>
> Congrats. Yeah, the nameless Microsoft Corp. MBR first-stage bootloader
> is really fussy about that flag. It wants to see the flag on exactly
> one primary partition, and upon seeing that loads whatever is in sector
> zero of that partition into RAM and hands over control of it. Woe and
> betide unto you if you don't give it the partition-flag situation it
> expects.
>
> Note that reinstalling a Microsoft OS always causes it to reassign the
> bootable flag to what _it_ wants, silently discarding whatever your own
> policy dictated -- and also overwrites (without consulting you) the
> MBR sector's program space (initial 446 bytes). For example:
>
> Suppose your booting strategy is to allow the nameless Microsoft Corp.
> MBR program its preferred hegemony over your MBR's program space, and
> use lilo in the /dev/hda2 superblock to select which OS to boot. Before
> Linux installation, you have:
>
> /dev/hda1 bootable (aka active) flag NTFS
>
> After Linux installation, you have:
>
> /dev/hda1 NTFS
> /dev/hda2 bootable (aka active) flag ext3
> /dev/hda3 Linux swap
One of the things I was considering before the inspiration of looking at the
boot flag hit me was to use Partition Magic to shave off a bit off the D
drive to form a new partition, and use Knoppix to install lilo.
And then let lilo boot XP. :)
> The Int13 boot routine finds the first ready drive device, loads its
> sector zero into RAM, and transfers control over to whatever was found
> there. In this example, it found your hard drive's MBR (446 bytes of
> program space, 64 bytes of partition table, 2 bytes of flags used by NT
> Disk Administrator and little else). Thus, the nameless Microsoft
> program wakes up, rummages through its data space (partition table + 2
> bytes), and finds the third entry bearing a bootable flag. Not being
> confused and upset by multiple flagged entries ;-> , it loads into RAM
> sector zero of the partition thus described and reliquishes control to
> the contents thereof -- which happens to be lilo because you had
> "boot=/dev/hda1" in /etc/lilo.conf and ran /sbin/lilo to implement that
> directive.
I didn't know the numbers, but I'm thinking maybe this is something I should
either memorize or write down. Let me see if I get this straight. At the
beginning of the hard drive:
bytes offset Description
1 - 446 0 - 445 MBR / zeroth order boot loader
447 - 510 446 - 509 partition table
511 - 512 510 - 511 NT Disk Administrator flags
On Linux, are the last 2 bytes unused? Most systems default to 1024 byte
blocks, right? What in the rest of the block?
Also, I should know this at this stage in the game, but how can I use dd to
make a backup of just the 64 bytes of the partition table?
Thanks for the useful post!
Pete
--
Make everything as simple as possible, but no simpler. -- Albert Einstein
GPG Instructions: http://www.dirac.org/linux/gpg
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
More information about the vox-tech
mailing list