Booting Linux from Windows boot loader

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
Melmo
Posts: 18
Joined: Mon 26 Sep 2005, 08:25

Booting Linux from Windows boot loader

#1 Post by Melmo »

I thought you guys might find this interesting.

I've been playing with gentoo the last couple of months, and found a great how to, to get linux booting from the windows boot loader.

Install puppy in its own partion and when it comes to installing the bootloader (grub or Lilo),intsall it to the super node of the partition rather then the MBR (where it would write over the windows bootloader).

Before Rebooting

Assuming that your linux partition is /dev/hda2, use the dd command to made a direct copy of the supernode to file.
dd if=/dev/hda2 of=boot.lnx bs=512 count=1
This will create file called boot.lnx in your current working directory, copy this to the root directory of your windows partion or a floppy disk.

Now boot into window and edit the BOOT.INI (you will need to be an administrator to do this).

Assuming the Root directory of your windows partion is c:\, and you have copied the boot.lnx file here,

append to the end of the file
c:\boot.lnx="Puppy Linux"
Note the boot.ini file, should now look like:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
c:\boot.lnx="Puppy Linux"
Thats it!

When you reboot your computer, the windows boot loader will appear, with the choices.

Microsoft Windows 2000 Professional
Puppy Linux

will now appear, This has the added benefit of not interfering with windows, components such as hibernate and quickstart if you use these.

You will probably need to change the linux loader to choose linux by defult and have no boot delay.

It could be cool if these modifications were added to the install script, as if the person later decides they dont want linux, just remove the last line from the boot.ini file and they have a 'Pristine' windows system.

Enjoy

Melmo

designengineer
Posts: 84
Joined: Wed 18 Oct 2006, 13:13

#2 Post by designengineer »

I will try it. I currently boot from a floppy into Puppy and would like to try a non-Grub way.
One question: I have one hard drive with two partitions.
Windows on the "C" drive and Puppy on the "D" drive. I do not understand the Linux "hda" etc format. Can you tell me what would my "D" drive be called by Puppy.
Thanks.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#3 Post by Pizzasgood »

/dev/hda2

How it works is this:

first harddrive gets hda
second harddrive gets hdb
third gets hdc
etc.

Then, for each harddrive, it cycles through the partitions and sticks a number on the drive designation:
first partition on hda, thus: hda1
second partition on hda: hda2
etc.


Windows doesn't distinguish between drives and partitions, so what it sees as C and D could be two partitions on the same drive, or two drives. That means D is either hda2 or hdb1.


There is another complication. SATA drives use sd instead of hd. So on my computer, C is sda1.

Also, other drives can show up as hd, so my dvd burner is seen as hda.

Flash drives also get sd, so my USB drive gets sdb, and then if I plug in my mp3 player, it will get sdc.

Floppies get fd.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

Re: Booting Linux from Windows boot loader

#4 Post by rarsa »

Melmo wrote:will now appear, This has the added benefit of not interfering with windows, components such as hibernate and quickstart if you use these.
Quite interesting.

I had to add the HP QuickPlay partition to Grub but now starting QuickPlay is not as seamless as just pressing hte quick play button.

I'll give it a try :) Thank you.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

Auda
Posts: 131
Joined: Sun 08 May 2005, 20:08
Location: New Zealand ( Christchurchish )

#5 Post by Auda »

I dont know how xp does it but before that the order was:
A: & B: floppies or pseudo floppies
Next the primary partitions in first second third forth hard drives, then logical drives in order in the extended partitions on first second etc hard drives after that were driver driven drives like cd roms zip drives and ram drives in what ever order you put them.
I think that is right I know it was a head ache if you swapped a drive.
That means D is either hda2 or hdb1.


DOS/win98 wouldn't like hda2 as that would have to be a second primary partition on the same drive, xp is happy with it though.
hda2 could also be the extended partition and hda3 be the first logical drive in that partition dos/win98 and xp are both happy with that

