Setup grub/boot partition

Just that you guys know first I got openSUSE already running for a few months.

But I would like to give some feedback.
I am an advanced windows user got multiple partitions etc and on SUSE I am currently compiling kernels for Smartphones.

For windows 7 I have always a boot menu showing up to select Safe or Normal mode. And no then I dont mean the menu when you press the key for safe mode.
So the real windows bootloader.

When I installed opensuse what I wanted was to boot open SUSE from the windows bootloader. This is possible with tools like easy bcd wich can load there own grub version from the windows bootloader. The first place where should be a big warning is that if you select. Boot from boot partition it basically means that if you select that you cant boot your PC anymore. Took some time before I figured that out.

And the last thing after reinstalling opensuse like 12 times I didnt found a way to setup it like I want without installing grub and writing the bootloader to the MBR. So I got a chainloader now.:frowning:
I think there is not option to write the necassary files to boot from Grub without installig grub. Or am I wrong?

Any advice please?

What if I print my normal suggestions when loading openSUSE with Windows?

Each hard drive can have up to four PRIMARY partitions, any of which could be marked active and bootable. No matter what you might hear, only one of the first four primary partitions can be booted from. That means you can boot from Primary partitions 1, 2, 3 or 4 and that is all. In order to boot openSUSE, you must load openSUSE and the grub boot loader into one of the first four partitions. Or, your second choice is to load the grub boot loader into the MBR (Master Boot Record) at the start of the disk. The MBR can be blank, like a new disk, it can contain a Windows partition booting code or generic booting code to boot the active partition 1, 2, 3, or 4. Or, as stated before, it can contain the grub boot loader. Why load grub into the MBR then? You do this so that you can “boot” openSUSE from a logical partition, numbered 5 or higher, which is not normally possible. In order to have more than four partitions, one of them (and only one can be assigned as extended) must be a extended partition. It is called an Extended Primary Partition, a container partition, it can be any one of the first four and it can contain one or more logical partitions within. Anytime you see partition numbers 5, 6 or higher for instance, they can only occur inside of the one and only Extended Primary partition you could have.

What does openSUSE want as far as partitions? It needs at minimum a SWAP partition and a “/” partition where all of your software is loaded. Further, it is recommended you create a separate /home partition, which makes it easier to upgrade or reload openSUSE without losing all of your settings. So, that is three more partitions you must add to what you have now. What must you do to load and boot openSUSE from an external hard drive? Number one, you must be able to select your external hard drive as the boot drive in your BIOS setup. Number two, you need to make sure that the external hard drive, perhaps /dev/sdb, is listed as the first hard drive in your grub device.map file and listed as drive hd0. I always suggest that you do not load grub into the MBR, but rather into the openSUSE “/” root primary partition which means a primary number of 1, 2, 3 or 4. If number one is used, then that will be out. You will mark the openSUSE partition as active for booting and finally you must load generic booting code into the MBR so that it will boot the openSUSE partition. I suggest a partition like this:

  1. /dev/sda, Load MBR with generic booting code
  2. /dev/sda1, Primary NTFS Partition for Windows
  3. /dev/sda2, Primary SWAP (4 GB)
  4. /dev/sda3, Primary EXT4 “/” openSUSE Partition Marked Active for booting (80-120 GB)
  5. /dev/sda4, Primary EXT4 “/home” Your main home directory (Rest of the disk)

<OR>

  1. /dev/sda, Load MBR with generic booting code
  2. /dev/sda1, Primary, booting NTFS Partition for Windows (small < 500 mb)
  3. /dev/sda2, Primary, NTFS Partition for Windows (Main / Large Partition)
  4. /dev/sda3, Primary EXT4 “/” openSUSE Partition Marked Active for booting (80-120 GB)
  5. /dev/sda4, Primary Extended Partition (Rest of Disk)
  6. /dev/sda5, Logical SWAP partition(4 GB, inside Extended)
  7. /dev/sda6, Logical EXT4 “/home” Your main home directory (Rest of the Extended partition)

I normally do not suggest you attempt to use the Windows boot loader to select openSUSE. Further, even though I chain load to Windows from the openSUSE grub menu.lst file, it does not again ask what OS to load in Windows, but goes directly into loading Windows. I see no reason to not use the Grub Boot loader for all things on your PC. Other thinks of note, you need for the WIndows partition to be marked active in order to load a service pack or to use its backup program. If seems if you have a complex disk partition setup, the 100 MB Windows 7 boot partition is not big enough for the backup program to work. It is suggested you make this partition 499 MB (under 500 MB) for best results.

You say you compile kernels. You may want to look at these blogs:

SGTB - SuSE Git Kernel Tarball Creator - Version 1.70 - Blogs - openSUSE Forums

<and>

S.A.K.C. - SUSE Automated Kernel Compiler - Version 2.50 - Blogs - openSUSE Forums

Thank You,

You have to install grub. That’s because Windows cannot load linux, but it can load grub. So, at the least, you need grub (or a similar loader such as lilo) to load linux.

I currently have both my laptop and desktop set to boot Windows, and to load linux from the Windows boot loader (which loads grub and in turn grub loads linux). I think that’s what you want. It wasn’t hard to do.

Here’s how I did it when I first installed linux on my laptop:

1: I went with the installer defaults, which were to install grub on the extended partition and to mark the extended partition (partition 4) as the active partition. Linux itself was installed in a logical partition.

2: The system now booted using the grub menu. That’s about where you are now.

3: While in linux, as the root user, I did:


dd if=/dev/sda4 of=/windows/C/bootsect.lnx count=1

In the above, “/dev/sda4” is the extended partition, where the installer placed the grub boot code, and “/window/C” is the main Windows partition. In my case, that happens to be /dev/sda3.

4: Still as root on linux, I now ran


fdisk /dev/sda

Once inside “fdisk” I changed the active flag for booting:


a
4
a
3
w

That toggled (and thus turned off) the active flag for the extended partition. Then it turned on the active flag for the Windows partition. Then the “w” wrote the results back to the partition table and exited from “fdisk”.

I now rebooted. That took me straight into Windows, but with no way of getting into linux.

Finally, I used BCDEDIT to setup the Windows boot manager to provide an entry that boots the file “bootsect.lnx” that I had put in the Windows directory.

All that remained was to test and make sure that it all worked (it did)

The technical details (partition names, numbers, etc) for you might be different from what they were for me. If you need hand holding, then post the output of “fdisk -l /dev/sda”.

I hope that helps.

On 2011-10-26 03:46, 3PW wrote:
> And the last thing after reinstalling opensuse like 12 times I didnt
> found a way to setup it like I want without installing grub and writing
> the bootloader to the MBR. So I got a chainloader now.:frowning:
> I think there is not option to write the necassary files to boot from
> Grub without installig grub. Or am I wrong?

You have to install grub yes or yes. But it doesn’t have to go in the MBR,
it can go into the linux partition, and thus you first get the windows boot
menu, then the grub boot menu if you choose linux. I installed my laptop
that way for a while, then removed easy bcd and left grub alone.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)