Edit: I'd like to simplify the question a bit:

The main issue is this: /dev/sda is being created on boot whether my USB drive is inserted or not. If I manually rm /dev/sda, udev works correctly until I reboot, at which point /dev/sda magically appears again!

Original question follows:

I'm running a Yocto Linux build on an embedded board and I've run into a problem.

With a fresh build, when I plug a USB drive into the board, it shows as /dev/sda and /dev/sda1 (great!). When I unplug the drive those entries disappear (also great!).

The problem happens after I copy a duplicate root filesystem onto the board via the USB drive (this is so I can do full system updates to the board). Everything works fine until I reboot, when suddenly /dev/sda and /dev/sda1 exist whether the USB drive is inserted or not.

I've checked the permissions and they look the same in both cases. I've tried removing the files but they reappear on the next reboot. The two files are not copied over with the new root filesystem. My application uses the presence of those files to determine whether a drive is inserted, so it's important that they work correctly.

Any ideas?



1 Answer 1


Change the way you check for USB drive, because this one is unreliable.

Use lsusb or check /proc/scsi/usb-storage directory. Both ways you get a lot of info from kernel, so additionally you can play with stuff like switching to different logic based on vendor or serial number :)

  • Thanks for the comment. I'm not sure lsusb will tell me enough information, since I can't run a mount command based solely on information from the output of lsusb (need to know where it is in /dev). And /proc/scsi does not exist on my system. Shouldn't udev be able to add or remove the device in /dev reliably? This isn't a problem before I overwrite the filesystem. Aug 13, 2014 at 22:22

You must log in to answer this question.

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