You are not logged in.
Pages: 1
I created the following udev rules to mount devices with labels:
KERNEL!="sd[b-z][0-9]", GOTO="end_automount"
PROGRAM!="/lib/initcpio/udev/vol_id --label %N", GOTO="end_automount"
ACTION=="add", ENV{mount_options}="auto,users,rw,uid=000,gid=000"
ACTION=="add", ENV{ID_FS_LABEL}=="M2HDb", RUN+="/bin/mount /media/M2HDb"
ACTION=="add", ENV{ID_FS_LABEL}!="M2HDb", RUN+="/bin/su -c '/bin/mount /media/$env{ID_FS_LABEL} -o $env{mount_options}' barrucadu"
LABEL="end_automount"
But… nothing is getting mounted.
The devices are all in /etc/fstab, so the mount commands seem fine.
Last edited by Barrucadu (2010-01-07 20:54:13)
Offline
Have you tried the rule listed in the wiki?
KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
# Global mount options
ACTION=="add", ENV{mount_options}="relatime,users"
# Filesystem specific options
ACTION=="add", PROGRAM=="/lib/initcpio/udev/vol_id -t %N", RESULT=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
ACTION=="add", PROGRAM=="/lib/initcpio/udev/vol_id --label %N", ENV{dir_name}="%c"
ACTION=="add", PROGRAM!="/lib/initcpio/udev/vol_id --label %N", ENV{dir_name}="usbhd-%k"
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
ACTION=="remove", ENV{dir_name}=="?*", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
LABEL="media_by_label_auto_mount_end"
Offline
I derived my rule from the wiki article; I've just noticed it works if I replace my two mounting rules with this one rule:
ACTION=="add", RUN+="/bin/mount /media/$env{ID_FS_LABEL} -o $env{mount_options}"
But then I have to unmount everything with sudo, which isn't ideal.
Offline
Pages: 1