2

I am currently booting a kernal (via uboot) from a usb drive which works fine.

The issue I am having is when the SSD is plugged in it uses the SSD as the sda1 and i have to unplug the SSD for the usb to be used as sda1 but I need both attached and I need the SSD to be sda1 when the usb is not present...

any ideas?

3
  • 2
    You should be using UUIDs instead of relying on random /dev/sdx names. Aug 20, 2015 at 11:17
  • could you help me out a bit more? great starting point for me to search but I would appreciate if you could tell me some more details to narrow my search or even how to do this?
    – TheHidden
    Aug 20, 2015 at 12:56
  • @user1779617 you need to replace /dev/sda1 with the corresponding UUID cyberciti.biz/faq/linux-finding-using-uuids-to-update-fstab
    – avsmal
    Aug 20, 2015 at 14:11

1 Answer 1

0

First question is why you rely specifically on /dev/sda1. Assuming it is for the "root=DEVNAME" parameter to the kernel, the way most distros solve this is by using an initrd whose init script looks at all the available devices and intelligently picks one. This is how many distros allow you to say things like "root=LABEL=MY_ROOT"; the kernel isn't processing that, the init script is. The init script can run tools like "blkid" to identify block devices by UUID or by filesystem label.

Unfortunately building your own initrd is kind of a lengthy learning process, but there's lots of guides out there to help you get what you need.

Now, if your problem was with the mount command, mount already supports mounting by UUID or LABEL (see man mount), so that's a pretty easy change.

1
  • I shall start my search based on this, though I do not understand linux alot yet so it will take me a while any more tips you have would be great. u-boot is handling what device to boot off / boot order but then obviously the kernal on the usb boots from the SSD as SDA/ root :( where do i change this? the usb or u-boot?
    – TheHidden
    Aug 25, 2015 at 8:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .