usb drive connects as different devices when connecting to my computer
SlackwareThis Forum is for the discussion of Slackware 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.
usb drive connects as different devices when connecting to my computer
I have a 1 tb usb drive. So far I have three, 200gb partitions and the rest unused. I wanted to setup the usb drive so that only I can use it and in my home directory. However when I connect the usb drive at boot or when my computer is already running, the partitions show up as different devices. At boot the partitions are /dev/sda1 ,2,3 . When I plug the usb drive in after my computer is running, I get /dev/sdb or something similar. I also get a different mount point such as /media/disk-1 instead of /home/me/...
Further more, I can only mount as root instead of me when the device is different.
You'll have to create a new udev rules file. It's a somewhat lengthy process, but not very complex. Google it - you'll find a couple clear tutorials that will help you do it. It's time well spent.
You can specify a device by its UUID in /etc/fstab (read `man fstab`). This should allow the drive to be mounted properly and always in the same location through fstab.
You can specify a device by its UUID in /etc/fstab (read `man fstab`). This should allow the drive to be mounted properly and always in the same location through fstab.
That's the way I would go, and it's much quicker than writing udev rules LOL
Can you use that method for a single drive that is partitioned? I'm not familiar with the UUID way - I'll look into it - but I know the udev rules method is capable of dealing with any scenario.
I'm not sure this UUID is what you're looking for and here's why: You're trying to assign a piece of hardware to a certain device in the /dev directory. The fstab will be easy for assigning /dev/sda1 to a specific mount point, but who's to say /dev/sda1 is always the same piece of hardware?? I would love to see an example of using UUID to identify a specific piece of hardware, assign it to the proper /dev item and then mount it to a specific mount point.
With udev rules, I can make sure the media reader in my printer is always mounted to a specific directory; I can ensure that all four of my jump drives get mounted in the same exact place every time I plug them in, regardless of what order I plug them in.
I'm not saying UUID can't do it - I just want to see *how* it does it. So please give an example.
Okos, what are you trying to map? Tell me what piece(s) of hardware you're trying to set up and I'll tell you exactly how to do it. Then you'll see that udev rules aren't hard at all! It just takes about 2-3 minutes for each piece of hardware but once it's done, you can copy that rules file to any linux box and it'll work exactly the way you want, as long as you create the custom mount point directories, because each piece of hardware has a unique identifying number that udev will use to make all of this happen.
Then I created the /media/jumpdrive1 directory and mounted it perfectly.
I'm really happy about this thread! I learned something very useful. Contrary to what I thought this method wouldn't do, it basically just forgets the entire /dev designation and identifies hardware with UUID. Although each piece of hardware might change the /dev item is gets assigned, the mounting of that hardware is not affected.
Last edited by Vincent_Vega; 09-14-2008 at 08:44 PM.
Interesting self-discussion () and thanks for providing a full solution. I should learn to write udev rules for other reasons, but for something like this fstab seems like the easier solution.
LOL! Well, I think there's nothing worse than someone getting help here and never sharing the final solution they find. I figured that I would just go ahead and talk to myself for a while, and at the same time give the solution since I was just as interested in this issue as anyone. It should be noted, however, that I generally don't have these self-discussions...
Last edited by Vincent_Vega; 09-14-2008 at 09:00 PM.
That's who I'm referring to! That is what was on the front of the t-shirt he wore at the end of the great documentary "Pumping Iron" when he won the 1975 Mr. Olympia. It's a must-see. The guy is a legend. There's no denying that!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.