papatrexasgre
Posts: 24
Joined: Thu Nov 13, 2014 2:52 pm

Booting from usb stick only takes longer

Thu Nov 23, 2017 12:10 pm

Hello all,

Some time ago I decided to start booting from a usb stick because of the many issues I had with corrupted/destroyed micro sd cards. I was still using a micro sd card during boot up, only to instruct the raspberry to load the os from sda2. That works ok, and the boot time is under 30 seconds. After that my fstab looks like this:
/dev/sda1 /boot vfat defaults 0 2
/dev/sda2 / ext4 errors=continue,noatime,nodiratime,commit=10 0 1
tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0
tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0
tmpfs /var/spool/mqueue tmpfs defaults,noatime,nosuid,mode=0700,gid=12,size=30m 0 0
so I don't use the sd card at all after boot. However I still have cases where I get micro sd cards corrupted, stopping the system from booting. The psu is a beast (24V 100W) and the step down converter is a proper 15£ one rated at 15W. So I don't think it's an issue with the power, but with the fact that the rasbperrys are switched off and on not properly and many times during the day. This unfortunately cannot change. It is the way I am using it and UPS, power off buttons, huge capacitors :) etc are out of the question. I am prepared to have destroyed usb sticks, but not micro sd cards. The reason is because the raspberry is hidden inside the machine I am using it with, with no easy access to it. The usb stick however is outside the machine using a usb extension lead. If I cannot stop the micro sd card from getting destroyed then I will have to boot only from the usb stick and ditch the micro sd card using the program_usb_boot_mode=1. But it raises the boot time from 30 seconds to 1 minute. Now I remember reading a post (which I cannot find anymore) that was talking about some seconds being "wasted" by the raspberry trying to see if there is a micro sd card plugged in, before timing out and moving in to booting from the usb stick. Does anyone know if I can change that timeout? Is there another way to speed up the booting process?

Sorry for the long post.

sora03
Posts: 193
Joined: Mon Dec 29, 2014 4:11 pm
Contact: Website

Re: Booting from usb stick only takes longer

Thu Nov 23, 2017 12:34 pm

here are the post that deals with the usb booting:
https://www.raspberrypi.org/documentati ... des/msd.md
https://www.raspberrypi.org/blog/pi-3-b ... rage-boot/
unfortunately I do not have a Pi 3 so I cannot test this boot process but I use the microsd on my Pi 2 to host bootcode and boot the OS in a USB HDD 2.5" i added a root delay 10 sec to file /boot/cmdline.txt to make sure that the drive init first. You can use the same process to Pi 3 but I you really do not want a corrupted SD I am not sure if putting the Microsd in Read only mode will protect it. You can also use the F2FS (Flash friendly filesystem) on the USB Stick so you can get better speed and long lifespan of USB stick and or microsd (or anything that uses flash memory (SSD etc). If the microsd gets corrupted even on proper shutdown you may want to check you Power (microUSB) cable if it is not thick enough (<18AWG is recommended but harder to find)
FLOSS enthusiast, Debian user (linux-libre)

Return to “Troubleshooting”