my drive looks like this :
Device___Boot______Start______End______Blocks_______Id____System
/dev/hda1___*_______1_________255______2048256______b____W95_FAT32__________C:
/dev/hda2___________256_______3952_____29696152+____f____W95_Ext'd_(LBA)______Extended_partition
/dev/hda3___________3953______4239_____2305327+_____7____HPFS/NTFS__________G:_in_xp,_nothing_in_dos_/win98
/dev/hda4___________4240______4998_____6096667+_____83___Linux________________For_Puppy
/dev/hda5___________256_______3443_____25607578+____b____W95_FAT32__________D:
/dev/hda6___________3444______3935_____3951958+_____c____W95_FAT32__(LBA)____E:
/dev/hda7___________3936______3952_____136521_______82___Linux_swap_/_Solaris___Swap

I also have a second drive with ntfs with xp calls F: and win98 doesnt know about.
Fun isnt it ?

Auda

amish
Posts: 615
Joined: Sun 24 Sep 2006, 23:15

#6 Post by amish »

just a note, windows nt/2k/xp don't rely on drive letters interally the way dos/98 did.

rather they assign drive letters superficially to make things a little more "transparent" (actually opaque) to the user. but you can switch the letters around, it means nothing until you're using the shell/file manager/command interpreter. windows simply numbers partitions, not totally unlike a posix compliant system (it even claims to be posix compliant. if that's the case, i have no idea what it means.)

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#7 Post by Pizzasgood »

DOS/win98 wouldn't like hda2 as that would have to be a second primary partition on the same drive, xp is happy with it though.
hda2 could also be the extended partition and hda3 be the first logical drive in that partition dos/win98 and xp are both happy with that
Aye. I forgot about that extended layer of complexity.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

DLWood
Posts: 38
Joined: Wed 20 Sep 2006, 22:54

#8 Post by DLWood »

Thanks a bunch Melmo!!!! This thread came just in time as I was attempting a frugal install in hda2 for Puppy along side an existing Win2000Pro in hda1.

I couldn't get the frugal install to work, so I just did a normal HD install in hda2. After installing Grub to the MBR, it was all screwed up and wouldn't boot Win2000 anymore. I had to run the Windows repair console and fixed the boot & MBR.

This worked a treat. I saw the same (although much less clear) advice here:

http://www.windowsitpro.com/Article/Art ... .html?Ad=1


Thanks again, this forum is fantastic!! :D

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#9 Post by MU »

also the XP-installer might be interesting for frugal installations:
http://murga-linux.com/puppy/viewtopic.php?t=16041

Mark

DLWood
Posts: 38
Joined: Wed 20 Sep 2006, 22:54

#10 Post by DLWood »

Will this work for Win2000Pro as well, or just XP?

RazzBear
Posts: 24
Joined: Fri 30 Jun 2006, 10:01

Win Boot Loader

#11 Post by RazzBear »

Through some trial and error i have found that the above method works but only if using extfs2 or extfs3, for me it would not work with reiserfs or others.
Maybe the bootcode for the other file systems lies outside of the 512 bytes that you ask for in the dd command.
I have used this method sucessfully in winxp and win2k.

DLWood
Posts: 38
Joined: Wed 20 Sep 2006, 22:54

#12 Post by DLWood »

MU wrote:also the XP-installer might be interesting for frugal installations:
http://murga-linux.com/puppy/viewtopic.php?t=16041
Sorry to be confusing....I meant, does this XP-installer work also for Win2000, or just XP?

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#13 Post by MU »

For older versions, it was reported that it works.
Seems to work on NT-based windows-versions, that support a boot.ini (different to the 9x versions, that used autoexec.bat).

Mark

Mordor
Posts: 22
Joined: Fri 09 Mar 2007, 23:06

#14 Post by Mordor »

Is it possible to boot Puppy on a Flash drive from Windows Bootloader?

