LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-12-2005, 10:06 AM   #1
Frelov
Member
 
Registered: Sep 2003
Location: In a cave in the himalayas
Distribution: FC4 (currently)
Posts: 36

Rep: Reputation: 15
Installing Windows AFTER Linux: how I did it


(warning, long post with hopefully good info)
Ok fellow newbies, since no one answered my requests for help on this and since this seems to be a common theme with no clear "How to" that I could find on the net I figured I'd post this again So other newbies can avoid my mistakes :P

This is basically a "how I did . . ." that could serve as an example on 2 things:

1) Installing windows AFTER linux is installed
2) fixing the boot system after changing partition tables

My specific scenario:
I started with Linux/winxp/winme multi boot (rh9) and grub boot loader. win XP screwed up (again)

My goals
I was tired of reinstalling rh9 everytime windows became corrupted so I found a (partially complete/correct) faq on how to reinstall grub and keep my linux

Where I screwed up:
I had a really huge windows partition that was basically wasted space so I went into dos fdisk , blew away the xp partition and made it only 5 gig so I could add different linux flavors later.

THE PROBLEM THIS CREATED:
both linux and windows now viewed all the partitions with different numbers. previously my root was hd0,1 and my swap was hd0,2 with all my other linux partions on hd1,x

what I SHOULD have done:
1) make sure M.E. is the active partition in dos fdisk after deleting and recreating xp partition
2) reinstall winxp
3) boot using linux emergency disk and mount the root properly
4) edit fstab and grub.conf to reflect the new partition numbers for /root, /swap, and splash screen (which is also root I believe), and windows boot partition

IF I WAS SIMPLY ADDING WINDOWS FRESH AFTER A LINUX INSTALL:
1) Assuming I already have unpartitioned disk space, I could have booted using the windows boot disk and created the partition(s) in dos fdisk for windows (or in winxp but anaconda seems to cry over this but it will work)
2) install windows version(s) on the newly created/formatted partition(s) in proper order (older to younger)
3) after verifying that windows is booting properly, boot using linux boot/emergency disk, properly mount linux root for your version of linux (rh9 automatically offers to mount pre-existing linux installations on /mnt/sysimage and all I had to do was type: chroot /mnt/sysimage)
4) find out the new partition numbers for the swap partition, and root/boot.
5) edit fstab and grub.conf (in rh9 mine were both stored in /etc directory) to reflect the proper swap partition, root partition, splashscreen partition for grub *note* the splash screen is very important or it wont provide the proper options, and the proper windows boot partition.

EXAMPLE:
how I had to reinstall grub after installing windows to correct all my screwups.
1) booting in to the (rh9) linux with the boot floppy I typed "linux rescue" at the "boot:" prompt (http://www.bootdisk.com/ if you don't have a boot disk and can't create one from your install)
2) I accepted the default /mnt/sysimage that rh9 provides to mount the existing linux installation. it recognized my network connection but I told it not to install it for this process
3) at the prompt I type "chroot /mnt/sysimage"
4) to find the partition information I typed "sfdisk -l" this listed the partitions and identified the swap file. Some people say there's a command to specifically identify the root partition, but I don't know what it is and I knew mine was only 102 mb and I was able to correctly guess which one was which since I couldn't remember which drive I put the root partition on.
5) after getting the partition numbers I changed directories into the etc directory (this is whre both fstab and grub.conf files are on my rh9, "cd etc"
6) I used vi editor to edit fstab & grub
vi fstab
i (for insert, move to right spot and change the hda, mine was now hda1 where it was hda3 previously, the delete key worked ok to remove the old text)
esc
:wq
7) using the same method above I edited grub.conf
-my root was now hd0,0 (listed as hda1 in sfdisk) so I changed both the splash screen and root to be hd0,0.
-Previously my windows boot partition was hd0,1 but with all the changes it was now hd0,2 so I had to edit the entry to reflect this
-I saved the file using :wq like above
8) I had to type exit and hit enter twice at the prompt to solicit a reboot, while it was rebooting I removed the emergency floppy and the rh9 cd1 that the floppy required for boot.

