Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For minimal installations of Debian, I have been using halevt to enable automounting of USB drives. Halevt is reliable and requires no configuration aside from installing the package. Now, halevt has been removed from Debian Testing and I'm looking for a replacement, but none of the alternatives seem to be as straightforward.

What utility for automounting USB drives would be the most lightweight, simple, and stable?

EDIT: I was never able to get udev working the way I wanted. The problem is that udev rules are always run as root, so media are mounted as root. It is possible to hard-code mounting as a specific user, but it seems you can't make a rule that mounts as current user. According to the documentation, it should be possible with the MODE value, but it doesn't seem to be implemented in Debian. So, if automounting is required, I still have to use halevt. Otherwise, I use pmount.

share|improve this question
    
By minimal, I assume you mean no X and Gnome/KDE? –  Mikel Apr 16 '11 at 23:29
    
The Debian installation without Desktop Environment and System Services. So, with X but no GNOME/KDE. –  user5184 Apr 17 '11 at 2:18
    
Hmm, at the moment Halevt is in stable, testing and unstable. –  Faheem Mitha Feb 10 at 9:05
add comment

3 Answers 3

The disk-based features of HAL were replaced by udev and udisks.

There is a full example of how to use udev to do this on the Automounting UDisks wrappers page:

/etc/udev/rules.d/11-media-by-label-auto-mount.rules

KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"

# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"

# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"

# Global mount options
ACTION=="add", ENV{mount_options}="relatime"
# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"

# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"

# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"

# Exit
LABEL="media_by_label_auto_mount_end"

For more information about udev:

There are also a few options based on udisks that would be the new equivalent of halevt:

I couldn't find any of those in the testing repository, so you might have to find a third-party apt repository, or follow their instructions to compile the software on your own machine.

share|improve this answer
    
I'm hoping for a simple solution like halevt, just "Install <package> and you are done." I'll have to look at those packages. –  user5184 Apr 17 '11 at 2:28
    
Copy the code above, paste it into the suggested file (/etc/udev....rules), and hopefully you're done. –  Mikel Apr 17 '11 at 3:00
    
Been trying this on two Debian machines, but it doesn't work well. 1. All devices are mounted as root. 2. Auto-unmounting sometimes fails, leaving a node that is persistent through a reboot. 3. Some unpowered drives don't get mounted at all. 4. Several times failed transfer of files. I've had none of these problems with halevt. –  user5184 Apr 21 '11 at 4:39
add comment

If you don't want to use hal, you could use a udev rule to automount your drives. The Arch Wiki has a good article on rules here:

https://wiki.archlinux.org/index.php/Udev#Auto_mounting_USB_devices

You could also look at using something like udiskie (it's in the AUR):

https://wiki.archlinux.org/index.php/Udiskie

There is also a script for integrating udiskie into your Openbox menu.

share|improve this answer
    
Thanks, that helps a lot! I did read the Arch documentation for Udev however it doesn't really explain how exactly to write your own rules, which annoys me a bit because I want to understand what it's doing before I just copy and paste it in. I'll try it out and see if it mounts my stuff. By the way, what's the benefit of using HAL over Udev or vice-versa? –  kelinu Apr 25 '11 at 22:16
    
HAL has been deprecated and is no longer developed, so -sooner or later, you will need to move to other arrangements. The first rule on the wiki page should accomplish what you are after... –  jasonwryan Apr 25 '11 at 22:20
    
OK thanks...I'll stick with Udev then and I'll get that rule working properly –  kelinu Apr 25 '11 at 22:24
add comment

You should probably look into setting up your own udev, hal or hotplug rules to automount drives and even run commands when they connect. You could also look into pmount.

There are quite a few automounters for linux, you just have to figure out what suits your work best.

Also be aware that you can run many parts from the larger DE's like gnome without running the full thing. You should be able to use gnome-volume-manager separately from using it for your session.

share|improve this answer
    
I think udev is an automounter right? I have that installed by default with Arch Linux but I'm not sure how it works...anyone has any insight on this? –  kelinu Apr 25 '11 at 22:05
    
Yes. Try the ArchLinux Udev docs. –  Caleb Apr 25 '11 at 22:07
    
Is gnome-volume-manager a sort of proprietory automounter too by the way? –  kelinu Apr 25 '11 at 22:20
    
Your use of the adjective "proprietary" doesn't make much sense since gnome is also open source, but yes GVM is just a little bit fancier automount wrapper around pmount. –  Caleb Apr 26 '11 at 7:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.