- Member Success Stories (
-   -   Windows 98SE as a secondary OS on RedHat9 (

sausagejohnson 05-19-2004 08:13 PM

Windows 98SE as a secondary OS on RedHat9
Installing Windows 98SE as a secondary OS on a Linux System

It's about time I contributed something useful. Many Linux users like to have a dual boot system containing a version of Windows and a version of Linux. But it appears most users start with a Windows system, reserve a partition for Linux and then install a Linux distribution as the secondary OS.

I wanted it the other way around: to start with an existing Linux distribution, have a reserved partition for Windows to be able to move existing old windows work, and play games under DirectX.

In short, I wanted Linux as my primary system and Windows to an afterthought tacked onto the end of the drive should I ever need it. See for the back story.

Well I managed to do it and it's not too hard. I used a fresh 160GIG drive, RedHat 9, and Windows 98. This has been tested also with Mandrake 10.0 Community (see conclusion) but not with any other flavours of Windows except 98. Enjoy the following simple procedure and feed back if something doesn't work:

Windows 98SE on a RedHat 9 System

Things needed:
a) RedHat9 Distribution CDs
b) Windows 98 CD
c) Windows 98 Bootdisk with CDROM drivers, fdisk & format programs

01. Make sure your harddisk is set to LBA in the BIOS.

02. Start machine and insert Red Hat CD1 to boot. Follow the install prompts till you get to the harddrive partitioning section.

03. Choose Manual partitioning instead of Automatic.

04. I used the following partition sizes (make each one a primary partition):
Drive Mount Size Type
/dev/hda1 /boot 75MB ext3
/dev/hda2 / RESTOFDRIVE ext3
/dev/hda3 /windows 30GIG ext2
/dev/hda4 SWAP 1GIG SWAP

Be prepared that the /dev allocation numbers may go out of order. You may have to delete an entry and insert it again to get it to appear in the order you want. Try adding the / partion last to get it to go to /dev/hda2. Now, you will notice that I have set the Windows partition to be EXT2 instead of VFAT. While I would like to use VFAT, RedHat 9's installer won't allow you to create a VFAT partition greater than 2048MB. I want 30000MB and yes, Windows can handle this size but we can't create it properly here. We'll change it later.

05. Complete your installation and install whatever packages you want. I simply install the lot.

06. The installer will reboot and take you to the grub screen, and then into your new installation. Once there, open up a terminal and type:
fdisk /dev/hda

Once you are in fdisk, you need to change the type of partition it is from ext2 to vfat. Why we can do it here and not in the installer is beyond me, but at least it is possible here. Press P to check which drive we are changing (the windows one). Press T to change Type of partition. It will ask you to select partition 1-4 (in our case). Select 3. It will ask for the code to change to. You want c. This is for a Win 95 (LBA) partition. Press W to save and exit.

07. Insert a Windows 98 bootdisk

08. Reboot the system with "reboot". The floppy disk should boot a Windows 98 DOS session.

09. Type: "fdisk" to check that your C: partion is a DOS partition at the end of three NON-DOS partitions, something like this:

Partition Status Type Volume Label
1 A Non DOS
2 Non-DOS
2 Non-DOS

10. Fine, it looks ok. Nothing to do here. Quit fdisk and type C: to go to the C: drive. You'll get a C:> prompt which is good but any commands like DIR will result in an error because the drive is not formatted. But it's working, we just need to format it. Go back to A: and type:

format C:

And let it format the C: drive (which to the linux system is /dev/hda3).

11. Once done, insert your Windows 98 CD and type D: to get to it and type SETUP to install Windows 98. Go through everything as you would normally when installing Windows 98. The during the process, you will of course do several reboots and you may notice that GRUB is gone. Windows 98 will be the only OS you can get to. Linux is still there but no longer accessible.

12.Once you are happy that Windows is installed, insert RedHat CD 1 again and reboot your PC. At the bootscreen type:
linux rescue

This will get you into rescue mode. It will mount your linux under /mnt/sysimage. Just follow the prompts until you get to the system. Then type:
chroot /mnt/sysimage

This sets the root back to the way it should be if you booted linux normally and puts all file locations back where you expect to find them. Now, in this mode we need to get GRUB to know about the windows partition and also to reinstall the GRUB loader back onto the start of your harddisk (the MBR). Windows overwrote GRUB on the MBR with it's own bootloader. We need to get it back. First we need to add an entry to the grub.conf file. Type:
vi /etc/grub.conf

Press "i" to go into insert mode. This means you can change the file. Scroll down to the end and add a new entry:

title Windows98
rootnoverify (hd0,2)
chainloader +1

The purpose of the entry is so that when you restart your system, under the Linux entry, you will see a "Windows98" entry and you will be able to choose between the two operating systems. The title obviously is what will be displayed in GRUB when you start the system. The (hd0,2) means FirstHardDisk,3rd partition (numbering starts from 0). Therefore hd0 means /dev/hda and the 2 means hda3. Finally chainloader... well I don't understand it fully except that you need it and the +1 means to start loading on the first sector + 1. Again, read up if you want to about it (info grub), otherwise just make sure it's there.

To save changes and get out of the vi program, press ESC, then :wq and hit enter.

We've changed the entries for our bootloader screen (GRUB screen) but now we actually have to reinstall GRUB on the MBR and wipe the windows one:
grub-install /dev/hda

