LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 05-20-2010, 05:29 AM   #16
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208

Quote:
Originally Posted by Josh000 View Post
I would think the best way would be to look at whatever unique information there is, and use that....otherwise I might have to settle for manufacturer + size as an identifier.
If you it might be most robust to use the udevadm info -a -p <path> command to get the information because there was an LQ thread recently where someone reported that lsusb -v was reporting different information. I am willing to post information from my USB sticks to hep with the project if you like.

Last edited by catkin; 05-20-2010 at 05:29 AM. Reason: speeling
 
Old 05-20-2010, 05:33 AM   #17
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Original Poster
Rep: Reputation: 35
Quote:
Originally Posted by catkin View Post
If you it might be most robust to use the udevadm info -a -p <path> command to get the information because there was an LQ thread recently where someone reported that lsusb -v was reporting different information. I am willing to post information from my USB sticks to hep with the project if you like.
Hi catkin,

I appreciate the offer of assistance.

I am not too sure how much time I will spend on this, as it just isnt that important in the scheme of things. I was just curious

Plus, I spilet coke on my laptop yesterday, so it will probably be a while before I get back to linux stuff since that was my only PC...
 
Old 05-20-2010, 06:39 AM   #18
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by Josh000 View Post
I am not too sure how much time I will spend on this, as it just isnt that important in the scheme of things. I was just curious
I couldn't see the point of it myself but that's what you asked about so I didn't question it -- OP's privilege!

Quote:
Originally Posted by Josh000 View Post
Plus, I spilet coke on my laptop yesterday, so it will probably be a while before I get back to linux stuff since that was my only PC...
Oh! That is going to slow things down a bit
 
Old 05-20-2010, 10:08 AM   #19
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by Josh000 View Post
Well, I do, but not as you and catkin implied. I had hoped that comparing it w=to windows drive letters cleared things up, but apparantly not.
Well, I haven't used Microsoft Windows any more than absolutely necessary in the last 10 or so years, so I am not familiar with the way that pile of stuff works.

Quote:
Originally Posted by Josh000 View Post
Basically...lets say I have 3 usb sticks, a, b and c. They are mounted with a on /media/usb2, b on /media/usb1 and c on usb3.

What I want, is that whenever I put in usb stick a, it will always be mounted on /media/usb2, regardless of if /media/usb1 is available or not.

So if I have usbsticks b and a mounted, they will automount at /media/usb1 and /media/usb2 respectivley. A new never used before disk will then go to /media/usb3.

If I then unmount usb disk b, freeing up /media/usb1, and place in a second never used before stick, it will go to /media/usb1 since it is currently unused.

If I then put in usb stick a again, it will be mounted at the newly created /media/usb4.


Does that make sense? If it does, are you saying pmount and ivman fit the bill?
What you describe above is inconsistent behavior, unless you are telling me that usb stick "a" is a very special case. Plus I think the last stick you mention should be usb stick "b" instead of "a".

The pmount code will test /media/usbdisk mount points by default, using the sequence /media/usbdisk, /media/usbdisk1, /media/usbdisk2, etc. When it finds one that is in not currently in use (nothing mounted there), that's where it will mount the usb stick. (Which is pretty much how the various desktop environments that I've used do it. Nautilus just uses /media/disk, /media/disk-1, /media/disk-2, etc.)

pmount checks /etc/fstab for the device you are trying to mount and will actually use "mount" if it finds a match. So you would put an entry for usb "a" in there if it is a special usb disk that you want mounted at a specific location.

I've glossed over a couple of things, such as the actual base name for the mount point comes out of hal. That means that you can make a hal policy so that usb sticks will be mounted on /media/usb, /media/usb-1, etc.
 
Old 05-20-2010, 10:43 PM   #20
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Original Poster
Rep: Reputation: 35
Quote:
Originally Posted by Richard Cranium View Post
What you describe above is inconsistent behavior, unless you are telling me that usb stick "a" is a very special case. Plus I think the last stick you mention should be usb stick "b" instead of "a".
I double checked my example, and I didn't make a mistake.

Why do you think the behaviour is inconsistant? If anything, I see it as consistant, and none of the devices would be special cases...
 
Old 05-20-2010, 11:42 PM   #21
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by Josh000 View Post
I double checked my example, and I didn't make a mistake.

Why do you think the behaviour is inconsistant? If anything, I see it as consistant, and none of the devices would be special cases...
I find the statements...
Quote:
What I want, is that whenever I put in usb stick a, it will always be mounted on /media/usb2, regardless of if /media/usb1 is available or not.
...and...
Quote:
If I then put in usb stick a again, it will be mounted at the newly created /media/usb4.
...to be inconsistent.

But then again, you never mentioned removing usb stick "a" at all in your example.

So, to simplify the discussion a little bit, let's assume that you have 5 usb sticks, named A, B, C, D, and E.

