Tdi-Me
Posts: 38
Joined: Fri May 05, 2017 8:11 pm

microsd and usb booting

Wed May 24, 2017 11:53 am

I set my system up to boot from usb, now i have an annoying issue, when i reboot it hangs. I figured out this is because i have a second usb drive i use for storage which i don't want to put an os on. It seems the pi likes to try to boot off the usb storage drive.
Anyone know how / if i can change this so i can remotely reboot it without issue?

Also i sorta screwed things up, i typed in init 1 to quickly shut down most services and then i powered off. Now the silly thing wont boot off this usb.

Also very curious, in changing the device so it can boot from usb did i remove the ability to boot from microsd?

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: microsd and usb booting

Wed May 24, 2017 12:09 pm

after disconnect all usb drives you should be able to boot from SD card again.

W. H. Heydt
Posts: 12648
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: microsd and usb booting

Wed May 24, 2017 3:46 pm

Read up on the PARTUUID method of specifying where the root partition is and for configuring /etc/fstab to point to the right device for things to work, rather than relying on the bootable USB device always coming up as /dev/sda.

As noted above, you can boot from an SD card (the Pi will look there first) and repair what you did to the (no longer) bootable USB device.

Tdi-Me
Posts: 38
Joined: Fri May 05, 2017 8:11 pm

Re: microsd and usb booting

Wed May 24, 2017 4:06 pm

weird, it looks like it already is using the uuid for root.

Code: Select all

pi@raspberrypi:~ $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=28c3660a-01  /boot           vfat    defaults          0       2
PARTUUID=28c3660a-02  /               ext4    defaults,noatime  0       1
unless i should be looking at something other than the fstab for boot.

W. H. Heydt
Posts: 12648
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: microsd and usb booting

Wed May 24, 2017 5:03 pm

Tdi-Me wrote:weird, it looks like it already is using the uuid for root.

Code: Select all

pi@raspberrypi:~ $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=28c3660a-01  /boot           vfat    defaults          0       2
PARTUUID=28c3660a-02  /               ext4    defaults,noatime  0       1
unless i should be looking at something other than the fstab for boot.
You should check /boot/cmdline.txt as well.

Tdi-Me
Posts: 38
Joined: Fri May 05, 2017 8:11 pm

Re: microsd and usb booting

Wed May 24, 2017 5:14 pm

It is listed there as well. However one thing i just realized, it might not really matter what the config files on the drive say.
My computer knowledge is a bit dated and mostly from traditional computers ( which the pi is not )
But if the bios is simply looking at any usb storage device as being bootable how would i tell it not to look at 1 drive over another before it tries to boot off it?
All the configuration in the world can be on say drive a but if the bios keeps looking to boot off drive b it wont matter whats on drive a at all.
Although i assume i could put something on drive b to point to drive a and have it boot off drive a every time?

W. H. Heydt
Posts: 12648
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: microsd and usb booting

Wed May 24, 2017 8:02 pm

First off...the Pi has no BIOS. What it has is a fairly simple chunk of code built into the chip that, when the boot process is started, is just barely bright enough to look for an SD card. If it doesn't find one, or it isn't bootable, *and* the "boot over USB" OTP bit is set, *then* it will start looking for a bootable USB device. It should check attached USB devices until it either finds one it can boot from or it runs out of devices to check.

Tdi-Me
Posts: 38
Joined: Fri May 05, 2017 8:11 pm

Re: microsd and usb booting

Wed May 24, 2017 9:08 pm

Ok,
I guess my next question would be, is there anything that can be done on say the microsd card to simply point it to a usb drive ( prefer bally a uuid ) for booting?
I am pretty sure i have a small microsd card ( by small i mean i think its 250mb ) that would be plenty of space to simply have some boot commands like telling the pi where to go to find the OS.

fruitoftheloom
Posts: 23337
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: microsd and usb booting

Wed May 24, 2017 11:28 pm

W. H. Heydt wrote:First off...the Pi has no BIOS. What it has is a fairly simple chunk of code built into the chip that, when the boot process is started, is just barely bright enough to look for an SD card. If it doesn't find one, or it isn't bootable, *and* the "boot over USB" OTP bit is set, *then* it will start looking for a bootable USB device. It should check attached USB devices until it either finds one it can boot from or it runs out of devices to check.
Tdi-Me wrote:Ok,
I guess my next question would be, is there anything that can be done on say the microsd card to simply point it to a usb drive ( prefer bally a uuid ) for booting?
I am pretty sure i have a small microsd card ( by small i mean i think its 250mb ) that would be plenty of space to simply have some boot commands like telling the pi where to go to find the OS.
If you had https://www.raspberrypi.org/documentati ... /README.md you would of noticed bootcode.bin - special boot....
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot)..
Asus ChromeBox 3 Celeron is my other computer...

Tdi-Me
Posts: 38
Joined: Fri May 05, 2017 8:11 pm

Re: microsd and usb booting

Thu May 25, 2017 12:13 am

fruitoftheloom wrote:
W. H. Heydt wrote:First off...the Pi has no BIOS. What it has is a fairly simple chunk of code built into the chip that, when the boot process is started, is just barely bright enough to look for an SD card. If it doesn't find one, or it isn't bootable, *and* the "boot over USB" OTP bit is set, *then* it will start looking for a bootable USB device. It should check attached USB devices until it either finds one it can boot from or it runs out of devices to check.
Tdi-Me wrote:Ok,
I guess my next question would be, is there anything that can be done on say the microsd card to simply point it to a usb drive ( prefer bally a uuid ) for booting?
I am pretty sure i have a small microsd card ( by small i mean i think its 250mb ) that would be plenty of space to simply have some boot commands like telling the pi where to go to find the OS.
If you had https://www.raspberrypi.org/documentati ... /README.md you would of noticed bootcode.bin - special boot....
Right, yea i have read that, not sure how it helps me at all. My issue is that i have 2 usb drives connected and when i reboot the pi doesnt seem to know how to differentiate between the one with a os on it and the one that is just storage.

Tdi-Me
Posts: 38
Joined: Fri May 05, 2017 8:11 pm

Re: microsd and usb booting

Thu May 25, 2017 12:57 am

I found something that works well for me and its pretty simple.
I made a bootable microsd card using Win32DiskImager used a stock image of rasbian jessie from raspberrypi.org.
Then i simply copied the cmdline.txt from my running image on the usb drive and copied that to the microsd card.
powered down the pi, inserted the microsd and whala. It boots up much faster now that it doesnt have to wait for the timeout on the micro sd card and it knows what drive to boot from.
I imagine this could easily be done by simply editing the cmdline.txt file also, i would highly suggest using the uuid over using /dev/sda simply so that if you switch around what port the drive is connected to the pi will still know what device to use.
Of course the down side to this is if i change out this drive i will have to edit the cmdline.txt file.

Return to “Beginners”