Results 1 to 6 of 6

Thread: HowTo: Boot Vista and Windows 7 directly from the Grub menu

  1. #1
    Join Date
    Apr 2008
    Beans
    3,317
    Distro
    Kubuntu 9.10 Karmic Koala

    HowTo: Boot Vista and Windows 7 directly from the Grub menu

    This tutorial is for people who have Vista and Windows 7 installed and would like to be able to boot both directly from the Grub menu.
    (The same tutorial works if you have two installations of Vista or two installation of Windows 7, but it does not work for XP).
    The tutorial assumes that you are able to boot into Vista and Windows 7 via the Windows Boot Menu.

    In the following I will refer to the two Windows installation by WinA and WinB. WinA refers to one which has the boot loader "bootmgr". "bootmgr" is a hidden system file in the root directory, or C:\, of one of your two Windows installations. In most cases WinA will be the one which was installed first.

    Boot into WinA


    Step 1 Edit the WinA boot loader, so that it also will work on the WinB partition:

    Go to "Start". Type "cmd" and press "Ctrl+Shift+Enter". This will open a command line as an administrator. (If this did not open the command line: Go to Start->Program Files->Accessories, Right Click "Command Prompt", Choose "Run as administrator")

    Type


    Code:
      
    bcdedit /set {bootmgr} device boot

    Boot into Ubuntu.
    and open a terminal (Applications->Accessories->Terminal)


    Step 2 Add WinB to "menu.lst":

    Open menu.lst via

    Code:
    gksudo gedit /boot/grub/menu.lst
    The existing entry for Windows will be used for booting into WinA. Add a similar entry for WinB.
    If you need help with this, post the output of "sudo fdisk -lu" and the current Windows entry.


    Step 3 Copy the boot files from WinA to WinB

    Type

    Code:
     sudo fdisk -lu
    and determine the device names of the WinA and WinB partitions.
    In the following I assume that WinA is on /dev/sda1 and WinB is on /dev/sda2.

    Code:
    sudo mkdir /mnt/Win{A,B}
    sudo mount /dev/sda1 /mnt/WinA
    sudo mount /dev/sda2 /mnt/WinB
    sudo cp /mnt/Win{A,B}/bootmgr
    sudo cp -R /mnt/Win{A,B}/Boot
    Of course you need to replace /dev/sda1 by the device name of the WinA partition and /dev/sda2 by the device name of the WinB partition.
    Sometimes the directory Boot is called BOOT instead. Use "ls -l /mnt/WinA" the determine the correct spelling.


    Step 4 Edit the WinA boot loader, so that it boots directly into WinA

    Reboot.
    Choose the WinA entry at the Grub menu. The WinA boot menu will appear. Boot into WinA. Open the WinA command line as in Step 1 and type

    Code:
    bcdedit /set {bootmgr} default {current}
    bcdedit /set {bootmgr} timeout 0


    Step 5 Edit the WinB boot loader, so that it boots directly into WinB

    Reboot.

    Choose the WinB entry at the Grub menu. The WinB boot menu will appear. Boot into WinB. Open the WinB command line as in Step 1 and type

    Code:
    bcdedit /set {bootmgr} default {current}
    bcdedit /set {bootmgr} timeout 0

    From now on if you pick WinA at the Grub menu you should boot directly into WinA , and the same for WinB.


    Here is a thread where this method was used sucessfully:

    http://ubuntuforums.org/showthread.php?t=1121214
    Last edited by meierfra.; February 21st, 2010 at 06:48 PM.

  2. #2
    Join Date
    Jul 2009
    Location
    Brazil
    Beans
    1

    Smile Re: HowTo: Boot Vista and Windows 7 directly from the Grub menu

    Thank You so much! It worked perfectly for me! And using what I learned with the tutorial, now I found how to boot Windows XP and Windows 7 directly from the Grub menu!!

  3. #3
    Join Date
    Aug 2009
    Beans
    24

    Re: HowTo: Boot Vista and Windows 7 directly from the Grub menu

    Hi there,


    That's a great and clear guide you made there.
    But unfortunately, it doesn't work with me

    I did all of these steps, but when i now boot WinA, WinB boots instead
    I haven't tried WinB yet though...

    Can you help me please?

    I've tried the fixmbr command, i thought that would restore the Windows Boot Loader, but but I get an error saying that this command isn't recognized
    Same for FDISK /mbr.

    I'm brand new to this forum, should I have made a topic instead?

  4. #4
    Join Date
    May 2009
    Location
    Granby, Québec
    Beans
    9
    Distro
    Ubuntu

    Re: HowTo: Boot Vista and Windows 7 directly from the Grub menu

    This one does not work at all for me. Still no results after doing it over at least 5 times. I tried everything I could find and I still can't boot 7 separately.

    (MS rant...)

  5. #5
    Join Date
    Aug 2011
    Beans
    2

    Re: HowTo: Boot Vista and Windows 7 directly from the Grub menu

    Hi,

    Thanks very much for this tip! It worked well as long as second windows exists in primary partition. I am using grub2 and looks to me grub2 does not read bootsector at the logical volume in extended partition. Is that right?

    menuentry "win on extended partition" {
    # 1st logical volume in extended partition
    set root=(hd0,msdos5)
    chainloader +1
    }

    Any tip would be really appreciated.

  6. #6
    Join Date
    Aug 2011
    Beans
    2

    Re: HowTo: Boot Vista and Windows 7 directly from the Grub menu

    After some analysis, it turns out that the pbr(partition boot record) inside extended partition installed by Windows does not show real "hidden sectors" in Physical disk. The mismatch fails Windows to boot from grub2. While legacy grub takes care of it, so legacy grub still works.

    For those who are interested in booting Windows installed inside extended partition directly from grub2, try following. It worked for me perfectly.

    a) copy pbr into a file e.g. dd if=/dev/sda5 of=sda5.pbr bs=512 count=1
    b) check real staring sector of the partition. I used Gparted. select the partition and show information.
    c) open a file e.g sda5.pbr with binary editor.
    d) replace hidden sector entry, 4bytes starting 0x1c with real starting sector from b)
    e.g. assume if real sector is 251,690,418 (0x0f007db2)
    0x1c : b2
    0x1d : 7d
    0x1e : 00
    0x1f : 0f
    e) save a file e.g. sda5.pbr.mod

    menu entry should be like e.g.

    menuentry win {
    set root=(hd0,msdos5)
    chainloader /sda5.pbr.mod
    }

    Hope this helps someone who specifically wants to boot windows inside extended partition
    directly from grub2.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •