Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I am searching for a way to change the ordering of loading for USB mass storage devices. I have a small embedded board with a USB stick containing root ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2

    Naming of USB mass storage devices


    Hi,

    I am searching for a way to change the ordering of loading for USB mass storage devices.

    I have a small embedded board with a USB stick containing root and /boot partitions and a big USB hdd for data. My bootloader is uBoot.

    When booting with only the USB stick attached everything works as expected. Stick is detected as sda by the kernel.
    When I additionally attach my hdd at boot time, my stick is detected as sdb and the hdd claims sda which gives me troubles defining "root" kernel parameter.

    As this is a headless machine there is no way to define multiple boot targets or whatsoever.

    Is there a way to force the kernel to assign sda to my USB stick?

    thanks
    Christian

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,517
    The order devices are discovered is indeterminate, by design. Your mount order in /etc/fstab can be configured to use /dev identifiers, partition UID's, or file system label names. Myself, I prefer label names. You can label your devices, and specify the label in /etc/fstab, and it will mount stuff accordingly, otherwise, every time you add a new HD device, things go wonky (highly technical term implying "doesn't work any more")...

    Example (from my system's /etc/fstab) illustrating both methods:

    Code:
    UUID=0e9c3025-59d3-424e-818f-c305c819b4e7 /                       ext4    defaults        1 1
    UUID=7819b966-a8e6-4d61-87c1-d377e3074bd8 /boot                   ext4    defaults        1 2
    UUID=b2703a11-9292-4d2f-afe6-665c46b8fa60 swap                    swap    defaults        0 0
    /dev/mapper/VolGroup00-LogVol00           /home                   ext3    defaults        1 2
    LABEL=afs-esata-a1  /mnt/array1                                   ext4    defaults        1 2
    LABEL=afs-esata-1   /mnt/esata1                                   ext4    defaults        0 0
    Hope this helps.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2
    Thanks for pointing me to use LABEL in fstab. Works like acharm there.

    So I see there is no way to influence kernel usb detection. Which makes me change to plan B, use an initrd to mount root by label...

    thanks for your reply!

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,517
    Happy to provide what little help I can!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •