LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Making usb stick with device names (https://www.linuxquestions.org/questions/linux-hardware-18/making-usb-stick-with-device-names-255738/)

mrsolo 11-16-2004 06:00 PM

Making usb stick with device names
 
I am really agitated about something, is there anyway to make certain usb devices stick with a certain /dev/sd* name? I have a lot of devices that use either the usb mass storage module or use certain flash cards. For the flash cards, I have a rather cheap ($12) 12in1 reader. In windows, when you plug the flash reader into the computer, windows has 5 drives listed (usually dives f-j) for each of the flash reader's 5 slots. When this device is plugged into linux without any flash cards in it, the dmesg says:

usb 5-3: new high speed USB device using address 6
scsi3 : SCSI emulation for USB Mass Storage devices
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi3, channel 0, id 0, lun 0
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sdb at scsi3, channel 0, id 0, lun 1
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sdc at scsi3, channel 0, id 0, lun 2
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sdd at scsi3, channel 0, id 0, lun 3
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sde at scsi3, channel 0, id 0, lun 4
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sdf at scsi3, channel 0, id 0, lun 5
USB Mass Storage device found at 6

Now I understand this, the slots are being reported as scsi devices. What I don't understand is that when I do put a card into on of the slots and try and mount it, it gives me errors, below is an example:

mount -t vfat /dev/sdc1 /media/usb/
mount: special device /dev/sdc1 does not exist

mount -t vfat /dev/sdc /media/usb/
mount: block device /dev/sdc is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/sdc,
or too many mounted file systems

Why isn't this working? There's a card in the slot and as the second command reports, it sees the card but is unable to mount it. Now when I plug the flash reader into linux when there's already a card in the reader, there is no problem. The kernel sees the card and is able to automount it:

usb 5-3: new high speed USB device using address 9
scsi6 : SCSI emulation for USB Mass Storage devices
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
SCSI device sda: 121856 512-byte hdwr sectors (62 MB)
sda: Write Protect is on
sda: Mode Sense: 02 00 80 00
sda: assuming drive cache: write through
/dev/scsi/host6/bus0/target0/lun0: p1
Attached scsi removable disk sda at scsi6, channel 0, id 0, lun 0
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sdb at scsi6, channel 0, id 0, lun 1
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
SCSI device sdc: 121856 512-byte hdwr sectors (62 MB)
sdc: Write Protect is on
sdc: Mode Sense: 02 00 80 00
sdc: assuming drive cache: write through
/dev/scsi/host6/bus0/target0/lun2: p1
Attached scsi removable disk sdc at scsi6, channel 0, id 0, lun 2
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sdd at scsi6, channel 0, id 0, lun 3
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sde at scsi6, channel 0, id 0, lun 4
Vendor: Generic Model: STORAGE DEVICE Rev: 9134
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sdf at scsi6, channel 0, id 0, lun 5
USB Mass Storage device found at 9

Now here's the automatically generated fstab entry:

/dev/sdc1 /mnt/hd auto umask=0022,user,iocharset=iso8859-1,sync,kudzu,codepage=850,noauto,exec,users 0 0

Now users can access this mount point and read just fine from but nobody can write to it. Now I noticed that the dmesg showed that /dev/sdc1 (which is an SD type flash card) was write protected and mounted in read-only but I don't see why. The flash card itself is not write protected. However, when I use an XD card, there is no write protection and if a regular user mounts it, she/he can write to it as needed.

Another problem is that when the computer automounts it, only the root user has write access to it while other users can only read from it (however, if an fstab entry is made about a certain device then users have write access to it). I would like to change that. Is there anyway to change the automount to allow regular users the priviledge of writting? Also, is there a way to make the computer always mount a certain device as say /dev/sda all the time? I know that this isn't ideal but I would like to be able to set up some mount points in fstab and just have to type mount /media/usb without having to determine which device in the /dev folder it's under.


All times are GMT -5. The time now is 06:12 PM.