LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Grub - Have XP and Ubuntu, want to add Win7 (https://www.linuxquestions.org/questions/linux-newbie-8/grub-have-xp-and-ubuntu-want-to-add-win7-813865/)

scoob8000 06-13-2010 09:41 AM

Grub - Have XP and Ubuntu, want to add Win7
 
So on one of my rigs I have Windows XP and Ubuntu 8.04 dual booting with Grub. (All on the same HDD)

I want to repartition and add Windows 7 into the mix.

Whats the best way to do this?

I'm not beyond installing 7 to a seperate drive and then moving it's partitions over to my main drive and adding the entry to my menu.lst.

Thanks

tredegar 06-13-2010 09:50 AM

I think you'll have to install win7 to its own drive, that's the way win works. I think you certainly won't be able to move win7's partitions after the install, win will not like this at all (but what do I know? I don't run win now).

I'd also make sure that the new drive was the only drive in the PC at the time win7 is installed (or XP might be hosed, same for Ubuntu).

Then put your other drive(s) back, make an entry for win7's partition in grub and you should be set to go.

scoob8000 06-13-2010 05:32 PM

Well I installed 7 into a new partition at the end of the drive. Managed to get grub reinstalled to my ubuntu partition and added the 7 entry to menu.lst.

But upon selecting it, I get the bootmgr is missing. Google says to run "bootrec /fixboot" from recovery, but I'm sure that will wipe out my MBR and grub again.

Ideas?

syg00 06-13-2010 07:32 PM

fixboot only updates the boot sector record in the (Win7) partition, not the MBR (fixmbr does that).
Hope you used a primary partition.

John VV 06-13-2010 08:10 PM

dose win 7 let grub and lilo boot them?
i thought the only way was to hack the win7 bootloader on the MBS
and use the MS boot loader to boot all 3

syg00 06-13-2010 09:41 PM

Win7 chainloads fine.

scoob8000 06-14-2010 05:58 AM

Quote:

Originally Posted by syg00 (Post 4002566)
fixboot only updates the boot sector record in the (Win7) partition, not the MBR (fixmbr does that).
Hope you used a primary partition.

So I assume 7 needs to be on a primary partition?

XP is my primary partition on this drive, after some putzing around I can pick Ubuntu or Windows from grub. After picking windows (rootnoverify to my XP partition, then chainload) I get the Windows boot menu and can boot XP or 7 from that point.

That works, but it would still be nicer to be able to select all three OS's from grub.

syg00 06-14-2010 06:04 AM

You can't - that is a limitation of Windoze.
Win7 replaced the boot code from XP, and sets up the option to boot either - but you only have one lot of boot code.
Nothing grub can do about it.

Windoze (all versions) needs boot code in a primary - they accomplish that in your case by over-laying your XP boot code.

saikee 06-14-2010 08:05 AM

All NT version of Windows (Win2k and Xp) and the later versions (Vista and Win7) can be installed in logical partitions. That is my setup as I have Win7, Xp, Vista and Win2k in sda6, sda7, sda8 and sda9 respectively.

All MS Windows can be installed in logical partitions "if" there is a primary partition to house their boot loaders. I use a Dos fat32 sda1. Why? because I can put Grub and install a Dos there too.

Check out this thread for the arrangement.

Regarding OP task I suggest two methods

Method A - MS Windows way -easier

Just install Win7 in any disk or any partition. Its installer will find Xp and deposit Win7 boot loader bootmgr there. It will then replace Xp partition's boot sector with WIn7's version and nuke the Grub in the MBR. Bootmgr will boot Win7 directly and Xp indirectly by loading NTLDR if the user specifies an earlier version of MS Windows.

After both Xp and Win7 working normally, boot up Ubuntu CD and do a Grub-install (say Ubuntu is in sda3)
Code:

sudo mkdir /mnt/sda3
mount /dev/sda3 /mnt/sda3
grub-install --root-directory=/mnt/sda3 /dev/sda

Ubuntu's Grub2 will then work as before but if WIndows is chosen there is now a dual boot system for Xp and Win7 inside.

The work is Grub2 boots up Xp's boot secton (from "chainliader +1"). The residing boot sector code loads boogmgr. Win7 or Xp will then be selected by the user.

In this method the OP can see both MS partitions.

Method B - Linux way

Before installing Win7 hide the Xp partition, use any of the partitioning tool to change the partition Type 7 to 17. Create a primary partition, make it bootable and format it in Ubuntu by command, say it is sda2
Code:

mkfs.ntfs /dev/sda2
Install Win7 into it. Its installer will seize sda2 as it is the correct and only partition installable.

Boot up Ubuntu and put Grub2 back in the MBR (step as the above).

Amend grub.cfg

(a) Add Win7 partition to Grub2 menu with the "chainloader +1"
(b) hide Xp, unhide Win7 when booting Win7 and
(c) hide Win7, unhide xp when booting Xp

In this set up one Windows is hidden while booting the other. The advantage is each MS Windows has its own boot loader and not dependent on each other.

scoob8000 06-14-2010 07:54 PM

saikee,

This is the way to go! I used your linux method with a little variation. Mainly using gparted to hide and make new partitions.

I was able to make a new primary partition to install 7 into. I read that you can also set your new (empty) 7 partition to be bootable and that causes the installer to store it's boot files there.

It all comes down to MS quirks, but alas I now can boot all my OS's from grub and all on the same physical drive. :)


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