Magically the grub menu/splash screen came up (I had edited the windows option to say "various windows Operating systems"

Now, one thing to note here, I now have 4 partitions on my first hard drive and 26 gig of free space on it for later. when I DO finally add new linux partitions on it later or if I decide to make some of that availiable to windows I'll have to find a way to HIDE all the linux partitions from the windows systems. I'm told this can be done within the grub.conf file but I haven't tried to tackle that yet . What I'll likely do is copy the grub.conf file to a back up file and that way I can easily restore if I screw things up

I hope this helps someone out there to avoid the frustration I went through while trying to do this without any clear instructions. Mine aren't very clear perhaps but it's more info and exampels than I found anywhere.

happy Linux everyone
 
Old 03-12-2005, 10:18 AM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
How about submitting this as a Tutorial? It will save it from being buried in the lists of threads.
 
Old 03-12-2005, 10:36 AM   #3
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Or:

1. Install linux with lilo
2. Install windows
3. Boot a linux CD, chroot your linux install
4. add the windows drive to /etc/lilo.conf
5. run lilo
 
Old 03-16-2005, 08:07 PM   #4
Frelov
Member
 
Registered: Sep 2003
Location: In a cave in the himalayas
Distribution: FC4 (currently)
Posts: 36

Original Poster
Rep: Reputation: 15
Thanks to one and why to another

Thanks XavierP, I'll check your link and see about how to submit as a tutorial.

Komakino, the whole purpose of my efforts was to NOT have to reinstall linux so reinstalling linux with LILO to get rid of grub would have totally twarted my goals.

Um, komakino? Maybe it's just me but isn't giving an english lesson in a linux forum an intentional insult? Seems that way to me since this is a linux newbie forum and not a language learning forum. If my mistakes offend you then 1) I apologize and 2) I don't need any answers from you if grammatical errors bother you that much. So don't read the posts you find grammatical errors in and you won't feel the need to teach english to those who came to learn linux.
 
Old 03-16-2005, 09:59 PM   #5
thorn168
Member
 
Registered: Oct 2004
Location: USA
Distribution: Vector Linux 5.1 Std., Vector Linux 5.8 Std., Win2k, XP, OS X (10.4 & 10.5)
Posts: 344

Rep: Reputation: 42
Frelov,

The grammer part of Komakino's post is a part of his/her(?) signature.

Don't take it personally.

Thorn
 
Old 03-17-2005, 09:46 AM   #6
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Re: Thanks to one and why to another

Quote:
Originally posted by Frelov
Thanks XavierP, I'll check your link and see about how to submit as a tutorial.

Komakino, the whole purpose of my efforts was to NOT have to reinstall linux so reinstalling linux with LILO to get rid of grub would have totally twarted my goals.

Um, komakino? Maybe it's just me but isn't giving an english lesson in a linux forum an intentional insult? Seems that way to me since this is a linux newbie forum and not a language learning forum. If my mistakes offend you then 1) I apologize and 2) I don't need any answers from you if grammatical errors bother you that much. So don't read the posts you find grammatical errors in and you won't feel the need to teach english to those who came to learn linux.

It's in my sig. Besides, good English means you're more likely to have your posts answered as people will be able to easily understand your concise, unambiguous sentences. There are often posts where somebody tries to ask something and the sentence is so complex and badly structured that the first response is "What???".

And my solution doesn't have you reinstalling linux, just lilo. The first line could just as easily be "Have an existing linux install that used lilo as the bootloader". There's an equally simple solution that uses grub, but I don't use grub so I can't remember the commands. It wouldn't have thwarted your goals and was a damn sight simpler than what you did.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Windows 98 or XP after Linux PhuckFonix Linux - Newbie 3 05-01-2005 07:59 PM
Installing programs in linux? which progs? can linux do the things windows can? James-jmpm Linux - Newbie 6 07-02-2004 07:01 PM
Installing Windows over Linux muthiahm Linux - Newbie 7 06-10-2004 08:11 AM
Installing windows over linux on a fully partitioned drive for linux reddon84 Linux - Software 2 01-26-2004 06:17 PM
Installing Linux 7.1 and windows Me . miracle9 Linux - Software 3 09-11-2001 10:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:18 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration