Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm wondering if it's possible to assign a path to a certain piece of hardware that is plugged into my system. Basically I would like something like /dev/ipod when my ipod gets plugged in. I have both an external SATA drive and an Apple iPod. Depending on the order of when they are plugged in, they either are assigned to /dev/sda or /dev/sdb. As you can imagine, this greatly interferes with my scripts and my /etc/fstab file. So is there any way to specify how the device gets assigned it's /dev/ path?
I know that it is possible to do what you want with udev, it is one of the things that it was *designed* to do:
Quote:
Say that I have two printers - a HP laser printer and an Epson inkjet. When they are both plugged in and on, I have /dev/lp0 and /dev/lp1.
How do I know which node refers to which printer? There is no easy way. The first printer that got connected was assigned name "lp0", and the second "lp1". Plugging in my printers in a different order would swap the names here, and that would mess up my scripts that always expect my HP laser printer to be lp1.
However, if my HP laser printer got named lp_hp (as well as lpX) and my other printer got named lp_epson (as well as lpY), then my scripts could just refer to those names. udev magic can control this and ensure that these persistent names always point to the device that I intended.
Unfortunately, since I have never used udev, I don't know exactly how this is done, but you might find this useful (the source of the above quote):
The section that I linked to has some information about creating a udev rule. In regards to my last post, does that mean I'm running udev? I'm assuming so, but I would like some confirmation!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.