Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with 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.
I'm trying to figure out a way to automatically mount a USB mp3 stick I have. Mandrake seems to detect it OK but won't mount it. Unlike my USB memory stick, which it detects and mounts automatically...
dmesg output:
Code:
usb 2-1: new full speed USB device using address 4
scsi6 : SCSI emulation for USB Mass Storage devices
Vendor: Model: Rev:
Type: Direct-Access ANSI SCSI revision: 02
SCSI device sde: 503521 512-byte hdwr sectors (258 MB)
sde: Write Protect is off
sde: Mode Sense: 00 c0 00 00
sde: assuming drive cache: write through
/dev/scsi/host6/bus0/target0/lun0: unknown partition table
Attached scsi removable disk sde at scsi6, channel 0, id 0, lun 0
USB Mass Storage device found at 4
I did manage to mount it once, but it was a major pain, and one big problem is that the scsi device file created is dynamic (ie it might be sde, or sdf, or sdg, etc) depending on what else is plugged in at the time.
(I notice that /etc/fstab changes dynamically, too, when I plug in my memory stick, but not when I plug in the mp3 player.)
It doesn't seem to have a partition table on it. This is odd, but not unheard of with flash media. Is it mounted just by mounting the root device? (/dev/sdX)?
and this worked fine, but I couldn't unmount it manually, getting a message that the device was busy.
Is there a line I could add to, say, /etc/fstab, or something I could change in udev to get it working, you think?
Or is the lack of partition table a problem?
You probably couldn't unmount it manually because a terminal window or file browser was still in (current directory within) that mount. You could try adding an fstab line, like any other, only without a partition number.
Aha!
That solved my manual mount/unmount problem - Thanks!
But the problem I see with putting a line is /etc/fstab is that it may affect other USB devices, depending on what order they are plugged in.
For example, if I plug in my USB memory stick (which Mandrake automounts fine), it might be assigned to /dev/sde. If I then also plug in my MP3 stick, it will be assigned /dev/sdf.
What I'm in thinking is to find out which scripts Mandrake uses to automount my memory key, and then see how it's done so that I can apply the same scripts (or modify them) to mount the MP3 stick.
Created a new file 02-generic_mp3.rules in /etc/udev/rules.d directory, with the lines:
Code:
#SCSI disk with a specific vendor and model number will be called mp3%n
BUS="scsi", SYSFS{vendor}="USB2.0", SYSFS{model}="(FS) FLASH DISK", NAME="mp3%n"
and added the following lines to 00-udev.permissions in /etc/udev/permissions.d/ :
Code:
#-------------------------------
# mp3 stick, added by saltire
mp3*:$local:$local:0660
and ran udevstart to restart everything.
So far so good. Now a device named 'mp3' appears in /dev when I connect the mp3 stick.
What should the entry in /etc/fstab read in order to automatically mount the new device to /mnt/mp3?
this topic have been great help but I still have two questions/problems. how to get icon to desktop automatically and get permissions to mount an umount it.
when I connect mp3 player it will create mp3 and mp31 files to /dev. I have add this line to /etc/fstab:
/dev/mp31 /media/mp3 vfat noauto,noexec,rw,umask=0,user 0 0
icon to desktop is not coming before I type as root mount -t vfat......and when I try to umount it from desktop it will say that you have to be root to do this. so where can I change permission to icon and mounting? I have tried to change that 0660 number but that didn't help but maybe I did something wrong.
how to mount USB devices in the same place every time:
I know I am replying well after the original post, but I know an answer of how to make devices be seen as the same device all the time so am replying for those who read this in the future.
Since you said you have udev,
plug your device in, wait for it to settle (5-10 seconds) then run the following command:
ls /dev/disk/by-id/
Look in the listing for your device. The unique name it gives in this listing is a way to access that particular device every time you want to mount it.
Here is the end of the listing I get:
...
usb-Generic_Flash_HS-CF_000022272228-0:0
usb-Generic_Flash_HS-COMBO_000022272228-0:1
this shows the unique name that my 6-in-1 reader built in to my dell monitor can be accessed by.
Note there is 1 device there, but it sees 2 LUNS, 0 and 1, so there is two lines for the reader.
The way you use this manually for one-time use is to enter the following on 1 line in a root terminal:
mount /dev/disk/by-id/usb-Generic_Flash_HS-CF_000022272228-0:0 /media/CFcard
...assuming you have created a directory /media/CFcard beforehand.
to mount this usb device on a regular basis, you would probably make an entry in your file system table for it. That is the file /etc/fstab.
put an entry into it like this (be root first):
# --------- card reader in monitor ----------
/dev/disk/by-id/usb-Generic_Flash_HS-CF_000022272228-0:0-part1 /media/cfcard
auto noauto,users,owner,umask=000 0 0
The above is 2 lines, a comment then the entry line, even though the preview here shows it as 3 -4 lines...
Then when you want to use the device, plug it in, and in a root terminal type:
mount /media/CFcard
and your system will look into the fstab, pull the unique name and mount it in the place specified, using the options that are in your fstab entry for that device.
That is one of the neat things about UDEV--it lets you get a unique name for each device, so you can mount it in the same place and you don't have to worry if you had 1 or 10 usb devices plugged in this session--the unique device name is always the same.
I have a bunch of scsi drives and as confusing as it is when you only have usb things using sda, sdb, etc. designations, it is more confusing when you have a bunch of scsi disks as well. When you boot with a usb drive in, it changes the boot order of the scsi disks and that is confusing!
Unless, of course, you mounted your scsi disks with the udev unique device name--then they are the same all the time no matter what else is plugged in!
You can also mount your mp3 player with it's udev unique name and have it mount the same place every time.
You can use this same method to mount your external usb hard drive too.
Need to use a regular tool like fdisk?
fdisk /dev/disk/by-id/usb-Generic_Flash_HS-CF_000022272228-0\:0
works the same way!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.