Currently I'm booting Windows from a Flash drive. What I'd like to do is to install Puppy (full install) into another Flash drive and then add a grub entry to Windows bootloader and boot Puppy from that drive.

For now, I was able to do the same thing with a frugal install on the hard drive. Here is my menu.lst

title puppy2
rootnoverify (hd1,0)
kernel (hd1,0)/vmlinuz root=/dev/ram0 PMODE=idehd PMEDIA=idehd PDEV1=hda1
initrd (hd1,0)/initrd.gz
boot

But I don't know how Grub refers to flash drives. Would I enter (hd2,0) or (sd2,0) ? Is there a command that shows the USB drives available to Grub?

Bruce B

#15 Post by Bruce B »

My main reason for posting is to point out that the technique in the parent post is, among other things, very useful for saving boot sectors across all partitions.

Normally, one doesn't need to restore a damaged boot sector. However some viruses mess with boot sectors, as well as so-called trustworthy software companies like Intuit and some others.

For example: installing Intuit's QuickBooks 2007 knocks out Windows Vista activation.

------

Changing subject again, in order to add to the discussion about how DOS or Windows letters partitions. Here it goes.

The first primary partition on the first drive will get c:

If there are other drives, the first primary partition on those drives will be lettered d:, e:, f: according to the number of drives

After the first primary partitions are lettered, DOS / Windows goes back and assigns letters to the logical partitions in the extended partition. The first logical drive will get the next available letter, until all the logical drives extended partitions are lettered on that drive

Then the OS moves to the next drive and starts assigning letters according to the next available letter on those drives' extended partitions.

Then if there are other primary partitions which are not the first primary partitions, the OS starts lettering them next starting with the first drive.

My wording may seem a bit complicated, so I will illustrate by example, supposing all the partitions are visible to the OS:

/dev/hda1 c: (primary)
/dev/hda2 t: (unhidden primary)
/dev/hda3 u: (unhidden primary)
/dev/hda4 extended partition and no letter
/dev/hda5 f: (logical)
/dev/hda6 g: (logical)

/dev/hda7 h: (logical)
/dev/hda8 i: (logical)
/dev/hda9 j: (logical)

/dev/hdb1 d: (primary)
/dev/hdb2 v: (unhidden primary)
/dev/hdb3 w: (unhidden primary)
/dev/hdb4 extended partition and no letter
/dev/hdb5 k: (logical)
/dev/hdb6 l: (logical)
/dev/hdb7 m: (logical)
/dev/hdb8 n: (logical)

/dev/hdc1 e: (primary)
/dev/hdc4 extended partition and no letter
/dev/hdc5 o: (logical)
/dev/hdc6 p: (logical)
/dev/hdc7 q: (logical)
/dev/hdc8 r: (logical)
/dev/hdc9 s: (logical)

ramdisks and cdrom drives come after the hard drives are lettered

Here is what Microsoft says if you're interested, but I warn you, if you think my post was hard to read, read the official documentation.

Default Drive Letters and Partitions in Windows NT
http://support.microsoft.com/kb/q93373/


Order in Which MS-DOS and Windows Assign Drive Letters
http://support.microsoft.com/kb/51978

In summary, I can look at Windows drive letters and not be able to tell you the Linux partition.

Conversely, if I run Linux fdisk -l, I can tell you exactly how Windows letters the partitions.

The habit I've learned is to give Windows partitions volume labels the Linux scheme, i.e., hda6, hdb7, etc.

----------------
Changing the subject, would one of you gurus please show me an example of how to restore a saved boot sector?

basslord1124
Posts: 73
Joined: Tue 12 Dec 2006, 03:11

#16 Post by basslord1124 »

This the method of dual booting I use and it has yet to fail me. Good idea to post this for any one else who wants to try it.
[url=http://groups.myspace.com/puppylinux]The Official Myspace Puppy Linux Group[/url]

Post Reply