LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 08-15-2011, 03:53 PM   #1
wirawan0
Member
 
Registered: Aug 2003
Location: Virginia, USA
Distribution: Mandrake 9.1, SuSE 9.2, Ubuntu 7.04-10.04, Sabayon 5, Debian 6
Posts: 62

Rep: Reputation: 18
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
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 08-15-2011, 04:17 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
You can observe the process by running
Code:
udisks --monitor-detail
and
Code:
dbus-monitor
The desktop (GNOME, KDE, etc.) has a process that connects to dbus. Udisks notifies dbus that the device has been plugged in, which in turn sends a signal to the desktop. The desktop requests from dbus that the device be mounted. When the mount occurs, dbus notifies the desktop, and in response, the desktop launches the media browser (e.g., Nautilus).
 
Old 08-15-2011, 04:35 PM   #3
wirawan0
Member
 
Registered: Aug 2003
Location: Virginia, USA
Distribution: Mandrake 9.1, SuSE 9.2, Ubuntu 7.04-10.04, Sabayon 5, Debian 6
Posts: 62

Original Poster
Rep: Reputation: 18
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.
 
Old 08-15-2011, 05:31 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
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.
 
Old 08-15-2011, 09:13 PM   #5
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 7,747

Rep: Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461
My understanding is that the overall process is handled by udev.

http://www.linux.com/news/hardware/p...ls/180950-udev
 
Old 08-16-2011, 02:14 PM   #6
wirawan0
Member
 
Registered: Aug 2003
Location: Virginia, USA
Distribution: Mandrake 9.1, SuSE 9.2, Ubuntu 7.04-10.04, Sabayon 5, Debian 6
Posts: 62

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by macemoneta View Post
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.
The mount point location: this does not hold for Debian 6. The first USB storage device inserted will be mounted as /media/usb0 . The subsequent ones will be at /media/<volumelabel> as you say. This is the annoying feature I want to undo, which is why I was asking about the auto-mounting process.
 
Old 08-16-2011, 02:21 PM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,012

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
Quote:
The first USB storage device inserted will be mounted as /media/usb0
Please check your /etc/fstab for any entry referring to /media/usb0
If they are there, please comment them out.
Then (as root) mount -a
Then try again.
 
2 members found this post helpful.
Old 08-16-2011, 08:47 PM   #8
wirawan0
Member
 
Registered: Aug 2003
Location: Virginia, USA
Distribution: Mandrake 9.1, SuSE 9.2, Ubuntu 7.04-10.04, Sabayon 5, Debian 6
Posts: 62

Original Poster
Rep: Reputation: 18
@tredegar: Thank you! That's the problem. There was an entry of /media/usb0 there! Why did I miss it, I don't know.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set NTFS (fuseblk) external media to mount with UTF-8 filesystem dotancohen Linux - Newbie 2 12-25-2010 11:21 AM
Can't mount external media under a user account vezril Linux - General 5 04-19-2009 06:05 AM
any media streaming box that works with Linux? netlogic Linux - Hardware 5 08-21-2007 08:14 AM
C-Media 8788:: works in SUPERTUX, not in DESKTOP epsilon72 Linux - Hardware 1 03-23-2007 06:37 PM


All times are GMT -5. The time now is 09:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration