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.