If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

One line summary - Windows installed in Master drive, use BIOS to boot Slave ahead of Master, install Linux in the slave and use the slave's MBR to multi boot- to go back just reverse the boot sequence

Assuming the Windows is in the Master drive and boots up as normal to start with.

Use Bios to select the slave to boot ahead of the master drive so that Linux can be installed into the slave

Create a partition for the Linux and also a swap partition.

Instruct the installer to intall the Linux in pre-arranged partitions. Ask the bootloader to be install into the MBR which now goes only to the Slave disk. Linux can be installed and booted from either a primary or logical partition.

On reboot the Linux will be booted by its boot loader in the Slave's MBR. The Windows may need the disk order "re-mapped" before it can be booted.

If the Linux uses Grub make sure the following lines are in /boot/grub/menu.lst

The red statements "re-map" the 1st and 2nd disks "on-the-fly". Grub counts from 0 so (hd0) is the 1st bootable disk.

Anytime you don't want to see a trace of Linux just reverse the boot sequence in the BIOS.

Your Windows MBR in the master disk is untouched like a virgin.

Section B : Single hard disk with a floppy drive

One line summary - Use a fllopy or a CD to boot Linux. Windows automatically booted without the floppy or CD

Try to squeeze two partitions out of the hard drive. One for Linux in the second primary partition after Windows and one for swap which can be in a primary or logical partition. The write-up assumes Linux is in the second primary partition of the disk and so adjustment to the partition reference is needed if your case differs.

Assuming Windows installed first and working normally in the first primary partition.

Boot up the CD and install the Linux in the created second primary partition.

Must not allow Linux to place bootloader in MBR, instruct the installer to install its boot loader inside its root partition.

After the Linux installation completed and rebooted there should be no trace of Linux.

Having satisfied that only Windows is available without Linux go to distowatch to download a Live CD from either Mepis, Puppy, Ubuntu or Damn Small Linux and burn it into a CD.

Boot up this Live CD and ask Linux to report to you the directory it stores Grub's stage1 and stage2 files by this command

Code:

find / -name stage1

You then change directory to it and create a Grub bootable floppy unattached to an operating system by using Linux's dd command. I am using the directory location from Mepis Live CD but do adjust the directory name if you source the stage1 and stage2 from another Linux.

This Grub floppy can boot any PC system manually. I have not been able to find a PC operating system that cannot be booted by it. For laptop user you can generate the Grub floppy using a friends PC and burn the floppy into a CD using the method described at this site.

The Grub floppy (or CD) boot up a Grub prompt only but your Windows can be booted by the following instruction

Code:

root (hd0,0)
chainloader +1
boot

and your Linux too with the same instructions except you advance the partition reference by 1 as follow (Grub counts from 0 so (hd0,1) is the 2nd partition of the 1st disk)

Code:

root (hd0,1)
chainloader +1
boot

There may come a time you no longer wish to type the instruction manually. In such a case you put the Linux's own boot loader in a floppy when you are using the Linux.

Pop a floppy into the drive. If it uses Lilo your type

Code:

lilo -b /dev/fd0

If the Linux uses only Grub the equivalent command is

Code:

grub-install /dev/fd0

The second floppy can boot up the Linux without any typing.

So without the use of a floppy or CD Windows will boot. Put in the floppy or CD Linux boots up instead.

Your Windows MBR is untouched like a virgin.

Section C : Single hard disk and no fllopy drive

This is a technique of using Windows MBR to boot Linux ( or BSD or Solaris)

One line summary – Put Grub in a data-only Fat primary partition and switch on its booting flag. Windows MBR will faithfully load Grub into memory. Grub can then boot all systems installed in the PC

(A) Introduction

Windows MBR does not have a target to boot. It only searches from the 4 primary partitions of the bootable hard disk and loads the first one that has the booting flag switched on. One can make use of this behaviour to let it boot up GNU/Grub, a boot loader developed for Linux but can be installed without an operating system. If we put Grub into an “active” data-only Fat primary partition then Grub becomes available to multi boot other systems.

The write-up below is mainly for Linux as Grub is sourced from it. By expanding its booting menu Grub can be used boot 100+ systems. The booting of BSD and Solaris is not fully described here because the method is identical to the case of Grub booting a Windows. See above link for more explanations.

(B) Theoretical explanations of why the scheme works

(1) As a boot loader Grub is in binary pattern. It has no filing structure so it can be put into any filing system. Windows MBR boots a Fat partition which Linux can read and write.

(2) A data-only primary partition has no operating system inside and its reserved boot sector is unused and empty. Putting Grub there does no harm and creates no inconvenience.

(3) All Windows versions have a facility for marking another partition “active” and so it is possible to switch the booting alternative to a data-only primary partition. The data partition boots if Grub is installed inside.

(4) Grub is a rare boot loader that can be installed without an operating system.

(C) Necessary conditions

(1) The partition hosting Grub must be a primary type.

(2) The partition hosting Grub must be in Fat12, Fat16 or a Fat32 format. Linux does not yet write on NTFS partitions. Put Grub in a non-MS partition will not attract Windows MBR attention.

(D) Some known features

(1) For the purpose of hosting Grub the primary Fat partition can be very small. Only 3 files are needed; stage1 is 512 bytes, stage2 is less than 150 k bytes and menu.lst is a text file with only a few lines.

(2) For the hosting Grub only the fat partition is not subjected to the usual DOS restrictions, as no Dos system is used. Thus the Fat data-only partition can be created in a Sata disk and at the end of a 300Gb disk.

(3) The menu.lst in the data-only partition if omitted will force Grub to boot to a Grub prompt whereby the user has to boot up each system manually. The optional menu.lst is just a script file to execute the same commands automatically.

(E) Application area

The method outlined here enables a Windows user to install and boot up Linux , BSD and Solaris systems with absolutely no alteration to the Windows system and its MBR.

The method has been written to suit for PC users without access to a floppy drive.

(F) Implementation

(1) Resize the hard disk to make available unallocated space for about 6Gb. For first-timer a 5Gb partition for Linux, 0.5 Gb for Swap partition and 0.5 Gb for a data-only primary Fat partition. The latter can be omitted if there is an existing data-only primary partition available. Both Linux and Swap can be in logical partitions. Linux comes in more than one CD or in a DVD may need 10Gb on its own. Solaris may need 15Gb. Partition for a BSD is similar to a Linux. Solaris and BSD systems needed to be installed in primary partitions. The only exception I am aware of is NetBSD which can be accommodated in a logical partition.

(2) Download a Linux Live CD iso image and burn it into a CD. Ideal one should have “Grub” and “Qtparted” inside, like Kanotix or Knoppix. The Live CD can be used just as a tool and different to the one finally installed. The “Qtparted” can be used for resizing the hard disk and creating the necessary partitions. For the purpose of description I assume the disk is IDE type and so hda1 is the Windows, hda2 the data-only Fat partition, hda3 the Linux partition and hda4 the swap. Had the Linux and Swap been formed as logical partition it would be named automatically as hda5 and hda6, as the first 4 are reserved for primaries only. If the disk is a Sata type then all “hda” will have to change to “sda”. It is a good practice to reboot the system after partitions have been created. The other partitioning tools in Linux are the “fdisk” and “cfdisk” in command mode and they are more versatile in supporting Solaris and various BSD partition types.

(3) There is no need to format the two Linux partition as every Linux installer will want to do itself. Only the data-partition if created new will need to be formatted. This can either be done in Windows or in Linux Live CD. To format a Fat16 partition of hda2 in Linux terminal command is

Code:

mkdosfs –F16 /dev/hda2

(4) Install Grub into the data partition hda2. This is done by booting up with the Kantotix, which uses Grub as the boot loader, made a /mnt/hda2 directory, mount it and ask Kanotix to tell us where has it stored Grub’s stage1 (stage2 is always stored together with stage1).

Code:

mkdir /mnr/hda2
mount /dev/hda2 /mn/hda2
find / -name stage1

Kanotix should report back the files found in /KNOPPIX/lib/grub/x86_64-pc, so made a /boot/grub directory in /mnt/hda2 and copied the two files across.

if another Live CD is used just change the directory reported by your Live CD in the above two lines. It is essential that stage1 and stage2 to be stored only in the /boot/grub directory of hda2 because that is where Grub will look for them.

Now is the time to invoke a Grub shell inside Kanotix

Code:

grub

Grub can be formally set up inside hda2 by these commands in Grub shell

Code:

root (hd0,1)
setup (hd0,1)
makeactive

The last statement makes the PC boot hda2 instead of Windows in hda1.

(5) The system should be tested so that a user knows the basic steps to survive in booting. Reboot the system at this point will fire up Grub to a command prompt without any trace of Windows. Don’t panic as this is precisely what it should be. You can get your Windows back immediately by booting it manually with these line in Grub prompt

Code:

root (hd0,0)
makeactive
chainloader +1
boot