13. Ok, so now let's reboot. You should have a GRUB screen with a choice between Windows or Linux. Boot Windows first to check all is ok there. If so, good, if not, let me know. If people have problems using this document, I'd like to change it to be more useful with a broad range of situations. Reboot and we'll check Linux.

14. You'll get the GRUB screen again. Select Linux. Linux will fail half way through the load with a Filesystem repair message. This is expected because when we installed RedHat, we told it that our /dev/hda3 (windows) was an EXT2 formatted system. But we changed it and didn't tell Linux about it properly. You'll be required to enter the root password to enter Maintainence Mode. Do so and then type:
vi /etc/fstab

You should have an entry something like this:

LABEL=/Windows /windows ext2 defaults 1 2

Press "i" to go to insert mode and change the line to:

/dev/hda3 /windows vfat defaults 0 0

Press ESC and then :wq and enter to save and quit. Test it by typing: mount /windows. You should be able to check it by cd /windows and then ls. Windows file appear? Good. If not, let me know. I may have missed something.

15. Press Control-D to exit Maintainence Mode and the system will auto-reboot. At this point you have a working dual boot linux/windows system where linux is your primary operating system. And in the future, should you wish to blow it away and use the partition as another EXT3 partition or something else, there's no reason why you can't.

I hope people find this quick guide useful and maybe even worth distributing. So feel free to spread it around.

* Keep in mind, if you try this with a newer distribution like Fedora Core 2 or Mandrake 10.0, most of the steps here become redundant. Newer distributions can format large windows or VFAT partitions when installing Linux so you therefore don't have to muck about with the partitions. However, Windows will always muck up your MBR and it will need to be restored with the grub-install steps.

20 May 2004
Wayne Johnson

sausagejohnson 08-11-2004 06:21 PM

Since posting this in May, I have discovered a flaw. For harddrives greater than 137 GB (and in my case 160GB) windows 98SE has difficulty addressing blocks in this region. For a detailed explaination of the issue, see this link:

Although using windows 98 at the end of a drive of this size (while using IDE) does work, it is programs like scandisk and defrag that will not be able to deal with block addresses this high. In the event that your windows has a crash, and scandisk is run, data will be corrupted across the drive, and that means other partitions, ie, your linux / partition. Your linux WILL be corrupted.

I believe it has something to do with scandisk not being able to calculate the clusters correctly and sees some of the linux partition as invalid windows data, even though it not even part of the windows partition.

Of course I could continue to work in this way and avoid using scandisk when there are problems, but this is a dangerous way to work.

Therefore I have since moved the windows partition back in between the /boot partition and the / partition, which successfully keeps windows under the 137GB safe limit.

So now my existing structure looks like this:

Drive Mount Size Type
/dev/hda1 /boot 75MB ext3
/dev/hda2 /windows 30GIG ext2
/dev/hda3 / RESTOFDRIVE ext3
/dev/hda4 SWAP 1GIG SWAP

Although this does not forfill my original intention of having windows at the end of the drive, it still does prove that windows can live anywhere on the drive (but places above 137GB are risky). It doesn't have to be at the start of the drive and that linux CAN be the dominate OS for your system.

If you are interested to read how my system was corrupted, and how we discovered the cause, go here:

XavierP 08-11-2004 06:34 PM

Have you considered making this a Linux Tutorial?

sausagejohnson 08-11-2004 06:44 PM

Yes I have done that already. I was asked back in May to do it, but it did not appear when I entered it. Apparently a moderator has to sign it through. It should be sitting in a queue somewhere (possibly Hardware or

XavierP 08-11-2004 07:15 PM

Ooops, you are right. It's in the backlog. Apologies.

LinuxLala 08-12-2004 02:34 AM

Yeah. This would make a good read for quite a lot of folks 'ere at LQ.

nuka_t 08-12-2004 06:01 AM

i wish this worked with xp.

the problem with installing xp first and then linux is that you need to reformat xp frequently and it could F up the linux partition. however, i guess if we use linux most of the time that shouldnt be much ofa problem.

bmpv666 09-20-2004 11:48 AM

do you think this might work with windows XP?

i have Mandrake 10 installed in a Toshiba laptop, it's a single OS installation, i would like to install winXP as a second OS, to be used to record DVDs, since i'm finding trouble to record them under linux...(other than that my linux works fine, even the wireless connection :D ). the windows partition would be FAT32 so i can read/write it from linux without problem, and no more than 10 GB, to the end of the HD.

i'm tempted to give it a try, but i would like to know if anyone has tried it yet, or if there's any tutorial that i could read.

thx :)

sausagejohnson 09-20-2004 06:03 PM

No this tutorial can't be used for XP. I use a GRUB dual boot Fedora Core 1 and Windows XP at work. I installed XP first and then linux. Because of Grub, it's pretty seamless anyway and you wouldn't know which is the primary OS. At any rate, I configure Grub to set my Fedora as the default boot.

It works seamlessly. When I installed XP, I created one half of the drive as a NTFS partition and the other half (plus a swap partition) as an unformatted partition. Then I simply installed Fedora Core 1. There were no issues. This was on an Asus Nforce2 Motherboard.

All times are GMT -5. The time now is 04:05 PM.