LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-13-2008, 10:38 PM   #1
okos
Member
 
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609

Rep: Reputation: 38
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.




I set my fstab to look as so:
Code:
/dev/hdc2        swap             swap        defaults         0   0
/dev/hdc1        /                ext3        defaults         1   1
/dev/hdc3        /vm              ext3        defaults         1   2
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro  0   0
#/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
/dev/sda1       /home/me/mybook vfat    rw,auto,uid=1000,sync,exec        0      0
/dev/sda2       /home/me/backup ext3    rw,auto,uid=1000,sync,exec      0      0
/dev/sda5       /home/me/windblows vfat   rw,auto,uid=1000,sync,exec      0      0
Is this a udev issue? How can I mount as the same device and mount point each time?

Last edited by okos; 09-13-2008 at 10:43 PM.
 
Old 09-13-2008, 10:43 PM   #2
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
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.
 
Old 09-13-2008, 10:44 PM   #3
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
This is the one I used. Worked perfectly for me.

http://www.reactivated.net/writing_udev_rules.html
 
Old 09-13-2008, 11:27 PM   #4
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
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.
 
Old 09-14-2008, 09:35 AM   #5
masonm
Senior Member
 
Registered: Mar 2003
Location: Following the white rabbit
Distribution: Slackware64 -current
Posts: 2,300

Rep: Reputation: 90
Quote:
Originally Posted by T3slider View Post
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
 
Old 09-14-2008, 07:15 PM   #6
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
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.
 
Old 09-14-2008, 07:35 PM   #7
okos
Member
 
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609

Original Poster
Rep: Reputation: 38
Quote:
Originally Posted by masonm View Post
That's the way I would go, and it's much quicker than writing udev rules LOL
I started reading the udev link last night before I fell asleep

How do you do it the uuid way?
What is uuid anyways?
 
Old 09-14-2008, 07:43 PM   #8
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
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.
 
Old 09-14-2008, 07:46 PM   #9
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
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.
 
Old 09-14-2008, 07:50 PM   #10
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
Here it is - a UUID How-To. Looks like it works just like the udev rules I guess. You can give it a shot and tell us how everything goes.

http://linux.byexamples.com/archives...tab-with-uuid/
 
Old 09-14-2008, 07:58 PM   #11
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
UUID Works Great!

I used this command:
Code:
blkid /dev/sdd1
to get a simple UUID. Then I added it to my /etc/fstab:
Code:
UUID=C123-C567  /media/jumpdrive1  vfat  defaults  0  0
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.
 
Old 09-14-2008, 08:52 PM   #12
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
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.
 
Old 09-14-2008, 08:58 PM   #13
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
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.
 
Old 09-14-2008, 10:46 PM   #14
okos
Member
 
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609

Original Poster
Rep: Reputation: 38
I will try the uuid and read the link.
Thanks guys for all of your help!
I will follow up after I make the changes.

BTW Talking to yourself is therapeutic. Just don't answer or they will throw you in the funny farm.

One last thing Vincent, which Arnold is #1? Are you talking about the CA govenor?
 
Old 09-14-2008, 10:54 PM   #15
Vincent_Vega
Member
 
Registered: Nov 2003
Location: South Jersey
Distribution: Slackware, Raspbian, Manjaro
Posts: 826

Rep: Reputation: 31
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!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Flash drive mount at boot time logeait Linux - Embedded & Single-board computer 4 08-03-2008 02:12 AM
How do I mount a usb drive at boot time? Mountain Linux - Server 2 03-23-2008 11:35 PM
my mp3 player connects and disconnects all time alaios Linux - Hardware 3 09-17-2007 01:47 PM
Mount points on usb devices (dig. camera, zip drive, external hard disk) Impaler Linux - Hardware 3 05-29-2006 11:08 PM
How to mount several USB devices (camera + handy-drive)? eneko Linux - Newbie 4 11-05-2003 07:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration