Specifically, using udev to automount usb memory sticks takes about 3-4 seconds according to its own logs. It may not sound like that much, but it is on an embedded distribution for a system that previously used a much lighter OS where they where ready to use at less than 1 second. I do not have to make it that fast, but it is currently slow enough to annoy the users of the system.

In short, what options do I have when it comes to speeding it up?

  • The first step should be to profile what's going on now, to see where that time is spent. Turn up kernel and udev logging. Only you, with the device in front of you, can do this. – Gilles 'SO- stop being evil' Jun 10 '14 at 23:05

As Gilles commented, you can turn up kernel and udev logging. Arch Wiki has a great source[1] for this. Consider using these kernel parameters at the very least:

debug ignore_loglevel log_buf_len=10M LOGLEVEL=8 earlyprintk=vga,keep udev.log_priority=8

Sounds like your OS is on an embedded system, so YMMV with a 10M log buffer. Adjust accordingly.

Last year a Gentoo user scaled his boot sequence down to under 2 seconds by digging through his boot process for arbitrary sleep calls (among other things) and replacing them with relevant synchronization primitives[2]. If this inspires you, then as you profile, discern the code path used to mount your usb drives, and review its source code for arbitrary sleep calls.

It's difficult to provide a definite course of action without more details.

  • What OS are you using? What version?
  • What version of udev?
  • Which mount program are you using? What version?
  • Etc.

If these options are too low-level, you might try replacing parts of your distro with alternatives. Look into mdev as a replacement for udev (assuming you're not using systemd), or edit your automount udev rules and swap out the mount program for another utility (mount, pmount, udisks, udevil, etc).

Other than that, Google, read, probe, tweak, and measure.

Find below some possible reading material about automounting with udev.

[1] https://wiki.archlinux.org/index.php/Boot_debugging
[2] http://gentooexperimental.org/~patrick/weblog/archives/2013-10.html
[3] http://www.tuxradar.com/answers/526#null
[4] http://wp.dejvino.com/2013/08/linux-udev-usb-automount-script/
[5] http://ubuntuforums.org/showthread.php?t=168221

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.