You plug them into your USB mega-hub in the order A, B, C, D, and E. pmount and ivman will mount them this way:
A -> /media/usbdisk
B -> /media/usbdisk-1
C -> /media/usbdisk-2
D -> /media/usbdisk-3
E -> /media/usbdisk-4
You then unmount A and E for some reason and then plug them back in; this time you plugged E in first and A second. Your mounts now look like:
A -> /media/usbdisk-4
B -> /media/usbdisk-1
C -> /media/usbdisk-2
D -> /media/usbdisk-3
E -> /media/usbdisk
In other words, the lowest numbered (or blank numbered) mount point that is not in use will be the one used to mount the next USB drive plugged into the computer. If that's what you want, pmount and ivman can do that.
 
Old 05-21-2010, 01:14 AM   #22
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Original Poster
Rep: Reputation: 35
Quote:
Originally Posted by Richard Cranium View Post
I find the statements......and......to be inconsistent.
I still dont see any inconsistancy. Rather that example demonstrates what I was after very well.

I was not after just the first available mount point being used, but additionaly an automatic persistance of mount point assignation.

Quote:
In other words, the lowest numbered (or blank numbered) mount point that is not in use will be the one used to mount the next USB drive plugged into the computer. If that's what you want, pmount and ivman can do that.
Your example is just for first available mount points being used, which isn't what I want at all.

using your example, E should have been assigned to /media/usbdisk-4 despite /media/usbdisk being available, because that is where it was used.

But as the discussin revealed, this qould actually require quite a bit of work to implement, and probably isnt worth it.
 
Old 05-21-2010, 05:17 PM   #23
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
I was not after just the first available mount point being used, but additionaly an automatic persistance of mount point assignation.
That's what I thought after the first time that you stated pmount and ivman wouldn't work for you. But if that's what you want, then the statements "I always want USB stick A to be mounted at /media/usb2." and "If I then put in USB stick A again, it will be mounted at the newly created /media/usb4." contradict each other since /media/usb4 is not the same place as /media/usb2 but USB stick A is USB stick A.

I believe the following is what you want:
  1. You don't care where a given USB stick is mounted for the very first time.
  2. You do care that once it is mounted on a given mount point, that it will always be mounted at that mount point if you ever plug it into that computer again.
  3. Bullet number 2 implies that once you've used a mount point for a given USB stick, you will not be able to use it for any other one.

If that enumerated list is what you really want, then I agree that pmount and ivman will not do the trick.

It wouldn't be that difficult to do via a udev rule that called an external program, but you would have to have a file somewhere that maintained the mapping between the mount points that you've used and whatever you are using from udev to tell one usb stick apart from another. If you are a glutton for punishment, you could do it with bash or ash (one rather bright fellow wrote a distributed version control system in bash). Most people would use perl or python.
 
Old 05-21-2010, 06:21 PM   #24
Josh000
Member
 
Registered: Aug 2009
Distribution: Slackware 13 64bit
Posts: 534

Original Poster
Rep: Reputation: 35
Quote:
Originally Posted by Richard Cranium View Post
That's what I thought after the first time that you stated pmount and ivman wouldn't work for you. But if that's what you want, then the statements "I always want USB stick A to be mounted at /media/usb2." and "If I then put in USB stick A again, it will be mounted at the newly created /media/usb4." contradict each other since /media/usb4 is not the same place as /media/usb2 but USB stick A is USB stick A.
It isnt inconsistant. I stataed the condition that if a usb stick could not be mounted at its normoal mountpoint, then the next available must be used,

In my example /media/usb2 was taken by another stick, so it was assigned /media/usb4 instead.

Do you get what I mean?

[wuote]
Bullet number 2 implies that once you've used a mount point for a given USB stick, you will not be able to use it for any other one.
[/quote]

This isnt so. A given mount point can be used by any stick not used previously as long as it is available.

Any stick used previously should be mounted where it was previously as long as it is available, otherwise the next available mount point should be used.

Quote:
If that enumerated list is what you really want, then I agree that pmount and ivman will not do the trick.
Yup, and it loks like too much trouble to make it work. It was just an exercise in curiosity
 
Old 07-14-2010, 11:30 PM   #25
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,773
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
Quote:
Originally Posted by Richard Cranium View Post
True, but the script needs to "remember" old assignments so there has to be persisted state somewhere. If he has a lot of usb sticks, the lookup could get slow if he isn't careful. :-)
I run Ubuntu variants. When I connect USB sticks or media cards, they are automatically mounted as /media/xxxx, where "xxxx" is the volume label of the file system. For example, most of my media cards as Secure
Digital (SD) or Compact Flash (CF). I set the volume labels to "SDtitle" or "CFtitle" and assign a meaningful title string. When connected, a media card then always mounts as /media/SDthisTitle or /media/CFthatTitle.

I got all of this behavior for free simply by setting the volume label.

By the way, my NTFS file systems -- for that other OS -- also mount as /media/someLabel for each of the C:, D:, etc partitions.

~~~ 0;-Dan

PS/ All of this is udev and script based. I don't think any of it is specific to *-buntu. Let me know if you want me to suss-out the config details from one of my boxen.
 
  


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



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

All times are GMT -5. The time now is 12:05 AM.

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