LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Problem with USB flash drive usage (https://www.linuxquestions.org/questions/linux-kernel-70/problem-with-usb-flash-drive-usage-514106/)

wanglinux2007 12-27-2006 02:53 PM

Problem with USB flash drive usage
 
Hi,

I have two problems about usage of USB flash drives on linux(kernel 2.4). I built the kernel to support the USB mass storage devices.

[PROBLEM 1]:
I tested a USB flash drives, it works well.

I testd another flash drives from Kingston, but not work right. Once it pluged in, fdisk -l showed the device on /dev/sdc1.
Device Boot Start End Blocks ID System
/dev/sdc1 * 1 1016 2015216 e Win95 FAT16 (LBA)
Then I mounted it:
#mount /dev/sdc1 /mnt/usbstick
gave error:
VFS: Can't find ext3 filesystem on dev sd(8,33).
#mount
showed it did mount the device. But, when I checked the files on USB drive under /mnt/usbstick, the filenames were shown incorrectly:
140500~1.txt (should be: 14050000000001S1.txt)

The only diffenerce I can see with the first one is the first one has fileSystem FAT16 (run: fdisk -l).

Here are the file system support I turned on:
File systems --->
<*> DOS FAT fs support(CONFIG_FAT_FS fat.o)
<*> MSDOS fs support(CONFIG_MSDOS_FS msdos.o)
<*> VFAT (Windows-95) fs support (CONFIG_VFAT_FS vfat.o)
<*> /proc filesystem (CONFIG_PROC_FS)
<*> Second extended fs support (ext2fs) (CONFIG_EXT2_FS ext2.o)

Do I need to turn on any more support? What could be the cause?

[PROBLEM 2]:
I found if I try different USB flash drives one by one. By running "fdisk -l", I can see the first drive is attached to sda1, the second to sdb1, the third to sdc1, the forth to sdd1,... I took out the previous one before I plug in the next one, but it seems the kernel still remembers them. I can see this from: /proc/scsi/scsi. Also, it create /proc/scsi/usb-storage-* for each USB flash drive. The only way I can delete this now is to reboot the system. Is there a way to remove this information without rebooting? The ideal result is I can use device /dev/sda1 for different USB drives.

Could anyone help me with this? Thanks a lot.

wanglinux2007

Heeap 12-27-2006 03:19 PM

I think there is a problem on your fstab.
can you please post it?

wanglinux2007 12-27-2006 03:36 PM

Here is the fstab file:

# filesystem mount-point fs-type options dump fsck-order
/dev/nand2 / ext3 data=ordered 1 1
/proc /proc proc defaults 0 0
/dev/nor /var/data ext2 defaults 0 0
none /dev/pts devpts defaults 0 0
none /proc/bus/usb usbdevfs defaults 0 0

Thanks a lot.

wanglinux2007

wanglinux2007 12-27-2006 04:37 PM

Hi,

I think I got the first problem solved. I added "-t vfat" while mounting the device. It worked. It seems for some USB drives I have to specify the file type clearly. But, the second problem I still could not figure it out. Thanks for your help.

wanglinux2007

wanglinux2007 12-29-2006 08:26 AM

Hi,

I really need some help on the second question. I write it again and hope it is clear this time.
*
I want to support my users using USB flash drives(copy data files)*on my system (Linux kernel 2.4). I configured and built the kernel to support the USB mass storage devices. Now, when I plug in a USB drive, I run "fdisk -l" to see which device it is attached to. Then, I found if I try different USB flash drives one by one.*The first drive is attached to sda1, the second to sdb1, the third to sdc1, the forth to sdd1,... I took out the previous one before I plug in the next one, but it seems the kernel still remembers the previous ones. I can see this from: /proc/scsi/scsi. Also, it create /proc/scsi/usb-storage-* for each USB flash drive. The only way I can delete this now is to reboot the system. If the users use all kinds of USB drives later, I will have to create a long list of devices for them.*And I don't know how long is enough. I hope there is a better way to handle this situation. The ideal result is I can use device /dev/sda1 for different USB drives.
*
Thanks a lot for your help.

wanglinux2007

michaelk 12-29-2006 09:23 AM

Make sure you unmount (umount command) the device prior to removing it from the computer. Umounting will complete any delayed disk writes and if not accomplished data might be lost as well as possibly corrupting the filesystem.


All times are GMT -5. The time now is 10:12 AM.