# mount options for automounted devices

## kershell

When I plug in a USB disk it gets automounted fine. I need to change the mount point and also the options with which the device gets mounted such as async or noexec. I am unable to figure out where these options are. What I would like to know is which file or files I need to edit to change these options.

Also, can someone elaborate the sequence of events from the point a device such as a USB disk is plugged in to when it appears on the Gnome desktop as an icon. I know that udev and hal have a role but are there any other players involved like hotplug?

I am using the Gentoo 2.6 kernel and Gnome as the desktop on an self-assembled Pentium 4 machine. Any help will be much appreciated.

----------

## SoylentGreen

example (my usb stick)

/etc/fstab

```

/dev/sdc1               /mnt/usb        vfat            noauto,user     0 0

```

async or/and noexec should be put where i have "noauto, user"

dunno about gnome, though..

----------

## kershell

Thanks for the response. I do not want to make an entry in /etc/fstab because if I plug in a second usb disk which will probably end up as /dev/sdd1and it will get mounted with the default options again. What I am really looking for is some help with the hal configuration files in /usr/share/hal/fdi/ and subdirectories therein. I believe it is somewhere here that the default options are specified.

Anyway, you have given me a good idea. I can use udev to get the same /dev/ file for a given device and then the entry in fstab will make sure that the mounting happens with my choice of options. So, thanks again   :Smile:   .

----------

## SoylentGreen

 *kershell wrote:*   

> 
> 
> Anyway, you have given me a good idea. I can use udev to get the same /dev/ file for a given device and then the entry in fstab will make sure that the mounting happens with my choice of options. So, thanks again    .

 

idea? well, if there s another way, lemme know.

OTOH you are right, i thought it is supposed to work like that?

----------

## kershell

The thing is, at work I have a RedHat ES machine. It uses something called fstab-sync to write an entry to /etc/fstab whenever a device is plugged in. Note that the entry apears only after the device is plugged in and vanishes when the device is removed. Obviously then, this entry cannot supply the options with which the device will be mounted. The options with which the device gets mounted are written in the hal configuration files living in /usr/share/hal/fdi/. This directory and those below it have lots of XML files. I altered one of the files and it did alter the options with which the device was mounted as evident by the entry in /etc/fstab. However I reverted the change because I have no idea how this is suposed to be done and was concerned about unknowingly breaking something else. What this exercise did tell me is that the hal configuration has something to do with mounting options.

At home in Gentoo, I notice that when I plugin a device nothing gets written to /etc/fstab automatically. An entry does appear in /etc/mtab though. And there are far fewer files in the /usr/share/hal/fdi/ directory. What is hal doing anyway? If udev creates the /dev/file when a device is plugged in, and mounting options are read by hotplug from /etc/fstab? Who actually runs the mount command? hotplug? It definitely has a role because if I unmerge it automounting fails.

Do I sound confused? It is because I am.   :Confused: 

----------

## SoylentGreen

 *kershell wrote:*   

> The thing is, at work I have a RedHat ES machine. It uses something called fstab-sync to write an entry to /etc/fstab whenever a device is plugged in.
> 
> 

 

yes, i recall something similar from my SuSE days years ago. hal and dbus didnt even exist those days, but it worked <g>. dont ask me how, though  :Wink: 

well, i really have no idea how hal and dbus work, sorry. its not even fully implemented in KDE yet (KDE4 will have that in, i was told). but it works somehow over here. hmm, could also be the kernel automount doing it, i really dont know. i dont think too much about things as long as they work for me  :Wink: 

----------

## chrbecke

AFAIK, it works like this:

If you hotplug a device, an udev event is created by the kernel.

udev responds to this event by creating a device node and calling handlers (this is what hotplug used to do, but recently udev made hotplug obsolete).

udev tells HAL about the device addition, which looks up information about the plugged in device (device type, if appropriate mount point and mount options, etc.) in the .fdi files in /usr/share/hal/fdi/* and announces the newly found device via DBUS.

gnome-volume-manager listens on the DBUS interface of HAL, and if a new device is announced and it is a volume and gnome-volume-manager is configured to auto-mount this type of volume, gnome-mount is called to mount it.

Your RedHat machine seems to be outdated, there used to be another way for auto-mounting under GNOME involving pmount and/or fstab-sync, but it is obsolete now AFAIK.

Maybe this will be of help.

----------

## SoylentGreen

@chrbecke

yeah, but what we dont understand is the benefit of all this (hal and dbus).

dunno about GNOME, but KDE is automounting fine without using those, hmm..

btw, about old redhat version: he mentioned ES, i guess this stands for "Enterprise Server". dunno if this is as "uptodate" to the usual RedHat versions if it comes to plugin USB devices and whatnot, cause you usually dont need those at a server   :Shocked: 

but thats just a guess..

----------

## chrbecke

Well, some information on  HAL and D-Bus can be found on their sites on freedesktop.org.

HAL is a generic interface to hardware information, e.g. your music player doesn't need a patch for each and every portable music player out there, it can ask HAL about information on how to access it.

D-Bus is a system to ease IPC - e.g. allow your VoIP software to mute your media player. There was some talk about a generic D-Bus API for media players, so the VoIP software doesn't have to implement interfaces to each media player, but can talk to it through the generic interface.

All in all, benefits for end users are not that big ATM, but as more and more projects implement D-Bus interfaces and use HAL for hardware access, interoperability of applications should improve and it will become more likely that hardware will "just work". Hopefully, instead of developers "reinventing the wheel", there will be a more combined effort to implement application interoperability and hardware access through D-Bus and HAL.

----------

## kershell

[quote="chrbecke"]

Your RedHat machine seems to be outdated, there used to be another way for auto-mounting under GNOME involving pmount and/or fstab-sync, but it is obsolete now AFAIK.

Maybe [url=http://www.mythic-beasts.com/~mark/random/hal/]this[/url] will be of help.[/quote]

The RedHat machine at work was installed about 2 years back. In terms of Linux that is probably old. The URL you have given is very informative. Thanks.

----------

## Pse

 *kershell wrote:*   

> The thing is, at work I have a RedHat ES machine. It uses something called fstab-sync to write an entry to /etc/fstab whenever a device is plugged in. Note that the entry apears only after the device is plugged in and vanishes when the device is removed. Obviously then, this entry cannot supply the options with which the device will be mounted. The options with which the device gets mounted are written in the hal configuration files living in /usr/share/hal/fdi/. This directory and those below it have lots of XML files. I altered one of the files and it did alter the options with which the device was mounted as evident by the entry in /etc/fstab. However I reverted the change because I have no idea how this is suposed to be done and was concerned about unknowingly breaking something else. What this exercise did tell me is that the hal configuration has something to do with mounting options.
> 
> At home in Gentoo, I notice that when I plugin a device nothing gets written to /etc/fstab automatically. An entry does appear in /etc/mtab though. And there are far fewer files in the /usr/share/hal/fdi/ directory. What is hal doing anyway? If udev creates the /dev/file when a device is plugged in, and mounting options are read by hotplug from /etc/fstab? Who actually runs the mount command? hotplug? It definitely has a role because if I unmerge it automounting fails.
> 
> Do I sound confused? It is because I am.  

 

I'll revive this thread just to post some info I found: http://www.lowlevel.cz/log/pivot/entry.php?id=95

Apparently, gnome-mount can read mount options from either fstab, gconf or hal, and it does so in that order.

[EDIT]It's worth mentioning that you need gnome-mount-0.5 or higher to use gconf and/or hal to set up mount options. Unfortunately, both gnome-mount-0.5 and 0.6 are currently hard-masked.

----------

