![]() |
How does Linux desktop external media mount works?
I notice that in newer distros, external media (USB sticks, external disks, CDROMs) are mounted automatically. How does this work, exactly? I tried to hunt it down to no avail. The reason is this: I recently installed Debian 6 on my laptop, which is fine. But one annoying thing is that the first usb media inserted to the computer will always mount as /media/usb0 , no longer /media/<disklabel> .
Now you may argue that disk label can contain spaces and thus is bad for scripts, but at least it can be consistent. I want to know the following: which program or configuration files determines the mount point name and mount option? Here's the result of my hunt-down so far (for new enough linux distros): * udisks (the replacement of HAL) is responsible for dispatching device plug/unplug event so that it is mounted properly. Apparently this is done via d-bus. * gvfs (under GNOME desktop) seems to be responsible for mounting or dismounting the disk. But that's the farthest I could get. I see there is gvfsd; but documentation for gvfsd is so *sparse*. If anyone knowledgeable can give me a pointer, I'd appreciate it! Wirawan |
You can observe the process by running
Code:
udisks --monitor-detailCode:
dbus-monitor |
Can you be more specific for gnome? I know gvfsd is the "brain" of the process, but I have no idea how it works. How it computes mount point name, etc. There is no documentation for it.
|
If you need details beyond the monitor traces, you can strace the process or examine the source. The mountpoint name is always /media/volumelabel. If the media is unlabeled, generic device specific names are used.
|
My understanding is that the overall process is handled by udev.
http://www.linux.com/news/hardware/p...ls/180950-udev |
Quote:
|
Quote:
If they are there, please comment them out. Then (as root) mount -a Then try again. |
@tredegar: Thank you! That's the problem. There was an entry of /media/usb0 there! Why did I miss it, I don't know.
|
| All times are GMT -5. The time now is 12:48 AM. |