Logo 
Search:

Unix / Linux / Ubuntu Answers

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds
  on Dec 12 In Unix / Linux / Ubuntu Category.

  
Question Answered By: Adah Miller   on Dec 12

Anyway, they are less relative than what DOS/Windows uses,
that is C: D: M: N: W: Y: Z:

The Linux system identifies which physical drive as well
as which partition; Windows identifiers don't distinguish,
which I'd say is more confusing.

> The terms sda and sdb or hda and hdb, typically used in
> file managers, are fixed. Sda or hda is the first drive
> listed in the BIOS and sdb or hdb is the second one.
> This is easy to understand.
>
> However, grub is relative, meaning that you can switch
> the drive to which grub is written to. In some case sda
> could be hd0 and in other cases sdb could be hd0. It
> all depends on where grub is written to. Hd0 is always
> the drive on which grub is written to.

Thanks, that clarifies a lot. What I'd read somewhere
else is that sd and hd were simply two different ways that
Linux refers to drives. (I just *knew* there had to be
more to it than that :-)

> You can find out how grub is named on your computer by
> opening the file /boot/grub/device.map.

Mine is like this:

(hd0) /dev/sda
(hd1) /dev/sdb

If I had grub written to what is now sdb then I assume
Linux would not boot because the BIOS points to sda
and the computer looks to the primary drive for a
bootloader. Right? As things stand now, Windows would
also not boot because upon installing Ubuntu the
bootloader on sda's MBR was overwritten by grub. But
such a situation would not come about normally, right?
I chose to dual-boot Windows and Linux when I set
up Ubuntu and that arranged for grub to be written to
sda where my Windows resides.

Then, another way to set up dual boot would be to
install another hard disk, which I did, have the BIOS
point to it as sda, and install Ubuntu on that drive
(which for me is now sdb). Then to switch operating
systems I would go into the BIOS and switch how it
points to the primary drive. Somewhat more awkward than
simply choosing which OS to boot from the grub menu,
but it would not have touched what Windows calls the
C: drive in any way. Right? Another way to
set up dual-boot.

And, no matter where grub is, the configuration file
menu.lst is always part of the Linux installation,
which means that grub calls upon it separately to know
how to boot, right? Then, if I were to have reset the
BIOS to point to the new hard disk before I installed
Linux -- which (according to my original BIOS setup)
would have meant that grub would have ignored Windows's
C: drive -- then grub would look at menu.lst on what
it perceived to be a different drive than what it does
now. Not that it matters, just trying to grok what
happens at boot.

>> If so, how is it that Linux got Windows
>> to relinquish the first reading of this MBR upon
>> the Ubuntu installation? If I choose Windows from grub
>> then I assume it simply returns control of the MBR
>> back to Windows as in the original case?
>
> Reply: Windows has its own bootloader. When grub is
> written to the MBR it replaces the Windows bootloader
> with its own rather than modifying the Windows
> bootloader. In contrast, Wubi uses the Windows
> bootloader and merely adds a line to it for Ubuntu.
> Ubuntu assumes that you want Ubuntu to boot first
> and that it will be the default OS. This can be
> changed as grub is just a text file that can be
> edited with root permissions, sudo.

Right. I've done that and set up Windows to boot
by default, then changed it back again. BTW, is
there any problem with removing or commenting out
all the old Linux kernels that are still listed?
They make the grub menu look messy.

> Windows needs a bootloader, like Linux, to point
> to its kernel loader. It assumes that it will be
> its own, but does not actually check so as long
> as grub points to the right place Windows won't
> know or care. When Ubuntu is removed then the
> Windows bootloader must be restored so that Windows
> can find its kernel loader once again.

How? Can Linux be called to do this upon its dying
breath?

> Otherwise you will get the ntldr missing error.
> In both cases the bootloader is traditionally
> written to the MBR. However, grub can be written
> the to root directory or chainloaded.

?? Then how would the computer find it at startup?

> Windows is untouched by your Ubuntu installation,
> no matter where it is located,

BUT the Windows bootloader is overwritten, even
though it is not officially part of the OS.

Share: