LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices

By sausagejohnson at 2004-06-08 22:27
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/questions/showthread.php?threadid=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 flavors 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 / partition 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: partition 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.

by sausagejohnson on Wed, 2004-09-22 01:10
Warning: There is an issue regarding drives around 160GB and over with this process. Visit: http://www.linuxquestions.org/questi...hreadid=183501 (skip the article) and check the discussion under it.

by mozart_uno on Tue, 2005-01-18 04:46
Does this configuration works installing windows 2000 after FC2 have been installed?
If my HD have been partitioned, how I resize or repartition the HD ? in order to install windows 2000?

This is what I have in my HD.

Device Boot Start End Blocks Id System

/dev/hda1 * 1 203 102280 83 Linux
/dev/hda2 204 40838 20480040 83 Linux
/dev/hda3 20839 61155 10239768 83 Linux
/dev/hda4 61156 155009 47302416 F W95 ext. LBA
/dev/hda5 61156 151733 45651280 83 Linux
/dev/hda6 151734 153765 1024096 83 Linux
/dev/hda7 153766 154805 524128 82 Linux swap
/dev/hda8 154806 155008 102280 83 Linux



File System Size Used Avail. Use % Monted on

/dev/hda5 43G 188M 41G 1 /
/dev/hda1 97M 6.0M 86M 7 /boot
none 122M 0 122M 0 /dev/shm
/dev/hda3 9.7G 6.0M 9.1G 1 /home
/dev/had 8 97M 4.1M 88M 5 /tmp
/dev/hda2 20G 2.8G 16G 15 /usr
/dev/hda6 98M 84M 851M 9 /var

thank you for the help you can give me.

Oscar Cedeño

by sausagejohnson on Tue, 2005-01-18 17:45
Hi Oscar. Hmmm... I would doubt it very much. 2000 is based on NT so it would be more similar to XP. I would suggest you look up a guide that specifically discusses installing 2000 and linux.

by dick_onion53 on Fri, 2005-01-21 01:33
If you need a GUI partitioning program check out Paragon Partition Manager -- it works great.

by dianat100 on Sat, 2005-03-05 12:13
sausagejohnson, will your tips work with Mandrake 10.1 Official or a different procedure is needed? I want Win98 on a 5GB partition. Mandrake is on 8GB. Thanks.

by sausagejohnson on Sun, 2005-03-20 19:33
The flavour of Linux really shouldn't matter. The principle should be the same. I used the Mandrake Community version the test release just before the final came out. But again, that shouldn't matter. Still, if you have a spare drive, clone it as a backup and give it a try.


  



All times are GMT -5. The time now is 01:23 PM.

Main Menu

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration