Adding a disk with installed OS to Grub2

I have a 64 bit machine with one sata drive on which I have installed Windoze 7 and openSUSE 12.3. I have grub in root partition of openSUSE and at present grub controls boot process and offers openSUSE 12.3 and Windoze on the menu at start up and I can boot into either OS fine with only this drive installed.

I have a second sata drive on which I have installed eCS and air-boot which controls the boot process and all is fine with only this drive installed.

What I want to do is to be able to put both drives in the machine and have grub control boot with eCS added to the grub menu.

Unfortunately if I put both drives in the machine it is always air-boot which starts the boot process whichever sata sockets I use and although air-boot shows the linux partitions, booting fails if I select a linux partition.

I am working on how I maight disable air-boot but how should I add the eCS drive to the grub boot menu please?

Budgie2

Correction to the above. With both drives in machine grub boots but does not offer the OS on the second drive. What do I edit to add the second drive please?
Budgie2

Where bootloader for eCS is installed? Is it in MBR of the drive, somewhere else?

Good question and I am not sure of the answer. Airboot controls boot process of eCS drive and the eCS partition is marked startable. I shall do some more investigation on this. Meanwhile a further correction to the original post. The booting depends on which drive is in first SATA port:—

If the eCS drive is in 1st SATA port, then Airboot boots and offers a boot menu showing all partitions on both drives. However if a linux partition is selected it fails to start and I get error messages. (I think Airboot config is wrong but cannot find man pages)

If the Linux/windoze drive is in 1st SATA port then grub menu shows openSUSE and windoze, both of which will work, but the menu does not show any other choices and ignores the second drive.

I had hoped to add the eCS drive to the grub menu and have it chain load. If necessary I can un-install Air-boot.

Grateful for further advice.
Regards,
Budgie2

Of course. BIOS will try to boot first drive in boot order list. Usually you can change boot order in BIOS.

I had hoped to add the eCS drive to the grub menu and have it chain load.

The first thing is to test manually. Press ‘c’ when you are on grub menu to enter CLI. Use

set pager=1
ls -l

You will see all recognized disks with partitions. One of them will have Linux partitions, so eCS driver should be another one. “set pager” is to enable pause after each screen. Now try to issue

chainloader (hdX)+1
boot

Where (hdX) is your eCS drive. Most likely it will be (hd1). It will attempt to chainload bootloader in MBR of second disk where eCS is installed. If this succeeds, this can also be added to grub2 menu.

Note that it may need additional drive remapping, but we’ll never know until tried.

Hi and many thanks for the instructions.
I did exactly as you suggested.

After the “boot” instruction I received an error message that Air-Boot was no longer intact and I should restore it. The system then had to be reset. Air-boot sits entirely in first track of disk so I guess the instruction changed the mbr of the drive. I reset the system and grub started as before.

What I do not know is how to add the other drive to the grub menu.
Please could you advise?
Regards,
Budgie2

On 2013-10-06 21:36, Budgie2 wrote:

> Air-boot sits entirely in first track of disk so I guess the
> instruction changed the mbr of the drive.

Very unlikely.
Rather airboot does not work if not first disk. That’s a guess, I don’t
know how airboot works. The wikipedia article says nothing.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

OK, so you can try whether drive remapping helps.

I guess the instruction changed the mbr of the drive.

No, it did not.

Try the following in grub2 command line:

drivemap -s hd0 hd1
chainloader (hd1)+1
boot

This assumes your grub drive is hd0 and eCS drive is hd1. The goal is to pretend drive with eCS is the first one.

Hi and many thanks once more.
The technical reference for AiR-BOOT is not yet available but I have the User Manual for version 1.1.0. It does seem as though it expects to reside on the first drive as it is put in first track of the disk and detects almost all changes to disks and partitions on the fly. For this reason I do not understand why it cannot boot the linux partition which it includes on the menu if I have the disk as the first drive.

Going back to your instructions and with the linux drive as the first drive I have used grub cli as you advise.

After the boot command, the AiR-BOOT menu came up which I take as success.

Subsequent re-booting took me back to the grub2 menu but still of course no item for eCS drive.
Regards,
Budgie2

On 2013-10-07 23:56, Budgie2 wrote:

> After the boot command, the AiR-BOOT menu came up which I take as
> success.
>
> Subsequent re-booting took me back to the grub2 menu but still of course
> no item for eCS drive.

You need to create a menu entry yourself with the base of those manual
commands. I don’t know how to do that with grub2.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

Did you try to boot it to be sure?

Subsequent re-booting took me back to the grub2 menu but still of course no item for eCS drive.

As we are in openSUSE forum - create /boot/grub2/custom.cfg with contents

menuentry 'eCS Bootloader' {
  drivemap -s hd0 hd1
  chainloader (hd1)+1
}

You will get your menu entry on next boot. Adjust title to taste :slight_smile:

Do not forget that if your HDD configuration changes, menu entry may stop to work.

On 2013-10-08 18:46, arvidjaar wrote:

> As we are in openSUSE forum - create /boot/grub2/custom.cfg with
> contents
> Code:
> --------------------
> menuentry ‘eCS Bootloader’ {
> drivemap -s hd0 hd1
> chainloader (hd1)+1
> }
> --------------------
>
> You will get your menu entry on next boot. Adjust title to taste :slight_smile:

It is that easy to create a menu entry in grub2? Wow, thanks. Noted :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

Understood. I attribute the problems I am having to having installed both OSs with their respective drives as disk1. I assumed grub2 would not be confused by changing disk position because it uses UUIDs but clearly I am not correct. Grateful for your help so far.
Regards,
Budgie2

Hi arvidjaar,
OK, ignore my last post. I have removed AiR-BOOT and re-written the second drive MBR for normal eCS boot and made partition startable.

Your commands to add the eCS line to grub2 menu worked fine. I am sorry I just didn’t see the extra line when I first tried because I rebooted without going back to grub2 GUI. After entering your commands in grub cli and then going back to grub2 gui by using esc the extra line was there and if selected booted the second drive to eCS.
Unfortunately the change was not permanent. How do I make the change to the grub2 menu permanent please?
Regards,
Budgie2

grub2 uses UUIDs when it a) knows how to lookup them and b) is told to do it. In this case it neither knows anything about eCS nor is told to search for UUID in this menu entry. So it will simply try to chainload MBR of second disk in BIOS order, whatever this disk happens to be.

I lost you here. What do you mean “without going back to grub2 GUI”? You get menu automatically as long as configuration file includes at least one menuentry statement. And changes in custom.cfg are permanent.

I cannot recall how I re booted after executing the grub commands but I didn’t see the additional menu line first time. I did see it the second time and was able to boot eCS from grub. However when I next started the machine the extra line was missing from the grub menu.

Now you have lost me. I understood that I needed to write a new script “40_custom” to go in grub.d directory in order to make changes permanent in grub.cfg by then running update-grub. I have not found the file custom.cfg on my system. Where should it be?

Hi arvidjaar,
Now I have it. I am sorry I didn’t read your instruction carefully before and had been confused by the documentation I had found. The custom.cfg file is so simple it seems too good to be true but all is well now. Many many thanks.
Regards,
Budgie2

Hi arvidjaar,
Again many thanks for sorting out my dual boot issues. I am sorry I have been so slow on the uptake. I have however had difficulty finding documentation for what you have explained re custom.cfg but it worked just fine so thanks again.

There is still an issue which is bugging me concerning the way we have had to persuade grub2 to pretend that disk 2 is disk 1 by swapping. I would prefer to have them seen correctly which would mean renaming the disks or use the UUID approach. Where should I read up on this?

Budgie2

On 2013-10-11 01:46, Budgie2 wrote:

> There is still an issue which is bugging me concerning the way we have
> had to persuade grub2 to pretend that disk 2 is disk 1 by swapping. I
> would prefer to have them seen correctly which would mean renaming the
> disks or use the UUID approach. Where should I read up on this?

No, it is grub which persuades the booter in disk 2 that it is disk 1.
It is ecs2 which has to be persuaded.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))