Re: Debian bootable on external USB-harddisk

From: Enrique Perez-Terron (
Date: 10/11/05

  • Next message: "Re: dual boot problem..."
    Date: Tue, 11 Oct 2005 03:09:20 +0200

    On Sun, 09 Oct 2005 09:57:58 +0200, Andreas Rittershofer <> wrote:

    > Enrique Perez-Terron wrote:
    >> On Sat, 08 Oct 2005 23:44:29 +0200, Andreas Rittershofer
    >> <> wrote:
    >>> Bill Marcum wrote:
    >>>> On Sat, 08 Oct 2005 16:39:08 +0200, Andreas Rittershofer
    >>>> <> wrote:
    >>>>> I want to install Debian on an external USB-harddisk so that it can
    >>>>> boot from it. The installation runs fine, also the creation of the
    >>>>> initrd with the usb-stuff and grub installation - but then it does not
    >>>>> boot.
    >>>> What happens when you try to boot? Do you get the BIOS "no operating
    >>>> system" message, or a Grub menu or error message? Does it start to load
    >>> When I switch off the internal hd in the BIOS I get the message "no
    >>> operating system, press any key ..."
    >>>> Linux and then freeze or panic, or does it boot the OS on the internal
    >>>> hard disk (if there is one)?
    >>> When the internal hd is active then it boots from it - obviously because
    >>> on the external hd no os was found.
    >>>> Some information about your CPU, motherboard, etc. might be helpful.
    >>> I tested it on a desktop and on a notebook, both with intel. The result
    >>> was always the same.
    >> Where are the kernel and the initrd image? They must be accessible from
    > They are all on the external harddisk since I want to boot from this
    > external harddisk.
    >> the BIOS before the kernel is loaded & started. The grub install should
    >> (ideally) fail if you have placed the kernel and initrd on the external
    > No, it does not fail.
    >> hd, but this does generally not happen, because Grub, when running under
    >> Linux does not have enough information about what is and what is not
    >> available from BIOS.
    > Ok.
    >> According to what you tell, it sounds like you have even placed
    >> grub stage one on the external disk. Have you? If so, how shall
    > Yes, see above.
    >> your computer start grub when you boot? (But most likely it wasn't
    >> you, it was the installation program :) )
    > I simply want to take my external hd with me, plug it in some computer and
    > boot the linux on it.
    >> The typical solution has
    >> - Grub stage one on hda's MBR, where the Bios will get it.
    > This sounds as it is not possible to boot from an external hd, since I need
    > to install it on the internal hd.
    >> If your Bios setup offers to boot from D:, you can have
    > The BIOS offers to boot from USB-FDD and on another computer also from
    > USB-HDD. The BIOS does imho never offers drive letters as c: or d:.

    This should really be the enabling feature.

    The question then is if and how grub and other boot loaders "see" the
    external drive. I mean, if your bios offers to boot from usb-hdd, it
    should mean that the bios will read one sector off that device and place
    it in memory, and then run whatever code that sector contains.

    The first question then is, is this happening? I the bios code recognizing
    the external drive? Are the symptoms somehow different if you "forget"
    to attach the cable to the external drive? Do you observe any activity,
    like a led lighting or a noise indicating that the drive is being accessed?

    If this sector is Grub's stage one, this code must be able to ask
    the bios to get other sectors as well. Grub uses bios calls to load further
    sectors, and specifies 0x80 as the drive number if it wants the primary master
    disk. Numbers below 0x80 are floppies.

    When grub is installed in that boot sector, it must be hardcoded into that
    code what blocks (and what device) to ask for to get stage "1.5", the
    file-system savy code. I see when I install Grub on my disk that it says
    it has "embedded 15 sectors of stage 1.5". I believe that means the the
    block numbers have been embedded into the stage 1 image installed into
    the boot sector.

    I have the impression that it is possible to "embed" not only block numbers,
    but also a drive number into the stage 1 code. I had installed grub's stage
    one into my hda, while all the other code was in hdb1. My bios only offers
    the primary master disk (or floppy or cd). But what drive number must grub
    use to specify the external drive? 0x80, when the initial boot sector is
    taken from it? What if you have grub stage one on a local disk (hda),
    what drive number must grub use then?

    There is a way to find out: Create a grub floppy, and boot off it.
    When you have the grub prompt, use the "find" command, and ask for a file
    that only exists on the external drive. Notice that if you are asking
    for a file that resides on a partition that is usually mounted as /home,
    you must specify the file name without the /home prefix, just the path
     from the root of the partition. Grub is then supposed to look into
    all partitions it can find and access. I guess it tries in turn all device
    numbers from 0x80 and up to a maximum returned by your bios after a
    disk parameters call. If you place a file called "here" on the partition
    containing the kernel and the grub higher stages, and the find command
    returns "(hd12,2)/here", then you should say "root (hd12,2)" and "setup
    (hd-whatever)" to place stage 1 in hd-whatever, with the appropriate
    drive and block numbers embedded to get stage 1.5.

    >> grub stage one there. Or, you can have another boot loader
    >> than grub in hda's mbr, and use that one to chainload
    >> grub stage one from a partition accessible to that other
    >> boot loader
    > That's what I also tried: On the internal hd is LILO with an entry pointing
    > to the partition on the external hd, but all I get is "ERROR 0x01".

    I guess the same question can be asked about lilo as about grub: what
    device number must lilo use to load the kernel using the Bios? If that
    number is being guessed while installing lilo while running the kernel,
    it may not work, because the kernel does not necessarily see the devices
    in the same order as the Bios does. Especially is the Bios order changes
    when the external device is offered by the bios as the boot device.

    >> - The kernel and initrd, and also grub's configuration file
    >> (grub.conf) all on a partition accessible from the BIOS.
    >> That is often just the IDE or SATA drives. This is because
    >> Grub uses BIOS calls to access the disks.
    > Again this sound to me like it is not possible to boot from an external hd.

    It should not be impossible, to my (urneliable) knowledge. But it depends
    on the Bios and the details of how the steps are chained.

    >> Notice the difference in requirements for the placement
    >> of grub's stage one and the rest. Stage one must be where
    >> the Bios will look for it by its own initiative. The rest
    >> must reside where the Bios can read it when being instructed
    >> to look there by stage one.
    >> - The root file system somewhere accessible to the kernel
    >> using the modules in the initrd.
    >> - Other file systems (/var, /home...) somewhere accessible
    >> to the kernel after loading modules in /lib/modules (which
    >> is on the root fs.)
    > I also tried to boot a rescue system from CD and then enter root=/dev/sdb2
    > boot it cannot find a kernel there while there really IS one.

    That rescue CD, what does it contain? A minimal Linux kernel? Or a program
    that uses the Bios to access the drives? I would think it had to be a linux
    kernel. But then, why cannot that kernel access the device? Can you access the
    device otherwise, when running a kernel that was loaded from elsewhere?

    Or could there be a small confusion here. "root=/dev/sdb2" sounds like a kernel
    command line option. But then this is not where the kernel is looked up, this
    is the device that the kernel will mount as its root file system *after* it has
    itself been loaded into memory... from *somewhere*. How is that somewhere
    specified, and to whom?


  • Next message: "Re: dual boot problem..."

    Relevant Pages

    • Re: Naming harddisks (Linux)
      ... But I also see that for an USB drive it uses /dev/sdas the ... Does GRUB recognize SCSI drives? ... The first step in understanding the boot process is to ... The bootloader's job is to load the OSs kernel. ...
    • Re: maximum hard drive size in Latitude cpi
      ... > actually written a boot loader they won't be so adamant about how "Windows ... > of the disk, and while it is being read off of the disk the machine is ... > limitatoins of that BIOS. ... After that the kernel takes over. ...
    • Re: changing default os in grub
      ... > I've just installed a 2.6.8 kernel in Sarge and was ... > hoping the adjustment to grub would return Sarge to ... # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST ... # This entry automatically added by the Debian installer for an existing ...
    • Re: booting linux using a floppy
      ... which kernel of the list to boot from. ... Note that this will at this point remove your ability to boot into windows. ... I think I recall that you said the grub loader... ... and grub will search for a partition containing grub's stage2 file ...
    • Re: [opensuse] [Unsuccessful installation of operating system]
      ... proper Grub prompt commands succeed in starting SUSE boot. ... HD order in the BIOS might accomplish the same thing as a cable swap, ... If I had thought harder I would have suggested the BIOS be tried first. ...