How does automated hotplug mounting work?

I was reading a bit about gnome-mount, HAL, udev, etc. It left me with a couple of faint ideas how mounting a hotplug device might work in the latest Ubuntu release.

Could someone give a detailed explanation about what exactly is going on after a hotplug device (i.e. usb-stick) was plugged in?


Maybe you should specify which part of the process is interesting to you but let's say a USB stick is added then...

  • kernel detects and initializes the device (see dmesg), then exports all the information it has found via a directory in /sys (see /sys/devices)
  • kernel sends a uevent signal which is picked up by udev daemon
  • udev daemon gathers available info and checks config files in /etc/udev/rules.d/ and /lib/udev/rules.d/ for rules about symlinks to create in /dev, permissions to set, programmes to run and sets some variables concerning the device (see man udev)
  • udisks daemon in cooperation with gvfs-gdu-volume-monitor creates the appropriate directory in /media and mounts the new volume if deemed sensible
  • nautilus checks the contents, creates thumbnails and opens a window if it is configured to do so; it also looks into /media/*/autorun.inf file for executable content