Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm running a Ubuntu system where USB drives are mounted automatically.
I'm curious to what happens when a USB device plugs in a port. Which part of the linux senses that a new device has been plugged in? After that which processes (and what is the caller or callers) are called to mount it to the system? Are theese kernel-space, user-space processes or mixed ?

I'd like to follow theese steps in a C/C++ program. Is there any way to do that? Where could I read more about it? How would you do it?

share|improve this question
1  
The Wikipedia page on udev is a pretty good place for an overview... –  jasonwryan Oct 19 '12 at 7:04
add comment

1 Answer

up vote 2 down vote accepted

As far as I know, there are several systems that can be used to react to a plugged-in USB device. One is udev, and this runs as root. You can put your own rules and scripts in /etc/udev/rules.d.

Furthermore, the desktop environments all implement some automounting, see for example this guide. See also the answer to this question.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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