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
http://www.linuxquestions.org/questi...hreadid=166261 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
C: 3 PRI 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)
makeactive
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
http://waynejohnson.net