Since Windows partition becomes active rebooting the PC will return back to Windows and not Grub in the data-only hda2 partition. If you want to boot back to Grub in hda2 just do the following before you exit Windows

Click My Computer/Manage/Storage/Disk Management and then right click hda2 to select “to make partition active”

When you boot to Grub there is no system available except the commands in Grub prompt. You can make Windows partition active any time by the commands

Code:

root (hd0,0)
makeactive

To look at what commands you can use in Grub the command is “help”. To view the partitioning scheme of your hard disk you type “geometry (hd0)", to reboot just type “reboot” and to power down is “halt”.

(6) Although not straightly necessary it would be a “cool” thing to do by writing a booting menu yourself and have it ready before you even install the Linux. You can do this in Windows, use notepad only as the booting menu must be a text file called menu.lst in the \boot\grub directory of hda2 which should be your drive “D”. So just create \boot\grub\menu.lst with the following lines

This file should be in your “D” drive. If created it will be seen the next time when you boot up hda2. You can still use the Grub prompt by press “c”. Hda3 is not yet bootable because you have not yet installed a Linux inside hda3 yet.

(7) Now install a Linux (or Solaris or BSD) of your choice. Pay attention to the questions and instruct the installer to install the Linux into hda3. This is usually asking the installer using hda3 as the root “/” of the Linux. The installer should automatically know what to do with the swap partition. The critical issue in a Linux installation is to insist the boot loader to be installed in its root partition. Under no circumstance allow the boot loader go to the MBR. On completion of a full installation your Linux can be booted by the menu.lst you have created. Linux is born to multi boot. During installation it will check hda1 and hda2 and realise Windows MBR and Grub are inside respectively and so it could build up a menu to both these two partitions inside hda3. Thus you may end up hooping between hda2 and hda3 partitions and able to fire up Windows from either of them.

(8) The Linux you choose can have any type of boot loader. It can be a BSD, a Solaris or a Darwin x86. As long as you deny the system to install its boot loader into the MBR it has no alternative but to put the boot loader inside its root partition. That makes the system “chainloadable” by Grub. A Linux partition does not need to be active in order to be booted up. Neither does a BSD or a Solaris if it is booted by Grub. Windows is the only exception that needs its boot flag “switched on” when being booted.

(9) There is no harm done if you do make a mistake overwriting Windows MBR with a Linux (or another system’s) boot loader because you can always restore the Windows MBR either by a Windows installation CD (any one from Win2k or XP) or a Freedos CD downloadable from the Internet.

With the former you boot up the installation CD and wait until you can press R to opt for the Recovery Console where you just type

Code:

fixmbr
exit

The Freedos offers a CD ios image which you can burn and boot up to a Dos prompt. You can then type

Code:

fdisk /mbr

Either method will get your Windows MBR back. If the user has an access to a bootable floppy drive the Windows MBR can also be restored using the command identical to the Freedos CD.

A bootloader is put into the first block of a Linux partition and its location is known as the superblock. When the superblock is the first primary partition it is the MBR.

Each method is in fact very simple and seen fully in two lines of red text. There is no amendment at all to either the installed Windows or Linux.

The Section B is a old DOS trick used by a program called System Commander which activates/deactivates partitions during booting.

Method A is even simpler by using the BIOS boot sequence to achieve switching away from Windows.

The long text are exact steps to achieve the objective. The switching is semi-permanent and done only once. It is needed again only when one wants to dispose one of the systems. Funny enough I wrote only Section A initally but added Section B for the laptop users.

These methods are based on the characteristic of the hdd and nothing else.

I do agree the simplest method is to have a bootable floppy for the Linux but the hdd booting does opens the door for adding unlimited number of distros and have all of them bootable from one menu.

Do you guys think I should erase the long steps and leave just the red summaries in?

I think the "long text" is needed. After all, these tips are primarily for people not so familiar with things like this, don't give them just a command but tell them how things work.
I also agree that it's best to leave that virgin untouched - she's so picky she could easily wreck your Windows for no reason.
I always preferred mature women...

I was just wondering if fdisk for DOS actually allows you to set a second primary partition active?
I haven't tried that, the reason for me wondering is that as far as I know DOS doesn't allow more than one primary partition.
If you've tried it and it works, please conform it here. It's good to know.

I confirm that it works. Got 7 PCs at home with 18 hdds to play with (most on mobile racks/caddies) so I did a test to satisfy myself because there is nothing new in it. I got the inspiration from you and convinced that there is another way to leave Windows alone. The suggested methods can also leave the Linux untouched so we are getting lazier all the time.

