Mikkel L. Ellertson wrote:

SnapafunFrank wrote:

Mikkel L. Ellertson wrote:

SnapafunFrank wrote:

The current actually working is that I can plug in a flash drive - wait a moment - and the files become accessible to and from it. That is sometimes! At other times I'm sure I'm doing damage because the device appears to be unmounted and will not have the files seen, but when I do mount it manually, root can see the files but user cannot, making me think at times that I have wiped the flash drive. Further, the Howto's I followed allowed me to have any device I plugged in recognized for what it is within /mnt - but that has never worked since the first reboot though all the files appear to be in place. The very first time I tried to test my work, this actually did work, and often whilst I was within that session.

( I used the

http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Flash-Memory-HOWTO.html#linux-2.6


to install udev - it's quite conclusive.)


If you set up rules for udev to give specific names to USB devices, in place of the names the kernel gives them, you will break the automounting that hotplug does. You can create your own rules to handle the mounting in place of the standard ones. This allows you to control how things get mounted. For example, when you plug in a PNY memory stick, you can have it get mounted on /mnt/pny instead /dev/removable. (Don't ask for the full details yet - I am still playing with this.



My link above may help ?

> Well, it show me where you went wrong. I like

http://www.reactivated.net/udevrules.php#

better.


) You can get more specific, and do things like have 32MB sticks mount one place, and 64MB mount in another. Basicly, you can test any of the tags that udev know about, and build rules based on them.

While mounting specific memory devices in specific places may not be real usuefull, when you start talking about USB hard drives, that is another story. If you have more then one partition on the drive, then current hotplug code will not mount it. Also, if you have requirments that different partitions on the drive be mounted in specific places, you can handle them this way. Maybe one partition needs to mount on /backup, and another on /opt/pictures, or something like that.

Now, as far as users being able to access files on USB storage devices, it depends on how you mount them. If you just do something like
"mount /dev/sda1 /mnt/removable", then your users will not be able to access the files. But if you do something like
"mount /dev/sda1 /mnt/removable -o umask=0", then they will have access.


Using sda1 may not be the best choice in this example, as if you plug in a USB "PEN" drive, and it uses the default device, it will get automounted, but I think you get the idea. If you have udev set to create something like /dev/pen and /dev/pen1, then use pen1 in place of sda1, and it will work.

Mikkel



Thanks Mikkel

If you follow the above link you will be able to see what I did as I followed it precisely.

And as I have said before, during that particular session it actually worked exactly as explained in the above howto ~ that is until I got a little carried away with changing all my usb memory sticks around without waiting long enough for the system to catch up ~ end result - I corrupted my .ICEauthority file and within rescue mode had to delete that and start again with all my customizing. [ Still finding stuff that needs to be updated because of this. ]

Anyway, your comments above make a lot of sense so I'm off to check things out before posting this:

First up:

<--------------------[ snip ]------------------------------->


OK. The USB devices are 16MB, 64MB, Works128MB whilst Camera1 is a Flash card from the camera.
Each of them has " noauto" and three of them has "ro" whilst one has "rw".
So I need a lesson here : none of them have the "-o" option Mikkel mentions ~ and what is the true meaning of "noauto" ?
For now I will only change the "ro" to "rw".


As to the naming convention mentioned by Mikkel, I believe that is done here:

[EMAIL PROTECTED] frank]$ cat /etc/udev/udev.rules
<...snip...>
<.../snip...>
# if this is a ide cdrom, name it the default name, and create a symlink to cdrom
BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom"


# create a symlink named after the device map name
# note devmap_name comes with extras/multipath
KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c"


# DRI devices always go into a subdirectory (as per the LSB spec)
KERNEL="card*", NAME="dri/card%n"

# Flash Memory 16MB
BUS="scsi", SYSFS_vendor="M-Sys*", NAME="16MB%n"

# Flash Memory 64MB
BUS="scsi", SYSFS_vendor="USB*", NAME="64MB%n"

# Card Reader for MyCanonCamera
BUS="scsi", SYSFS_vendor="SIIG*", NAME="Camera%n"

# Flash Memory "Works 128MB"
BUS="scsi", SYSFS_vendor="OTi*", NAME="Works128MB%n"
<...snip...>

