lux-integ wrote:
> read/write access for usb-sticks can be made by editing /etc/auto.misc
> as:-
>
> ustick -fstype=vfat,rw,gid=8,umask=002 :/dev/sdXY
>
> the 'kludge' is to create a few (2 or 3) for different values of X and Y
> so that if/when the usb device is plugged out then in again (and gets
> another usb-bus-ID), it can still be accessed.
Perhaps it does not have to be a 'kludge'
Note: I am using udev-113, and autofs-4.1.4 but I believe this will
apply to later/current version of each package. My kernel is 2.6.23.9
I have been using autofs with udev for a few years now
To get persistent naming try this:
1) Plug in you usbstick (if it is already plugged in, unplug it first
and then plug it in again)
2) type: dmesg | tail -n25
At the end of this output you should see what your kernel sees the
device as
On my system, the kernel sees:
usb-storage: waiting for device to settle before scanning
scsi 5:0:0:0: Direct-Access SanDisk Cruzer Micro 0.1 PQ: 0 ANSI: 2
sd 5:0:0:0: [sdg] 1000944 512-byte hardware sectors (512 MB)
sd 5:0:0:0: [sdg] Write Protect is off
sd 5:0:0:0: [sdg] Mode Sense: 03 00 00 00
sd 5:0:0:0: [sdg] Assuming drive cache: write through
sd 5:0:0:0: [sdg] 1000944 512-byte hardware sectors (512 MB)
sd 5:0:0:0: [sdg] Write Protect is off
sd 5:0:0:0: [sdg] Mode Sense: 03 00 00 00
sd 5:0:0:0: [sdg] Assuming drive cache: write through
sdg: sdg1
sd 5:0:0:0: [sdg] Attached SCSI removable disk
sd 5:0:0:0: Attached scsi generic sg6 type 0
usb-storage: device scan complete
It is the 'sdg' part that I am interested in (similar for your system)
Leave the device plugged in
3) type: udevinfo -a -p /sys/block/sdg | tee usbstick_udev.output
# Use your information in place of sdg
# you can do this as a regular user *not* root
# The 'tee' command is so you can log the output for reading later
# you can use 'less usbstick_udev.output' to read the output
# my output is *not* included to keep this post short(er)
4) Now we want to make a persistent rule for you usbstick so that it is
named
the same thing every time the device is created:
I created a file: /etc/udev/rules.d/10-card_reader.rules (as root user)
and placed the following line in it:
SUBSYSTEMS=="scsi", ATTRS{model}=="Cruzer Micro|JUMPDRIVE|Flash Reader",
NAME{all_partitions}="JumpDrive"
I can't remember why I made the rule early (10-*) but I think it is
important
The above is all one line. see
http://www.reactivated.net/writing_udev_rules.html
for details on how to make good udev rules. Make sure you read it and
follow exactly what it says. The website explains how to decipher the
above output and how rules are made from that output
Once your udev rule is created:
5) Modify you autofs.misc (or what ever you have named yours) to
something like this:
JumpDrive -fstype=vfat,rw,gid=disk,umask=002 :/dev/JumpDrive1
see man 5 autofs for details on syntax and options. Also man mount for
more information
Now for extra measure, I created a symlink in /media like this:
ln -s /var/autofs/JumpDrive /media/JumpDrive which looks like this with
ls -l /media:
JumpDrive -> /var/autofs/JumpDrive
I did this so I could go to a consistent location to see the contents of
my usbstick without trying to remember where the actual autofs drive is
for the device. This is only for personal preference and not necessary.
Once all of this is done you should have:
1) A persistent name /dev/ustick (or whatever your preference is)
2) A way to automount the device when it is plugged in (autofs
functionality)
3) Possibly an easy way to find the device from the command line or GUI
file manager
4) A device that will auto-unmount once it is not in use or unplugged
I hope this helps you get your device working and handled like you want.
rblythe
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page