|FILE SYSTEM DEFAULTS|
First, default mount options are read from
/system/storage/defaults/FS_TYPE/ for the probed file system type of the volume. The option
uid=, is treated specially by
gnome-mount and will be replaced by
uid=UID_OF_USER to cope with the fact that the
uid is a function of the user calling it.
Second, the gconf tree at
/system/storage/drives/UDI_OF_DRIVE/ is consulted for options that depend on what drive the volume belongs
to. For example, this is useful for configuring that volumes inserted
into a given drive is always mounted at the same location. For example,
this can be used to emulate
/etc/fstab behaviour by where CD media is always mounted at e.g.
Third, the gconf tree at
/system/storage/drives/UDI_OF_VOLUME/ is consulted for options that are specific to a particular piece of
media and as such depends on either the file system label (e.g.
EOS_DIGITAL ) or the file system UUID (e.g.
E18B_10EC ) or both.
Users can pass
--fstype on the commandline to override settings.
|EXTRA COMMANDLINE OPTIONS|
Finally, if mount options are passed via
--extra-mount-options these are not replacing the mount options, they are simply added.
This is useful for doing e.g.
gnome-mount --extra-mount-options remount,exec -d /dev/sda1
to remount a volumes such that programs can be run from the media. This is useful for e.g. gnome-volume-manager if it discovers an autorun file on the media.
gnome-mount supports passworded media through the org.freedesktop.Hal.Device.Volume.Crypto interface supported by HAL and this includes volumes formatted in a way that adheres to the LUKS (Linux Unified Key Setup) specification. In addition, gnome-mount uses gnome-keyring to retrieve and store the pass phrase. If no key can be retrieved, gnome-mount will prompt the user for one. In addition, if the keyring is locked, the user may be prompted to unlock it via standard gnome-keyring mechanisms.
gnome-mount is intended for unprivileged users and HAL ultimately controls if the calling user is allowed to mount, unmount or eject volumes as well as what mount options are valid. As such, requests may be denied. See the (human readable) exception returned from HAL for details if a request fails.
Note that HAL has a notion of what mount options are valid for a given volume. They are listed in the HAL property volume.mount.valid_options on the device object representing the volume to mount. Consult lshal(1) for details. Also note that HAL by default appends the options nosuid and nodev to prevent privilege escalation.
In addition to using HAL as the mechanism for mounting file systems, the /etc/fstab file is also consulted as HAL will refuse to mount any file system listed in this file as it would violate system policy. If this is the case, gnome-mount will invoke mount(1) as the calling user rather than invoking the Mount method on the org.freedesktop.Hal.Device.Volume interface on the device object representing the volume / drive. This means that settings (mount point, mount options, file system type) read by gnome-mount are not passed along as these are already specified in the /etc/fstab file and there are no mechanism to override them. When parsing the /etc/fstab file, gnome-mount (and also HAL for that matter) resolves symbolic links and also respects the LABEL= and UUID= notations. For example, if this line is in /etc/fstab
LABEL=MyVolume /mnt/myvolume auto user,defaults 0 0
then gnome-mount mounts the file system with the label MyVolume via mount(1) and /etc/fstab rather than using the HAL mechanisms.
Options available for the gnome-mount command:
-v, --verbose Verbose operation, shows debug messages.
-n, --no-ui Dont show any dialogs the user needs to dismiss. If X11 is available, gnome-mount may pop up transient notification bubbles e.g. suggesting the user to remount a volume with different options to streamline access to file systems with ownership attributes. This is the option that storage policy daemons such as gnome-volume-manager should invoke gnome-mount in. File managers, however, such as Nautilus , should never use this option as the user should get e.g. an error dialog if he tries to access a volume with a missing, unsupported or unknown file system.
-b, --block Allow gnome-mount to block even if an error occured. By default, gnome-mount will daemonize so it can return control to the invoking application as soon as possible (e.g. when an operation either fails or succeeds ) while still showing an error dialog to the end user. Useful when debugging.
-u, --unmount Use this for unmounting rather than mounting. If gnome-mount is invoked as gnome-umount (a symlink to gnome-mount ) then this option is automatically selected.
-e, --eject Use this for ejecting rather than mounting. If gnome-mount is invoked as gnome-eject (a symlink to gnome-mount ) then this option is automatically selected.
-d, --device Specify target volume by the special device file.
-h, --hal-udi Specify target volume by HAL UDI (Unique Device Identifier).
-p, --pseudonym Specify target volume by pseudonym. See above for how this works.
-t, --text Never use X11 dialogs or notification bubbles even if an X11 server is available. Also prohibits the use of gnome-keyring to retrieve pass phrases for passworded media because this might require unlocking the keyring which happens through an X11 dialog out of process. Useful for command line operation.
-m, --mount-point Specify mount point to use; dont include /media as this is automatically appened by the mechanism used to mount, e.g. the HAL methods.
-o, --mount-options Specify mount options. Separate by comma.
-f, --fstype Specify file system type. This is useful for using e.g. the msdos file system instead of the vfat file system.
--write-settings Instead of mounting a drive, specify what options to store in the gconf database. Can be used on both drives and volumes. Be careful using this with the --device option as optical drives (among others) use the same special device file for both the drive and the volume. One trick is to ensure the optical drive has no media when configuring it via this option. Another possibility is to use the HAL UDI instead.
--display-settings Display settings for a drive or volume.
--erase-settings Erase settings for a drive or volume.
gnome-mount will return zero if the request succeeded or non-zero if it failed. Note that gnome-mount is specifically designed to run in a graphical user environment and as such all error reporting (and resolution) is through X11 dialogs. For example, if HAL reports that a volume could not be mounted because of a missing file system driver, gnome-mount might, one day, launch a tool to ask the user if he wants to download and install the driver. In a similar way, all error dialogs are presented via X11 dialogs to the user as well.
We want to make sure that the discs inserted into an optical drive are always mounted at /media/cdrecorder instead of using the default which is using the label specified in the iso9660 or udf file system header. Assuming that the drive is empty and the special device file for the drive is /dev/hdc the following command will work
This can be inspected via the --display-settings option and the settings can also be erased via the --erase-settings option. Also note that gconf-editor(1) can be used for tasks like these.
HAL polls most storage devices for media insertion / removal and maintains the list of devices exported. However, some hardware cannot be polled for media changes without making noise or for other reasons. PC floppy drives, Zip drives connected through an IDE interface and broken optical drives falls into this category.
For such hardware HAL only exports the drive and rather than exporting volume as childs of the drive, the org.freedesktop.Hal.Device.Volume interface is exported on the drive itself. gnome-mount supports this but it means that it is impossible to know ahead of time what file system is on the media in the problematic drive, so in this case gnome-mount passes auto as the file system type and passes the mount options uid=UID_OF_USER as most media in such devices are formatted with either the vfat , udf or iso9660 file systems.
This also means that per-volume settings are not possible; one can only specify settings per-drive.
gnome-mount was written by David Zeuthen <firstname.lastname@example.org>.