Hmmm.... I am concerned on two things here, first my system is not mounting my flash drives as at first session ~ they all are seen as "removable2" only now.

My /mnt directory shows /dvd(see later for this one) + /dvd-cd + /dvd-rw along with /cdrom + /cdrom2 .

I have removed the two cdrom drives some time ago and guess I need to remove something here ~ but how does the system see the dvd-cd and dvd-rw ?
[ I believe the dvd entry maybe something I did in an attempt at one stage to mount a dvd that I could not see after I put it in.]


Enough for now ~ anyone care to get out their axe and start chopping at that /etc/fstab above ?

In case anyone wants to know what I'd like to have ~ basically dvd + cd + usb auto mounted and usable as user ( the dvd drives both accept cd as well ).

I'll worry about my USB 20GB hard drive later.

And yes Mikkel, you lost me with the "renaming not now auto~mounting " stuff as I understood that the howto I followed was pointing me to having things so mounted ?????
We live and learn I hope.



A couple of things. First of all, the mounting rules that start /udev/<device> are not going to work with the default Mandrake 10.1 setup. The reasion for this is that udev still creates their devices in the /dev directory tree. So as soon as you do a reboot of the system, udev is back putting things in /dev, and that breakes the /udev stuff.

Second, if you want to have your own rules for naming things, the way to do it is to create a file in /etc/udev/rules.d for your rules. I use 10-local.rules, but you can use any name you like, as long as it ends in .rules - just remember, the name determines the order the rules are checked in, and the first matching rule is used. The current rules are in this directory.

Now, if you do not use special names for usb storage devices, then hotplug will mount then as /mnt/removable, /mnt/removable1, etc and also create desktop icons in KDE or Gnome for them. It also takes care of removing them when you unplug the device. But you do not have much control on what device is mounted where. The first one plugged in gets /mnt/removable, the second /mnt/removable1, and so forth. But it also seams to keep track of the devices, so if you unplug one, and plug in a second, it has the same affect as plugging in the second one while the first one is still plugged in.

If you do use your own names, then you have to take care of mounting the devices, creating the fstab entries, etc. This is the part that I am playing with. I can have my own devices created, and I can use supermount to take care of mounting them when they are plugged in, but this has a couple of drawbacks. One is that as soon as you create the supermount entry in /etc/fstab, then it shows up on the desktop as a mounted drive. Trying to open this icon when the device is not plugged in generates an error message. With the device plugged in it works fine.

The fix for this is to create the entries in /etc/fstab when the deviceis plugged in, and remove then when it is removed. While I can create hand-crafted rules to do this, I am more interested in re-using as much of the Mandrake scripts as possible. If I am using the same interface as hotplug is using, then I should not have to change things unless the way the scripts are called changes. It is more work to do it that way, but when I am done, I should have something that I can then give to others, and they can adapt it for their use by changing a config file or two.

If I do my part right, then someone else my even create a nice GUI that will let you do something like plug in a USB device, select it from a list, and specify where and how you want it mounted. Then the rules will get written so that the next time you plug in that device, it is called the name you specified, and mounted where you wanted it. Something like:

Plug in your 128MB PNY pen drive.
Select it from the list of USB storage devices.
Say you want this mounted on /mnt/PNY-128
Limmit access to your user name.

or

Plug in you 128MB PNY pen drive.
Select it from the list of USB storage devices.
Say you want this mounted on /mnt/PNY-128
Limmit access to the user currently logged into the console.

Mikkel

Thanks again Mikkel, it's going to take some absorbing on my part to understand what you have said above, so for now I need to do that and correct my system accordingly.


Will let you know how I get on. Oh, and thanks for the link.

One minor correction, I'm still using MDK10, though I don't think this effects things here too much.

I'm waiting to get my Athlon 64 FX together before going to MDK10.1 as this old PIII system can only handle so much before it starts to get bogged down. This is the only issue I have at present ( pnp ) as the other things I need at present seem to be firing OK.

If you decide to share you endeavours once done then please include me in your notifications as I'm very interested in the outcome. For now, good sailing.

--
Newbie Seeking USER_FUNCTIONALITY always!

Regards

SnapafunFrank

Big or small, a challenge requires the same commitment to resolve.
Registered Linux User # 324213



____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to