8

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?

Braiam
  • 67,791
  • 32
  • 179
  • 269
koloman
  • 347

1 Answers1

11

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
arrange
  • 14,959
  • that was just what i was interested in. thanks a lot! so is gvfs-gdu-volume-monitor responsible for picking an appropriate driver for the device? i'm asking because i have a problem with an ntfs formatted usb drive that is always mounted using the ntfs kernel module instead of the ntfs-3g driver. – koloman Mar 03 '11 at 09:51
  • No, it is actually udisks-daemon, but I'm afraid it is not configurable (http://web.archiveorange.com/archive/v/7azSg34QulEtgOvRXE08) But you can use a udev rule to do that for you (haven't tried it myself) - see https://wiki.archlinux.org/index.php/Udev#Mount_under_.2Fmedia.3B_use_partition_label_if_present.3B_ntfs-3g – arrange Mar 03 '11 at 21:54