Skip to content

Instantly share code, notes, and snippets.

@fxlv
Last active August 29, 2015 14:07
Show Gist options
  • Save fxlv/bd444a76f0df1a2783ab to your computer and use it in GitHub Desktop.
Save fxlv/bd444a76f0df1a2783ab to your computer and use it in GitHub Desktop.
10-usbtest.rules
#
# add this to your /etc/udev/rules.d
#
# then run "udevadm control --reload-rules"
# and your flash will be automounted whenever you insert it
ATTRS{model}=="USB Flash Drive ", ATTRS{vendor}=="ADATA ", SYMLINK+="usbflash-adata%n"
ACTION=="add", ATTRS{model}=="USB Flash Drive ", ATTRS{vendor}=="ADATA ", RUN+="/bin/mkdir -p /mnt/usbflash-adata%n"
ACTION=="add", ATTRS{model}=="USB Flash Drive ", ATTRS{vendor}=="ADATA ", RUN+="/bin/mount /dev/%k /mnt/usbflash-adata%n"
ACTION=="remove", ATTRS{model}=="USB Flash Drive ", ATTRS{vendor}=="ADATA ", RUN+="/bin/umount -l /mnt/usbflash-adata%n"
ACTION=="remove", ATTRS{model}=="USB Flash Drive ", ATTRS{vendor}=="ADATA ", RUN+="/bin/rmdir /mnt/usbflash-adata%n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment