LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
LinkBack Search this Thread
Old 09-08-2005, 07:47 AM   #1
saltire
Member
 
Registered: Feb 2005
Location: Christchurch, NZ
Distribution: Kubuntu Dapper 6.06
Posts: 43

Rep: Reputation: 15
mounting usb mp3 player


Hi,

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.)

Any ideas would be greatly appreciated : )
 
Old 09-08-2005, 09:31 AM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
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)?
 
Old 09-08-2005, 07:28 PM   #3
saltire
Member
 
Registered: Feb 2005
Location: Christchurch, NZ
Distribution: Kubuntu Dapper 6.06
Posts: 43

Original Poster
Rep: Reputation: 15
Yup. Mounted it with
Code:
mount /dev/sde /mnt/mp3
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?
 
Old 09-08-2005, 08:02 PM   #4
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
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.
 
Old 09-08-2005, 08:48 PM   #5
saltire
Member
 
Registered: Feb 2005
Location: Christchurch, NZ
Distribution: Kubuntu Dapper 6.06
Posts: 43

Original Poster
Rep: Reputation: 15
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.
 
Old 09-08-2005, 09:00 PM   #6
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
Does Mandr(ake|iva) use udev? If so, you could add udev rules that would use device names, serial numbers, etc. to assign them a constant name.
 
Old 09-09-2005, 12:51 AM   #7
saltire
Member
 
Registered: Feb 2005
Location: Christchurch, NZ
Distribution: Kubuntu Dapper 6.06
Posts: 43

Original Poster
Rep: Reputation: 15
Ok, Googled 'udev rules' and came up with these pages which are really helpful:
Writing udev rules
Linuxcommand.org's udev man page

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?
 
Old 09-09-2005, 10:50 AM   #8
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
Code:
/dev/mp3 /mnt/mp3 vfat noauto,defaults,umask=000 0 0
or however you want it mounted.
 
Old 09-09-2005, 10:32 PM   #9
saltire
Member
 
Registered: Feb 2005
Location: Christchurch, NZ
Distribution: Kubuntu Dapper 6.06
Posts: 43

Original Poster
Rep: Reputation: 15
After some experiventation, I found
Code:
/dev/mp3 /mnt/mp3 vfat noauto,noexec,rw,umask=0,user 0 0
works best.

Thanks for all the help!
 
Old 09-10-2005, 01:04 PM   #10
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
Just as an FYI, I believe user implies noexec. Doesn't really matter, just an FYI.
 
Old 09-28-2005, 01:10 AM   #11
gallan
Member
 
Registered: Nov 2004
Location: Finland
Distribution: fedora core 3
Posts: 38

Rep: Reputation: 15
hello,

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.

thanks
 
Old 09-28-2005, 01:56 AM   #12
gallan
Member
 
Registered: Nov 2004
Location: Finland
Distribution: fedora core 3
Posts: 38

Rep: Reputation: 15
ok everything is working now! only thing what I changed was I turned haldaemon service on. so now I know where I need that service
 
Old 01-01-2008, 12:29 AM   #13
smitchel1099
LQ Newbie
 
Registered: Dec 2007
Posts: 9

Rep: Reputation: 0
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!
 
Old 01-01-2008, 12:36 AM   #14
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
FWIW, you can write your own udev rules to give devices names that are a bit more meaningful to you. See this for info.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mounting the Rio MP3 Player as USB Storage Device? apachedude Linux - Hardware 4 12-31-2007 11:39 PM
mounting "Jens of Sweden" mp3 player (USB) jaakkop Linux - Hardware 1 04-16-2005 04:17 PM
USB MP3 Player not mounting on debian sarge PEACEYALL Linux - Newbie 6 03-29-2005 07:11 AM
Mounting USB Mp3 player (iRiver H3XX) in Linux vharishankar Linux - General 2 02-27-2005 05:48 AM
mounting USB mp3 player. omes Linux - General 6 01-09-2005 01:23 PM


All times are GMT -5. The time now is 01:48 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration