Mount external HDD with static mount point


Please note that this blog has been moved.

Now it has its own domain: mynixworld.info🙂

If you want to read the latest version of this article (recommended) please click here and I open the page for you.

I have many USB external drives (hdd, flash drive, etc) and I want that they appears always with the same name under /dev folder.

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=="sdb1", NAME="wdbak_var", SYMLINK="usbdevices/wdbak_var"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Western Digital ",ATTRS{product}=="External HDD    ", ATTRS{serial}=="575845593037563230383239", KERNEL=="sdb2", NAME="wdbak_tmp", SYMLINK="usbdevices/wdbak_tmp"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Western Digital ",ATTRS{product}=="External HDD    ", ATTRS{serial}=="575845593037563230383239", KERNEL=="sdb3", NAME="wdbak_prtag", SYMLINK="usbdevices/wdbak_prtag"

SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Western Digital ",ATTRS{product}=="External HDD    ", ATTRS{serial}=="575843593037363930313237", KERNEL=="sd?1", NAME="wd250g", SYMLINK="usbdevices/wd250g"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Western Digital ",ATTRS{product}=="External HDD    ", ATTRS{serial}=="575845593037553933303036", KERNEL=="sd?1", NAME="wd500g", SYMLINK="usbdevices/wd500g"

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.

About Eugen Mihailescu

Always looking to learn more about *nix world, about the fundamental concepts of arithmetic, algebra and geometry. I am also passionate about programming, database and systems administration.
This entry was posted in linux and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s