Where is the place of specifying automount options for a specific file system

David Zeuthen david at fubar.dk
Wed Dec 2 08:03:05 PST 2009


Hey,

Sorry I missed your reply
> Using /etc/fstab?? I don't understand. For fixed partition, yes, it's
> anaconda's job to manipulate this file do right thing. 

Yeah, the OS installer typically writes out the /etc/fstab file for swap
and other filesystems used for the OS (e.g. /usr).

> But for a
> hot-plugged device like a USB disk , we shouldn't use this file. We
> should do it with something like udev rules, I think. And for your
> info, mount show
> "(rw,nosuid,nodeve,uhelper=devkit,uid=500,gid=500,shortname=mixed,dmas
> k=0077,utf8=1,flush)" for a usb disk. I want to know where are the
> mount options from?

The way it works is that the desktop session that decides to mount the
device (for GNOME, this is Nautilus/GVfs) calls the FilesystemMount()
method for the device

http://hal.freedesktop.org/docs/DeviceKit-disks/Device.html#Device.FilesystemMount

This method does take an array of mount options to use. The daemon then
combines the given mount options with the defaults, see

http://cgit.freedesktop.org/DeviceKit/DeviceKit-disks/tree/src/devkit-disks-device.c?id=009#n4277

and checks that forbidden mount options are passed (the user passing the
'dev' or 'suid' mount option would easily give him root, for example).
If things check out, we create the mount point and mount the device.

GNOME, however never passes any mount options. Presumably the GNOME
developers (am I'm one of them - I wrote most of the storage hotplugging
code in GNOME) could read mount options from things like GConf (like
gnome-mount did) but after thinking a lot about it we decided to not do
this - see this bug and this message

 https://bugzilla.gnome.org/show_bug.cgi?id=586708
 http://lists.freedesktop.org/archives/devkit-devel/2009-June/000225.html

for some details. If it turns out it is needed we can always just change
GNOME to pass mount options and if needed we can always read them from
things like GConf/GSettings/DConf and provide an UI to edit them.

Note that the daemon will always respect the contents of the /etc/fstab
file - so if you put in lines like

 /dev/disk/by-label/My_Photos /media/My_Photos vfat shortname=lower,dmask=0000,users 0 0

then it will be used. You can also use the /disk/disk/by-path symlinks
to set mount options for any device plugged into a given port.
 
> > I'm curious though - what mount options do you need to change? The
> > defaults should work out of the box.
> > 
> Yes, works. Just want to know how it works.

OK, good. FWIW, My gut feeling is that if the user needs to pass mount
options for mounting local filesystems then the filesystem driver is
probably doing something wrong. I really don't think a "edit mount
options" in the normal desktop shell experience makes any sense on a
modern desktop - we should be able to autodetect things out of the box.

Note that Palimpsest Disk Utility and udisks (aka DeviceKit-disks) in
the future will provide an UI to edit the /etc/fstab file so the admin
can decide that some filesystem should be mounted at boot- and/or
plug-in-time.

(In addition, there are also plans for Palimpsest/udisks to provide UI
to toggle whether things like RAID arrays and LVM Volume Groups should
be started at boot- and/or plug-in-time. FWIW, nowadays I don't consider
Palimpsest part of the normal desktop shell - it is a utility used by
admins to set up storage for workstations and servers. It is still
useful for the desktop shell experience but the desktop shell already
provides simpler tools (built on exactly the same code) for formatting
and starting/stopping things like RAID.)

I hope this clarifies.

Thanks,
David




More information about the devkit-devel mailing list