Hello,
I know that this isn't exactly an archlinuxarm specific issue, but if someone could give me some pointers. I am trying to do get USB automounting to work on my rpi and I am getting some very wierd occurences, and everything looks like it should be. When I plug a usb hard drive/stick in, it will create the directory under /media by label and it will mount the disk, but it for some reason seems to immediately unmount the disk and it does not show up in /etc/mtab, but the directory under /media still exists until I unplug the drive. I dont know where to get some kind of log to see when a drive is unmounted since it does not list in dmesg. My hard drive that I am using has a 1gb swap partition and a ~630GB ext4 partiion, the swap partition mounts and shows as being active in swapon without issue, but the ext4 partition acts as above. Right now I need to manually mount the partition myself to the folder in /media and it works fine after that. I am wondering if there is something missing in my script, or perhaps there is something that is interfering with the auto mounting of the partition.
This is the code I have in my /etc/udev/rules.d/11-media-by-label-auto-mount.rules:
$this->bbcode_second_pass_code('', '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", ENV{ID_FS_TYPE}!="swap", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/usr/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
ACTION=="add", ENV{ID_FS_TYPE}=="swap", RUN+="/usr/bin/swapon /dev/%k"
# Clean up after removal
ACTION=="remove", ENV{ID_FS_TYPE}!="swap", ENV{dir_name}!="", RUN+="/usr/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
ACTION=="remove", ENV{ID_FS_TYPE}=="swap", RUN+="/usr/bin/swapoff /dev/%k"
# Exit
LABEL="media_by_label_auto_mount_end"
')
The only other udev rules that exist are in the raspberrypi.rules as follows:
$this->bbcode_second_pass_code('', 'SUBSYSTEM=="vchiq|input", MODE="0777"
KERNEL=="mouse*|mice|event*", MODE="0777"
# Set bluetooth power up
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"
# kodi keyboard use
SUBSYSTEM=="tty", KERNEL=="tty0", GROUP="tty", MODE="0666"
')
Thanks for your assistance again.