You are not logged in.

#1 2010-07-03 00:14:25

leberyo
Member
Registered: 2009-12-30
Posts: 123

Auto-mounting udev or hal

Ok, so I've removed hal from my list of daemons from my rc.conf since I've read everywhere that hal is going to be deprecated and I don't really need it.  I've read the wiki and added some udev rules to where they need to go for auto-mounting media but nothing is auto-mounting anymore in my system (CDs, USB cards).  Am I missing something here I wonder?

Thanks

Offline

#2 2010-07-03 01:25:14

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Auto-mounting udev or hal

You can continue using hal if you wish - it still exists, it still works, and it's not going to disappear overnight.

Re your udev issue, your description is too vague - at the very least, post the rules you are using.

Offline

#3 2010-07-03 05:24:39

leberyo
Member
Registered: 2009-12-30
Posts: 123

Re: Auto-mounting udev or hal

I'm using these rules found in the wiki:

File: /etc/udev/rules.d/10-my-media-automount.rules
# vim:enc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=udevrules:
#
# /etc/udev/rules.d/10-my-media-automount.rules

# start at sdb to ignore the system hard drive
KERNEL!="sd[b-z]*", GOTO="my_media_automount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="my_media_automount_end"

# import some useful filesystem info as variables
IMPORT{program}="/sbin/blkid -o udev -p %N"

# get the label if present, otherwise assign one based on device/partition
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"

# create the dir in /media and symlink it to /mnt
ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"

# global mount options
ACTION=="add", ENV{mount_options}="relatime"
# filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat)
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=100,dmask=000,fmask=111,utf8"

# automount ntfs filesystems using ntfs-3g driver
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
# automount all other filesystems
ACTION=="add", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"

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

# exit
LABEL="my_media_automount_end"

and this one:

File: /etc/udev/rules.d/11-discs-auto-mount.rules
KERNEL!="sr[0-9]*", GOTO="disc_by_label_auto_mount_end"

# Get label
ACTION=="add", PROGRAM=="/sbin/blkid -o value -s LABEL %E{device}", ENV{dir_name}="%c"

ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'", RUN+="/bin/mount -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
ACTION=="add", RUN+="/bin/ln -s /media/%E{dir_name} /media/disc"
ACTION=="remove", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"

LABEL="disc_by_label_auto_mount_end"

KERNEL!="sr[0-9]*", GOTO="disc_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}="%k"

# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount /dev/%k /media/%E{dir_name}"
ACTION=="add", RUN+="/bin/ln -s /media/%E{dir_name} /media/disc"

# 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="disc_by_label_auto_mount_end"

Offline

Board footer

Powered by FluxBB