FAQ

[CentOS] Installing CentOS 6.2 *TO* a USB drive, not installing from USB.

Emmanuel Noobadmin
Apr 4, 2012 at 6:46 am
I'm trying to setup a very small system intended for doing
monitoring/logging. It's done on an Intel Atoms in a small box and the
idea was to simply run it off a pair of USB flash drives in software
RAID 1.

Now the problem is that while the 6.2 DVD installer could go through
the entire install process, grub will load then just stop at the
prompt. The system will work if I use a SATA hard disk so motherboard
compatibility is not an issue.

Attempting the various methods to re-install grub (via rescue mode) or
using the grub prompt to setup the disk does not work either. grub
just does not seem to be able to find the USB drives. e.g. commands
like root (hd0,0) just says device not found. This is despite grub
having just loaded from it and despite that grub-install in rescue
mode does not report any error.

Same problem even if I just go with one USB drive in a plain vanilla ext3 setup.

It seems that some sites are saying that EL variants just don't seem
to be adaptable to installing and running off USB drives. Is this
really the case and that I should be looking at using another
distribution or am I just missing some crucial steps in the process?
reply

Search Discussions

16 responses

  • Karanbir Singh at Apr 4, 2012 at 6:57 am

    On 04/04/2012 11:46 AM, Emmanuel Noobadmin wrote:
    just does not seem to be able to find the USB drives. e.g. commands
    like root (hd0,0) just says device not found. This is despite grub
    hd0,0 represents the bios device id, are you sure thats what your bios
    thinks the usb disk is at ?

    --
    Karanbir Singh
    +44-207-0999389 | http://www.karan.org/ | twitter.com/kbsingh
    ICQ: 2522219 | Yahoo IM: z00dax | Gtalk: z00dax
    GnuPG Key : http://www.karan.org/publickey.asc
  • Emmanuel Noobadmin at Apr 4, 2012 at 12:38 pm

    On 4/4/12, Karanbir Singh wrote:
    On 04/04/2012 11:46 AM, Emmanuel Noobadmin wrote:
    just does not seem to be able to find the USB drives. e.g. commands
    like root (hd0,0) just says device not found. This is despite grub
    hd0,0 represents the bios device id, are you sure thats what your bios
    thinks the usb disk is at ?
    I can't be sure which is part of the problem. Because when I read the
    grub documentation, it said that hitting tab at the prompt after
    typing the command will produce a list of possible devices/drives.
    However, in my case, nothing happens which seemingly implies grub
    could not find any device.

    I also did try manually doing (hd0,1), (hd1,0) but none of it seemed
    to be a "findable" device. For what it's worth, the installer did see
    them as sda and sdb. I also disabled the onboard SATA controller
    during my attempts in order to eliminate it from showing up as a
    possible device, since grub doc says the (hdx,x) number usually
    matches the order in which the devices were discovered.
  • Lamar Owen at Apr 4, 2012 at 1:06 pm

    On Wednesday, April 04, 2012 12:38:03 PM Emmanuel Noobadmin wrote:
    I also did try manually doing (hd0,1), (hd1,0) but none of it seemed
    to be a "findable" device. For what it's worth, the installer did see
    them as sda and sdb.
    The grub order and names and the linux kernel/udev order and names should not be assumed to have any correlation of any kind, since they are discovered differently.

    If you can boot a USB live media on this box, you could bring up a grub shell and see how grub sees the disks from that (at a root prompt, type 'grub' and you'll be greeted with the grub shell, and then you can do detection or whatever from that). This also works in the rescue environment given by the install media; you do want to do a 'chroot /mnt/sysimage' in that shell before entering the grub shell, though.

    It is completely BIOS dependent as to how the devices show up to grub.
  • Emmanuel Noobadmin at Apr 7, 2012 at 5:51 am

    On 4/5/12, Lamar Owen wrote:
    The grub order and names and the linux kernel/udev order and names should
    not be assumed to have any correlation of any kind, since they are
    discovered differently.
    Yes, that is what I understand from the grub manual. However, from
    that I also understand and expect the first and only device grub could
    find would be hd0
    If you can boot a USB live media on this box, you could bring up a grub
    shell and see how grub sees the disks from that (at a root prompt, type
    'grub' and you'll be greeted with the grub shell, and then you can do
    detection or whatever from that). This also works in the rescue environment
    given by the install media; you do want to do a 'chroot /mnt/sysimage' in
    that shell before entering the grub shell, though.
    I've done this previously from the rescue environment but got no
    closer to resolving this.

    I've tried it again with a default install of CentOS 6.2, using
    default drive layout and all.
    On first boot, I get the grub shell but I have not been able to find
    any command that would list valid devices grub can find, apart from
    the tab button.

    Rebooting into the rescue environment, chrooting into the drive,
    grub-install generates the map to hd(0) which was expected. Runing
    grub shell and trying root (hd0) also works.

    However, rebooting after updating the grub device map always results
    in "Booting from local disk... Error 21" which indicates grub couldn't
    find the drive specified.

    Any ideas how I can probe/list devices within grub shell? I've done
    the stupid method of root(hd0,x) all the way up to root(hd8,3) without
    luck.
  • Emmanuel Noobadmin at Apr 10, 2012 at 2:19 am
    In trying to solve this problem, I came across these two articles
    regarding GRUB and USB booting.

    http://vlinux-freak.blogspot.com/2011/01/how-to-create-grub-boot-floppy-usb.html
    http://bootloader.wikidot.com/linux:boot:usb-grub

    The floppy drive issue appears to be the situation as booting the
    rescue environment from a USB DVD does show up as /dev/fd0.

    However, the solutions in those articles did not work. In the first,
    the GRUB command/options are different, although changing the option
    from boot-directory to root-directory appear to work, there was no
    option to force floppy drive.

    In the second, the python script thinks the grub install has already
    been patched for floppy boot so couldn't do anything.

    I've also tried editing menu.lst to use (fd0) but also didn't work.
  • Phil Schaffner at Apr 10, 2012 at 7:19 am

    Emmanuel Noobadmin wrote on 04/07/2012 05:51 AM:
    Any ideas how I can probe/list devices within grub shell? I've done
    the stupid method of root(hd0,x) all the way up to root(hd8,3) without
    luck.
    Have you tried the grub "find" command?
    find /grub/stage1
    find /boot/grub/stage1
    etc.

    http://wiki.centos.org/TipsAndTricks/TroubleshootGRUB

    Phil
  • Patrick DERWAEL at Apr 10, 2012 at 7:47 am
    Emmanuel,
    I used a totally different approach by using VMware: the trick is to
    install on a physical device which is the USB drive.
    When the installation requests a reboot, simply boot on your USB and off
    you go!

    2012/4/10 Phil Schaffner <Philip.R.Schaffner at nasa.gov>
    Emmanuel Noobadmin wrote on 04/07/2012 05:51 AM:
    Any ideas how I can probe/list devices within grub shell? I've done
    the stupid method of root(hd0,x) all the way up to root(hd8,3) without
    luck.
    Have you tried the grub "find" command?
    find /grub/stage1
    find /boot/grub/stage1
    etc.

    http://wiki.centos.org/TipsAndTricks/TroubleshootGRUB

    Phil

    _______________________________________________
    CentOS mailing list
    CentOS at centos.org
    http://lists.centos.org/mailman/listinfo/centos


    --
  • Emmanuel Noobadmin at Apr 10, 2012 at 11:31 am

    On 4/10/12, Patrick DERWAEL wrote:
    Emmanuel,
    I used a totally different approach by using VMware: the trick is to
    install on a physical device which is the USB drive.
    When the installation requests a reboot, simply boot on your USB and off
    you go!
    That is pretty much what I did. Boot DVD 1 with a USB DVD drive,
    install to /dev/sda which is the USB flash drive. When the
    installation requests a reboot, shutdown, remove as well as leave the
    DVD drive around and reboot... and only grub prompt or Error 21.

    Maybe there's a minor but critical step I'm missing so I'll appreciate
    it if you could outline in greater details how you did it.

    I've tried installing grub to both MBR i.e. /dev/sda as well as first
    partition /dev/sda1 but neither works.
  • Mark Roth at Apr 10, 2012 at 11:34 am

    Emmanuel Noobadmin wrote:
    On 4/10/12, Patrick DERWAEL wrote:
    Emmanuel,
    I used a totally different approach by using VMware: the trick is to
    install on a physical device which is the USB drive.
    When the installation requests a reboot, simply boot on your USB and off
    you go!
    That is pretty much what I did. Boot DVD 1 with a USB DVD drive,
    install to /dev/sda which is the USB flash drive. When the
    installation requests a reboot, shutdown, remove as well as leave the
    DVD drive around and reboot... and only grub prompt or Error 21.

    Maybe there's a minor but critical step I'm missing so I'll appreciate
    it if you could outline in greater details how you did it.

    I've tried installing grub to both MBR i.e. /dev/sda as well as first
    partition /dev/sda1 but neither works.
    Two questions: a) are you sure that the USB key is /dev/sda, and b) does
    your system offer a boot menu, or only go into setup to tell it to boot
    off the USB key?

    Oh, and in fdisk, is the partition flagged bootable?

    mark
  • Emmanuel Noobadmin at Apr 12, 2012 at 12:59 pm

    On 4/10/12, m.roth at 5-cent.us wrote:
    Two questions: a) are you sure that the USB key is /dev/sda,
    Yes, I've verified this before and again after you asked that it is
    seen as /dev/sda, at least through the installation DVD. fdisk also
    does not find a sdb/c/d if I try that.
    and b) does your system offer a boot menu, or only go into setup to tell it to boot
    off the USB key?
    Both, I can set the boot sequence in BIOS, which is currently to boot
    USB first. And I can also hit F10 to choose.
    Oh, and in fdisk, is the partition flagged bootable?
    Yes, definitely :D
  • Patrick Derwael at Apr 10, 2012 at 12:46 pm
    Usuially, I simply use the default config for about everything; it worked
    well every time...

    I don't remember every detail... sorry for that

    -----Original Message-----
    From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf
    Of Emmanuel Noobadmin
    Sent: mardi 10 avril 2012 17:32
    To: CentOS mailing list
    Subject: Re: [CentOS] Installing CentOS 6.2 *TO* a USB drive, not installing
    from USB.
    On 4/10/12, Patrick DERWAEL wrote:
    Emmanuel,
    I used a totally different approach by using VMware: the trick is to
    install on a physical device which is the USB drive.
    When the installation requests a reboot, simply boot on your USB and
    off you go!
    That is pretty much what I did. Boot DVD 1 with a USB DVD drive, install to
    /dev/sda which is the USB flash drive. When the installation requests a
    reboot, shutdown, remove as well as leave the DVD drive around and reboot...
    and only grub prompt or Error 21.

    Maybe there's a minor but critical step I'm missing so I'll appreciate it if
    you could outline in greater details how you did it.

    I've tried installing grub to both MBR i.e. /dev/sda as well as first
    partition /dev/sda1 but neither works.
    _______________________________________________
    CentOS mailing list
    CentOS at centos.org
    http://lists.centos.org/mailman/listinfo/centos
  • Emmanuel Noobadmin at Apr 10, 2012 at 11:28 am

    On 4/10/12, Phil Schaffner wrote:

    Have you tried the grub "find" command?
    find /grub/stage1
    find /boot/grub/stage1
    etc.

    http://wiki.centos.org/TipsAndTricks/TroubleshootGRUB
    I'm deeply embarrassed and stunned by why I did not stumble across
    that googling or how I could miss seeing the command in grub shell and
    doc. I'll try this the next time I get to that machine again.

    Thank you very much!
  • Emmanuel Noobadmin at Apr 12, 2012 at 1:37 pm

    On 4/10/12, Phil Schaffner wrote:
    Have you tried the grub "find" command?
    find /grub/stage1
    find /boot/grub/stage1
    etc.

    http://wiki.centos.org/TipsAndTricks/TroubleshootGRUB
    I've tried that now but it could not find any of the files be it
    stage1, grub.conf or menu.lst, also tried both /grub and /boot/grub
    variants.

    The interesting thing is that if I leave the DVD in the DVDROM drive,
    grub will find it as hd111 with the tab button. So the tab
    functionality is actually working. Just that as far as grub is
    concerned, the flash drive it just loaded from just seem to be
    undetectable.
  • Emmanuel Noobadmin at Apr 12, 2012 at 4:02 pm
    On a random hunch or sheer desperation, I inserted an old brandless
    1GB USB thumbdrive, installed and it booted.

    Thinking that the Sandisk Ultra Backup 16GB was incompatible with
    CentOS/grub for some unknown reason. I switched to a brandless 16GB,
    installed the same way and it failed at grub prompt again.

    Now it is starting to look as if either the newer drives have
    something on them that prevents booting. Or it's the total size of the
    drive, regardless of the partition size. I say this because in every
    case I used a single 1GB ext4 / partition for testing, to reduce the
    mkfs time.

    Since now I have a bootable drive, I started to compare them with
    fdisk to see if there was any difference.

    Bootable
    255 heads, 63 sectors/track, 124 cylinders, start sector 63
    With a warning that
    "Partition 1 has different physical/logical endings:
    phys=(123, 254, 63) logical=(124, 140, 16)"

    Unbootable 16GB Sandisk Ultra Backup
    54 heads, 48 sectors/track, 12158 cylinders, start sector 2048

    Unbootable 8GB Sandisk Blade
    20 heads, 4 sectors/track, 195417 cylinders, start sector 2048

    Unbootable 16GB Unbranded
    171 heads, 40 sectors/track, 4634 cylinders, start sector 2048

    It seems that the common issue is starting at sector 2048 so I fdisk
    the 16GB Sandisk to manually create a 1GB partition started at sector
    63. Using this, I installed and was able to boot successfully.

    To verify, I use the same 16GB disk to install again, deleting the
    partition in anaconda and creating a new 1GB partition, ctrl-alt-f2
    and fdisk confirms it was again at sector 2048.

    As a side note, for some reason, drive geometry changed for the 16GB
    after a reinsert to varying values such as
    6 heads, 33 sectors/track, 159164 cylinders
    16 heads, 32 sectors/track, 61551 cylinders

    Not sure if this had any significance to why anaconda decides to fdisk
    the drive starting from sector 2048.

    My only guess is that it considers anything bigger than 4GB as a
    normal HDD drive and does this for hard disk alignment issue? But if
    grub could boot normally from such a HDD, why would it choke on a USB
    flash drive?

    Should I report this as a bug with anaconda or ?
  • Mark Roth at Apr 12, 2012 at 4:55 pm

    Emmanuel Noobadmin wrote:
    On a random hunch or sheer desperation, I inserted an old brandless
    1GB USB thumbdrive, installed and it booted.

    Thinking that the Sandisk Ultra Backup 16GB was incompatible with
    CentOS/grub for some unknown reason. I switched to a brandless 16GB,
    installed the same way and it failed at grub prompt again.

    Now it is starting to look as if either the newer drives have
    something on them that prevents booting. Or it's the total size of the
    drive, regardless of the partition size. I say this because in every
    case I used a single 1GB ext4 / partition for testing, to reduce the
    mkfs time. <snip>
    It seems that the common issue is starting at sector 2048 so I fdisk
    the 16GB Sandisk to manually create a 1GB partition started at sector
    63. Using this, I installed and was able to boot successfully.

    To verify, I use the same 16GB disk to install again, deleting the
    partition in anaconda and creating a new 1GB partition, ctrl-alt-f2
    and fdisk confirms it was again at sector 2048.

    As a side note, for some reason, drive geometry changed for the 16GB
    after a reinsert to varying values such as
    6 heads, 33 sectors/track, 159164 cylinders
    16 heads, 32 sectors/track, 61551 cylinders

    Not sure if this had any significance to why anaconda decides to fdisk
    the drive starting from sector 2048.
    Wonder if it's trying to beat the rush - after weeks of googling, a few
    weeks ago, I finally found that if I formatted my 3TB drives on a 4k
    boundry, instead of a 512byte boundry, writes were literally about four
    times faster, because that's the physical sector on the drives.

    It may be trying to do the same, to take care of this invisibly.

    Good catch on the USB drive business.

    mark
  • Emmanuel Noobadmin at Apr 13, 2012 at 12:52 am

    On 4/13/12, m.roth at 5-cent.us wrote:

    Wonder if it's trying to beat the rush - after weeks of googling, a few
    weeks ago, I finally found that if I formatted my 3TB drives on a 4k
    boundry, instead of a 512byte boundry, writes were literally about four
    times faster, because that's the physical sector on the drives.

    It may be trying to do the same, to take care of this invisibly.
    That is what I think the 2K first sector is supposed to do, align the
    physical sector be it a 512 or 4K drive. But unfortunately, the check
    for "is this a 4K HDD" appears to be naive.

Related Discussions