LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Slackware 14.2 KDE: flash drive auto mount (https://www.linuxquestions.org/questions/linux-software-2/slackware-14-2-kde-flash-drive-auto-mount-4175600536/)

usr345 02-24-2017 05:27 PM

Slackware 14.2 KDE: flash drive auto mount
 
1 Attachment(s)
I am using Linux Slackware 14.2, KDE. Every time when I plug in the usb stick, I get a pop in the bottom right corner, allowing me to mount the device and open it's contents.

Attachment 24324

It is being mounted into /run/media/<device dependent name>. I use only one flash stick at a time and would like to auto-mount any flash drive into /mnt/flash as soon as it's inserted. And to disable KDE automount feature, so no popups are shown.

Anybody knows, how to do it?

Mill J 02-24-2017 06:32 PM

Check this out https://www.axllent.org/docs/view/au...g-usb-storage/

usr345 02-25-2017 09:31 AM

Quote:

Originally Posted by Mill J (Post 5675652)

Created the file /etc/udev/rules.d/auto-mount.rules:

Code:

KERNEL!="sd[a-z][0-9]", GOTO="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/mount -o $env{mount_options} /dev/%k /mnt/floppy"
# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /mnt/floppy"
# Exit
LABEL="auto_mount_end"

Then ran:

Code:

udevadm control --reload-rules
Doesn't work - I inserted the stick, nothing was mounted to /mnt/floppy.

Mill J 02-25-2017 10:47 AM

See if the original works then tweak to your liking. it might not be possible.

You might want to check into fstab
https://help.ubuntu.com/community/Fstab


All times are GMT -5. The time now is 07:07 PM.