I have a custom buildroot build with minimalistic kerenel for the RPi and busybox as init and shell. At the end of the boot process I start my own service which tries to access the usb drive. However at this moment the usb driver is still initializing the usb devices including the USB drive. Kernel boots in about 4 seconds, USB device recognition takes another 4-5 seconds. So actually I would like to know how to get the USB drive automatically mounted during boot and only if that happens start my service. I could also mount the disk before starting my service, but also here it has somehow to know if the USB disk is already recognized and the /dev/sda1 is created.

  • 1
    systemd can do that, but might be a bit heavyweight for your application. A udev hook?
    – Tom Hunt
    Nov 24, 2015 at 23:30
  • systemd would be indeed too heavy. Buildroot's dev management is configured as "Dynamic using devtmpfs only".
    – Gamadril
    Nov 24, 2015 at 23:34
  • The usual tools for doing this would be systemd or udev. If you aren't using either of those, you probably have to roll your own, that is, write a program that watches the kernel messages until it sees the USB drive becoming ready, then does the automount and starts your service.
    – Tom Hunt
    Nov 24, 2015 at 23:36

1 Answer 1


If you built your kernel with inotify support you'd better use to wait for device creation using inotify. If not you can put this code to where before your service started by busybox init system:

# Waiting for device creation
while true                    
    test -e /dev/yournode         
    if [ $? -eq 0 ]; then
            echo "Device created";            
            echo "Waiting for device";        
            sleep 1;     

You must log in to answer this question.

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