Asking the user to mount a device
Martin Pitt
martin.pitt at ubuntu.com
Tue Sep 8 07:18:22 UTC 2009
Hello Brennan,
Brennan Vincent [2009-09-07 23:41 -0700]:
> I have two partitions on my hard drive: one containing Ubuntu and the
> other containing Vista. The Vista partition is called "OS". It is not
> mounted on boot, but it appears in the Gnome "Places" menu. When
> clicked, the user is asked to grant root privileges in order to mount
> the device in the proper place (/media/OS).
>
> My question is: what is the mechanism for this?
In Karmic it works roughly like this:
* All storage devices are detected by the Kernel, and put into /sys.
Look at /sys/block/*. This also contains the information whether a
device is removable or fixed.
* udev reads /sys and imports these devices into its database. It
also does some probing to find out the file system, partition type,
etc. Look at /lib/udev/rules.d/60-persistent-storage.rules and
/lib/udev/rules.d/95-devkit-disks.rules
http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
* GNOME, in particular gvfs, reads the udev database and creates
"volumes" for them: "gvfs-mount -li" displays the status
This is what appears in the places menu.
* When you try to mount a device, gvfs contacts DeviceKit-disks over
D-Bus (since mounting needs root, it can't do it itself), and
DK-disks does the mount into /media, either by label or by UUID.
http://hal.freedesktop.org/docs/DeviceKit-disks/
In Ubuntu 9.04 and below, the udev/devicekit-disks part was done by
"Hal", but that's being deprecated now.
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
More information about the Ubuntu-devel-discuss
mailing list