What happens under the hood when an USB drive is inserted?
In Ubuntu 12.04 (Unity, and presumably Gnome Shell/Classic) automounting is handled by GNOME Desktop/Nautilus, which monitors DBus events for insertion, etc. The gvfs*
backend is used, in co-operation with udisks
for the low-level mounting, etc.
gvfs-mount
is used internally, and running it in monitor mode with the -o
switch will show, for example:
$ gvfs-mount -o Monitoring events. Press Ctrl+C to quit. Drive connected: 'usb Flashdisk' Volume added: 'DISK_IMG' Volume changed: 'DISK_IMG' Mount added: 'DISK_IMG' Volume changed: 'DISK_IMG' Mount changed: 'DISK_IMG' Mount removed: 'DISK_IMG' Volume changed: 'DISK_IMG' Drive disconnected: 'usb Flashdisk' Volume removed: 'DISK_IMG'
GNOME deals with it. See https://help.ubuntu.com/community/Mount/USB.