Scheduled maintenance — back soon.

~/blog/mount-external-hdd-with-static-mount-point

Mount external HDD with static mount point

I have many USB external drives (hdd, flash drive, etc) and I want that they appears always with the same name under /dev folder (also mount external hdd with static mount point). This can be achieved writing custom udev rules. I have wrote my own rules which I saved them into a /etc/udev/rules.d/10-local.rules file:

SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Western Digital ",ATTRS{product}=="External HDD ", ATTRS{serial}=="575845593037563230383239", KERNEL=="sd?5", NAME="wdbak_var", SYMLINK+="usbdevices/wdbak_var"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Western Digital ",ATTRS{product}=="External HDD ", ATTRS{serial}=="575845593037563230383239", KERNEL=="sd?6", NAME="wdbak_tmp", SYMLINK+="usbdevices/wdbak_tmp"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Western Digital ",ATTRS{product}=="External HDD ", ATTRS{serial}=="575845593037563230383239", KERNEL=="sd?7", NAME="wdbak_prtag", SYMLINK+="usbdevices/wdbak_prtag"

SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Western Digital ",ATTRS{product}=="External HDD ", ATTRS{serial}=="575843593037363930313237", KERNEL=="sd?1", NAME="wddana", SYMLINK+="usbdevices/wd250j", ACTION=="add", RUN+="/bin/mount /mnt/auto/john"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Western Digital ",ATTRS{product}=="External HDD ", ATTRS{serial}=="575845593037553933303036", KERNEL=="sd?1", NAME="wdeugen", SYMLINK+="usbdevices/cv250p", ACTION=="add", RUN+="/bin/mount /mnt/auto/smith"

All information about a device handled by udev can be found using the udevadm management tool:

udevadm info -a -p $(udevadm info -q path -n /dev/sdb)

Daniel Dracke have a detailed guide about this and that can be found here.

Comments

No comments yet

Be the first to leave a comment.

Leave a comment

Name and email required · moderated before publish · plain text only