Note: This content applies to CentOS 5 only.
As of version 5, CentOS no longer uses the hotplug daemon:
# cat /proc/sys/kernel/hotplug #
The subsystems avaliable are:
- HAL - The Hardware Abstracting Layer
- gnome-volume-manager - Gnome's volume control (which interfaces with HAL)
- gnome-mount - Gnome's volume mounting application (called by gnome-volume-manager)
Up until CentOS 4, if you connected a pendrive on your computer, you could get it automatically mounted under /media, even if you were running on runlevel 3 (text mode). However, due to this new subsystem layout, this no longer holds true for CentOS 5.
2. How to get automounting outside Gnome/KDE
The "gnome-volume-manager" daemon is the key here. All you have to do is start it:
$ gnome-volume-manager --sm-disable
There is no need to start it on the background ("&"), since it will fork by itself. We also recommend that you start gnome-volume-manager as the user you intend to use to access the device, since "gnome-mount" will mount the volume using the uid of the running gnome-volume-manager process for the uid/user mount options.
So, if you are running IceWM (example), all you have to do is start "gnome-volume-manager --sm-disable" at the beginning of the session (.Xclients-default, .Xclients etc).
Don't forget to use "gnome-volume-properties" to configure gnome-volume-manager.
3. How to tell gnome-mount to mount things your way
One thing about "gnome-mount" (which gnome-volume-manager calls to do the mounting) is that it has lots of defaults, and one nasty bug. Not wanting to spoil the surprise, there is one annoying bug, which stops you from configuring it using "gconftool-2". "gnome-mount" will add its mount options AFTER the ones you specify with gconftool-2, which makes some of the options unavailable.
Note: You can use the "--write-settings" option of gnome-mount, and then "gconf-edit" to change the gconf values for a given volume, without the need to use "gconftool-2" directly
The tricky part is that gnome-mount will add the "user" filesystem option when mounting. This option implies "noexec,nodev,nosuid". Since it will be added after the values you provide, if you specify "exec" for the "volume/UUID/mount_options" gconf key, you will still end up with the filesystem mounted "noexec".
Another thing you might want to change is the mounting point. gnome-mount defaults to mounting at /media/LABEL.
The way to change this is by using /etc/fstab. The mount options provided at /etc/fstab will be added AFTER the ones by gnome-mount, so now you have control.
To make things easier to understand, lets imagine a scenario using a pendrive, with an ext3 filesystem labeled "MYPENDRIVE". If you simply plug it, you will end up with something like this:
/dev/sda1 on /media/MYPENDRIVE type ext3 (rw,noexec,nosuid,nodev,user=myusername)
Now lets say you want it to be mounted with "exec". All you have to do is add the following line to /etc/fstab:
LABEL=MYPENDRIVE /media/MYPENDRIVE ext3 defaults,user,exec,noauto 0 0
REMEMBER to add the "exec" options AFTER "user" or "users", otherwise it won't work
Another tricky point is that, by using fstab, gnome-mount will no longer automatically create the mounting point. So make sure you create it yourself.
Using this same logic, you can tell gnome-mount to use a different mount point. This is particularly interesting if you are using some removable disk unit (like: Dell RD1000):
LABEL=RD1000disk /backup ext2 defaults,users,noauto 0 0
The "noauto" option will apply to "mount -a". gnome-volume-manager will still mount it automatically, so nothing to fear there.
4. How to test your gnome-mount changes (diagnostics)
One easy way to test your gnome-mount changes is to call it manually.
First, you have to stop/kill gnome-volume-manager, since you don't want it on the way. Then, you can call "gnome-mount" directly, for a given device:
gnome-mount -vbd /dev/sda1
The -v flag means "verbose", so you will get some messages that will help you diagnose. Then you can "umount" the device and calls "gnome-mount" again, until you have what you want.
After you finish, you should "umount" the volume, unplug the device, and only then restart "gnome-volume-manager", otherwise you will end up with a small mess.
If all else fails:
- Stop/kill gnome-volume-manager
- Stop the hal daemon (service haldaemon stop)
- Unplug the device
- Start the hal daemon (service haldaemon start)
- Start gnome-volume-manager (gnome-volume-manager --sm-disable)
- Plug the device