-   Linux - Newbie (
-   -   is Thunar the only solution? (

tiberian 06-11-2008 10:34 PM

is Thunar the only solution?
hi guys, i'm a puzzled man. let me explain. i'm a fluxbox and thunar user and every time i insert a cd or usb, i only have to open thunar and the newly inserted device pops up automagically in the thunar menu. one click and i can access the files as a common user.

now, this makes me suspect that there is maybe a simple terminal command to have access to the new inserted devices without the help of thunar and without being root or modifying fstab, since i've been able to mount/umount everything as a common user, but with thunar, and thunar must be using some unknown command (for me). any thoughts wd be really appreciated :confused:

elliott678 06-11-2008 11:10 PM

Thunar uses the HAL daemon to mount and dismount removable media automatically. I don't know if there is a CLI way to control HAL, I haven't seen one yet.

snowtigger 06-12-2008 12:03 AM

This one intrigued me. So i thought i'd have a little look.

I think you are looking for exo-mount, exo-umount and exo-eject.

However when i had a little play with a usb stick which was mounted at /media/disk and done a quick "exo-umount /media/disk" it says "exo-unmount: Must specify HAL device UDI or device file." So the next thing would be to work out the UDI.

But for me that will be another day.


tiberian 06-12-2008 07:56 PM

thanks my friend, that's new for me, and i just tested it and got the same answer from the sytem, so what's next? doesn't matter, for at least i have a clue right now, i'm going to investigate ex-mount/umount :D

i92guboj 06-12-2008 08:45 PM

Set udev rules.

For example, I have this on my /etc/udev/rules.d/99-usb-storage.rules file:


KERNEL=="sd*", SUBSYSTEMS=="scsi", ATTRS{model}=="DataTraveler 2.0", NAME+="kingston%n", GROUP="usb", MODE="0775"
ACTION=="add", NAME=="kingston[1-9]", RUN+="/bin/mkdir -p /mnt/kingston%n"
ACTION=="add", NAME=="kingston[1-9]", PROGRAM=="/lib/udev/vol_id -t %N", RESULT=="ext2", RUN+="/bin/mount -t ext2 -o rw,noauto,nodev,nosuid,noexec,noatime,users,group /dev/kingston%n /mnt/kingston%n"
ACTION=="add", NAME=="kingston[1-9]", PROGRAM=="/lib/udev/vol_id -t %N", RESULT=="ext3", RUN+="/bin/mount -t ext3 -o rw,noauto,nodev,nosuid,noexec,noatime,users,group /dev/kingston%n /mnt/kingston%n"
ACTION=="add", NAME=="kingston[1-9]", PROGRAM=="/lib/udev/vol_id -t %N", RESULT=="vfat", RUN+="/bin/mount -t vfat -o rw,noauto,flush,quiet,nodev,nosuid,noexec,noatime,users,group,umask=000 /dev/kingston%n /mnt/kingston%n"
ACTION=="add", NAME=="kingston[1-9]", RUN+="/bin/chmod 0775 /mnt/kingston%n"
ACTION=="add", NAME=="kingston[1-9]", RUN+="/bin/chown root:usb /mnt/kingston%n"
ACTION=="remove", NAME=="kingston[1-9]", RUN+="/bin/umount -l /mnt/kingston%n"
ACTION=="remove", NAME=="kingston[1-9]", RUN+="/bin/rmdir /mnt/kingston%n"

When the usb key is plugged, this automatically creates a mount point under /mnt, mount the device under it selectively, depending on the detected filesystem (I use many usb storage devices, with different filesystems), and when I plug it off, it forces the umount of the device (yeah, it's ugly, but as long as you use sane mount options you are not going to have a problem, in any case you can always make a manual sync before you unplug).

Other than that, you could very well use ivman as well, which is a dbus/hal based program that can automatically mount and umount removable devices.

tiberian 06-12-2008 09:38 PM

thank you i92, i'm going to test both options, at first sight it seems the udev rules strategy is a little bit difficult, but, i know from experience that with some time i will become familiarized with it. i don't know about ivman, but then again, yet another clue to investigate, learn and possible solve the problem of automounting via CLI or something simple without gui help.

elliott678 06-12-2008 09:42 PM

The udev method is great for USB devices. It is actually very simple to add, assuming your distro already uses udev, which most do. The only drawback with it is the lack of support for CD/DVD automounting.

i92guboj 06-12-2008 09:51 PM


Originally Posted by elliott678 (Post 3183232)
The udev method is great for USB devices. It is actually very simple to add, assuming your distro already uses udev, which most do. The only drawback with it is the lack of support for CD/DVD automounting.

That's true as far as I know. In that case, ivman is what I'd use if I wanted to automount a cdrom. However, it failed for me in lots of colorful ways in the past, forcing me to umount -l the drives and confusing the system and lots of programs.

All times are GMT -5. The time now is 02:04 PM.