You are not logged in.

#1 2009-12-21 22:04:48

2_Thumbs_Up
Member
Registered: 2009-05-09
Posts: 22

udev and automounting questions

http://wiki.archlinux.org/index.php/Ude … SB_devices

So I've been following this in order to get udev to automount sd-card of my new android phone. The rules I'm
using are these from the above guide:

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"

The phone is recognized as a usb storage device and the mounting actually works fine. However the sd-card has
two partitions and for some reason they are not mounted the same way. mtab says this about the 2 mounts:

/dev/sdb2 /media/usbhd-sdb2 ext4 rw,noexec,nosuid,nodev,relatime 0 0
/dev/sdb1 /media/usbhd-sdb1 vfat rw,noexec,nosuid,nodev,relatime,utf8,gid=100,umask=002 0 0

I assume this has something to do with the different file formats of the partitions but i would like some clarification
about this. /media/usbhd-sdb1 is owned by root while /media/usbhd-sdb2 is owned by me (my user) which seems a bid odd.
I also don't know of the proper way to unmount the partitions when they are mounted this way. Any help
on this? I think that is pretty much all for now, but I will probably have more questions once I get some clarity on these first issues.

Thanks

Offline

Board footer

Powered by FluxBB