DOS doesn't allow more than one partition active.

Linux can mark two active partitions but DOS switches off the other one as soon as I order a target partition to be made active.

The system works fine for Knoppix as I installed Version 3.3 on a slave and later installed Version 3.4 in the master at the rear of Windows just to prove both Section A and B are workable.

The method may runs into trouble with some distros that needs to reboot to finish the second part of the installation. In such a case it could find itself boot to Windows because Windows' MBR has not been touched. That is the case for Suse. To overcome the problem one has to install another distro in like Knoppix to get the system working first.

Regardless whether newbies are interested in the proposed methods they will find out sooner of later that this is how the a hard disk actually behaves. Thus the information is beneficial to know.

Well, I would have loved to have seen this thread before I just tried installing my first Linux, but now I have screwed things up it seems.

I installed Mandrake 10.0 (for no particular reason I chose that one) on my second harddrive, which I had swiped. Installation goes fine, and at the end of install it askes a question about MBR. So I say put it on primary? harddrive, I think. Anyway, I think that's where it did it, because it messed up the crappin' DDO on my primary harddrive with Windows on it, which I need.

Now I have heard that with Lilo (which I think is installed on my system, I get choices like linux, failsafe, 263-7, and some other one) you can choose to boot to Windows. I don't see that option, so I unplug Linux drive (which is becoming the bane of my existance) and try booting from only the one Windows harddrive. Unfortunately, as stated above, something is messed up there. Lilo and DDO not made to be partners?

What happens is that I get the "Now loading OS..." BIOS message, and then about 103 "99s" in a row. WTF? Obviously, Windows is not going to load.

I think to myself, oh sh*t, now I'm going to lose a lot of time reinstalling everything, which I am perfectly capable of doing. However, I don't want the hassle of doing that, plus losing whatever I didn't have backed up. What can I do?

I would be happy booting Windows, and don't care about anything else at the moment. Linux will be more fiddled with at a later date, using methods described above.

What happens is that I get the "Now loading OS..." BIOS message, and then about 103 "99s" in a row. WTF? Obviously, Windows is not going to load.

No need to reinstall everything just insert cd#1 in cd-drive when it boots up hit f1 then type rescue then select either reinstall boot loader or reinstall win bootloader hit enter and reboot remove cd all should be ok then. I have had this hapen a few times lilo didn't get installed properly during install no biggie.

A fair comment. I am lucky in using a 200Gb hdd not knowing what the heck of the limitation of the 1024 cylinders in Lilo is all about because all the hard work has been done before I started learning Linux. Grub does seem to have the same trouble though.

DimGR

I will try your suggestion later on but I love the Linux bootloaders because they are so simple. Either Lilo or Grub can chainload as many systems as I want. I have about 13 now including a XP and I frequently switch the Linux to take over as the boot manager for the rest by amending its /boot/grub/menu.lst (for Grub) or /etc/lilo.conf (for Lilo).

In practical term it is easier to use the MBR because many Linux systems have a two stages installation and need a reboot to complete. Thus one need to know how to deal with booting and have a few floppies to switch things around.

In playing around with 15 to 18 Linux distros with XP in the hard disk I have the MBR overwitten by Grub and Lilo countless number of times. So far I have never experienced any difficulty to restore the MBR for my XP. In fact I no longer bother with the original XP CD and just use a old DOS floppy to Fdisk /mbr. Therefore losing the MBR temporary cannot be a big deal.

Well, I just got booted into Windows finally. I'm going to enjoy that for a while, and then come back to Linux.

How I did it: Put in CD1 of Linux, reinstalled bootloader and bootloader for Windows, then tried rebooting. No OS to boot from is the report. So, in goes Windows boot disk, go to c: which is nice to be able to see, and snoop around in those directories a little. Or at least try to. It gives me an unreadable sector error, so I decide to try scandisk. Scandisk gives me warnings about IDE translation no being set up correctly, so I quit that and go to BIOS. There, IDE transaltion was set to CHS, so I set to automatic detection. Restart, voila, Windows screen. Yay.

I hope to experiment with Linux again soon, and will try to get that working. I'm thinking I will just use a boot disk designed to boot Linux. That is a common method, no?

hi saikee

i have 2 hddisk. 1st hddisk is XP and the 2nd gonna be mandrake 10. is it ok if I unplugged the 1st hddsik. and then install mandrake in 2nd hdd.? will the LILO/grub in the 2nd hdd(primary slave drive)?