LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   USB 2.0 Flash Memory Drive (https://www.linuxquestions.org/questions/linux-hardware-18/usb-2-0-flash-memory-drive-61908/)

Malakh 05-26-2003 12:15 PM

USB 2.0 Flash Memory Drive
 
Ok so I bought one of these USB Flash Memory drives the other day and I see that linux has support for these by reading some other posts but I am having a hell of a time with it. I am not able to even get it to work on my Windows side of my machine.

If I try to mount it , it tells me it has no File system which is correct. So can anyone tell me how I can partition and format this thing?

lado 05-26-2003 01:19 PM

When you plug it in what are the contents of your fstab?

Malakh 05-26-2003 03:39 PM

Well here are the contents of the fstab after I plug it it but it did not change.

Code:


[malakh@localhost Documents]$ cat /etc/fstab
/dev/hdd1 / ext2 defaults 1 1
none /dev/pts devpts mode=0620 0 0
/dev/hdd6 /home ext2 defaults 1 2
none /mnt/cdrom supermount dev=/dev/hdc,fs=auto,ro,--,iocharset=iso8859-1,codepage=850,umask=0 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=auto,--,iocharset=iso8859-1,sync,codepage=850,umask=0 0 0
/dev/hda1 /mnt/win_c vfat iocharset=iso8859-1,codepage=850,umask=0 0 0
/dev/hdb1 /mnt/win_c2 vfat iocharset=iso8859-1,codepage=850,umask=0 0 0
none /proc proc defaults 0 0
/dev/hda6 /tmp ext2 defaults 1 2
/dev/hdd5 /usr ext2 defaults 1 2
/dev/hda5 swap swap defaults 0 0


mike9010 05-26-2003 04:50 PM

The /etc/fstab contents after plugging it in really doesn't mean much.

What I suggest is getting it to work on the windows side of you machine first, as you said it wouldn't. Usually, things are much easier to set up in windows than they are in Linux. Since Windows seems to be the x86 epitomy of compatibility, I would be surprised if it didn't work in windows, but did in Linux. Try getting it to work in Windows, and make sure you read all of your documentation.

But, if you do want to try formatting it in Linux, the command to create a ext2 fs is the following:
# mke2fs /dev/device

I am not sure how to format for vfat

If you think you need to partition, try
# cfdisk /dev/device

Malakh 05-26-2003 10:09 PM

uhg
 
well getting closer I think. I have tried to get it to work in windows98 but it does not want to work. Well I should say i got the drivers for windows installed but can't figure out how to access it in win98. It came with no documentation or anything just a diskette with the inf files and the unit. not even a manufacturers name. I had to get that from linux as you will se bellow.

here is my attept at your advice. I show fdisk in this because cfdisk noes not echo to the console.

Code:


[root@localhost malakh]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: Prolific Model: USB Flash Disk  Rev: PROL
  Type:  Direct-Access                    ANSI SCSI revision: 02

[root@localhost malakh]# fdisk /dev/sda
Unable to read /dev/sda

[root@localhost malakh]# cd /sbin
[root@localhost sbin]# mke2fs /dev/sda
mke2fs 1.32 (09-Nov-2002)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
64000 inodes, 256000 blocks
12800 blocks (5.00%) reserved for the super user
First data block=1
32 block groups
8192 blocks per group, 8192 fragments per group
2000 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185

Warning: could not read block 0: Attempt to read block from
filesystem resulted in short read
Writing inode tables: done
ext2fs_mkdir: Attempt to read block from filesystem resulted in
short read while creating root dir

added /proc/scsi/scsi in there so you can see how linux sees the device.

neither cfdisk or fdisk with read it as a disk. If anyone has any ideas could use them. Otherwise I am taking this thing back.

michaelk 05-26-2003 11:29 PM

It just might be bad. It doesn't sound good if you get a can't read device message. Does the device say it supports linux? I have MDK 9.0 and it auto detected my pen drive and even added an entry to /etc/fstab.

Mine has a write protect switch but that probably isn't the problem. I would say that unless the memory was bad it should be already formated as vfat. (mine was)

With Win98 you should of gotten a detected new device and load driver etc windows. To manually install driver you can right click on the inf file and select install. You probably need to reboot windows. When you popup an explorer box you should see a new letter for the drive.

Just as a precaution:
Also look in the control panel under system and device manager. Make sure there are not any warning flags for your USB hub and that all of them are detected and windows says that they are working properly.

Electro 05-27-2003 12:36 AM

To autodectect USB devices. You need to have hotplug. Its a bash script that searches for additional devices during boot up or after boot up and sets up the device. I think you can find hotplug at sourceforge.

You need to mount the device before you use it.

I think to format FAT use mkfs -f vfat device

Malakh 05-27-2003 09:05 AM

I can't mount it as you will see in my console log below. Nor can I mkfs.

In windows it was seen by the system I got the drivers in and I know all about device manager. I had errors with the drivers at first but after finding Prolific's website I was able to get the newest drivers to work and no !'s in device manager but I can't do anything with it cause I have no way of getting to the device in windows. as in there is no icon in My Computer etc, but this is not a place for windows stuff nor do I expect help on the windows side.

I am leaning to the idea that the unit might be bad.

anyway here is the console log

Code:

[root@localhost sbin]# mkfs.vfat /dev/sda
mkfs.vfat 2.8 (28 Feb 2001)
mkfs.vfat: Will not try to make filesystem on '/dev/sda'
[root@localhost sbin]# mkfs -f vfat /dev/sda
mke2fs 1.32 (09-Nov-2002)
mkfs.ext2: bad fragment size - vfat
[root@localhost sbin]# mount /dev/sda
/dev/sda: Input/output error
mount: you must specify the filesystem type
[root@localhost sbin]# mount -t ext2 /dev/sda
Usage: mount -V                : print version
      mount -h                : print this help
      mount                    : list mounted filesystems
      mount -l                : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
      mount -a [-t|-O] ...    : mount all stuff from /etc/fstab
      mount device            : mount device at the known place
      mount directory          : mount known device here
      mount -t type dev dir    : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
      mount --bind olddir newdir
or move a subtree:
      mount --move olddir newdir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using  -L label  or by uuid, using  -U uuid .
Other options: [-nfFrsvw] [-o options] [-p num].
For many more details, say  man 8 mount .
[root@localhost sbin]# mount -t vfat /dev/sda
Usage: mount -V                : print version
      mount -h                : print this help
      mount                    : list mounted filesystems
      mount -l                : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
      mount -a [-t|-O] ...    : mount all stuff from /etc/fstab
      mount device            : mount device at the known place
      mount directory          : mount known device here
      mount -t type dev dir    : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
      mount --bind olddir newdir
or move a subtree:
      mount --move olddir newdir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using  -L label  or by uuid, using  -U uuid .
Other options: [-nfFrsvw] [-o options] [-p num].
For many more details, say  man 8 mount .
[root@localhost sbin]#


jim006 06-19-2003 08:42 PM

Re: USB 2.0 Flash Memory Drive
 
I'm having a similar problem with a compact flash USB reader... but I don't think it's a problem with the hardware and here's why:

If I mkfs.ext2 with the default parameters I can't mount the block device (/dev/sda1 on my computer). However, the device passes block checks and can be analyzed using dump2efs.

After extensive head-banging, I got the device to work if I created it with 700 INODES or less (mkfs.exts -N700 /dev/sda1).

I was pretty happy until I realized that 1 INODE is used for each file... limiting me to just under 700 files on the CF card.

This is a 16MB CF card that I want to put a small embedded linux image on.

I'm open to suggestions... also if anyone can explain why this INODE problem is occuring, I'm all ears.

Later!

Jim

Quote:

Originally posted by Malakh
Ok so I bought one of these USB Flash Memory drives the other day and I see that linux has support for these by reading some other posts but I am having a hell of a time with it. I am not able to even get it to work on my Windows side of my machine.

If I try to mount it , it tells me it has no File system which is correct. So can anyone tell me how I can partition and format this thing?


hbarbosa 11-03-2003 02:04 PM

Malakh,

I hope you have solved this problem by now... but if you haven't
maybe you want to try device /dev/sda1 instead of /dev/sda

It seems to me your problem if because you were trying to mount
the disk (sda), instead of the partion (sda1).

cheers,

hbarbosa

Malakh 11-03-2003 03:51 PM

Actually I have not solved yet but I have not tried to in a while. I now know that the hardware is not faulty as it works fine in win2k or higher it just does not work in 98. I'll have to go and experiment with fstab again and try the sda1 thing. Or possibly check out that hotplug deal.

Genesee 11-03-2003 04:56 PM

did you try something like

#mount -t vfat /dev/sda1 /mnt/directoryname

make sure directoryname exists already

hbarbosa 11-03-2003 04:57 PM

malakh,

dummy question: have you took a look at the manufacture website?

I have a pendrive from SanDisk and it does not work with win98
unless you download a special driver from their webpage. It
works fine in winxp, without any changes to the system, and
probably also on win2000 and NT, as they are basically the
same.

Maybe you have the same problem.

cheers,

hbarbosa

Malakh 11-04-2003 12:44 AM

Yes, anyway I don't use win98 anymore so that part is not important.

I have mdk 9.1 and it seems i needed to run ldmod usb-storage and hotplug usb first.

I now have sda1-4 but I get the same results when i try to mount sda1 2 3 or 4 whch is that it tells me that it is the wrong partition type, superblock, etc.

I know it has a partition and is formated. I never had to format it so i assume it is vfat but I am not sure how to find out for sure. I tried to mount as vfat, ntfs, ext3, ext2 and none work.

I know I am close but still missing something.

hoopyfrood 11-04-2003 02:31 AM

I'm having the exact same problem with a CF card reader.

cdrecord -scanbus shows the device correctly, dmesg indicates no problems with the reader device having plugged it in, sg_map is the same. And yet attempting to mount it via "mount -t vfat /dev/sda /mnt/flash" yeilds the error: "mount: wrong fs type, bad option, bad superblock on /dev/sda, or too many mounted file systems". Trying to mnt sda1 (or 2,3,4,5,6,7, etc) results in "device does not exist."

Funny thing is that if I take the CF card out of the reader and attempt to mount it, I get "No medium found." When I run fdisk -s I get told "62592" (the CF card is 64mb.) In otherwords, Linux can detect if there's a CF card inserted, and it can proble the size of it. But it wont read it.

I've tried reformatting the card as vfat and ext2 (I have a Linux PDA with a CF card drive and have reformatted it this way -- fdisk will not allow me to format the card through Linux) and this has not worked. It occured to me that the problem might be that you need to create a file system on the CF card to have it work (Ie a MBR and /, etc). I just tried running "mkfs" on the device (as per jim006's suggestion) but was told:

Code:

#mkfs /dev/sda
mke2fs 1.32 (09-Nov-2002)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
15680 inodes, 62592 blocks
3129 blocks (5.00%) reserved for the super user
First data block=1
8 block groups
8192 blocks per group, 8192 fragments per group
1960 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345

Warning: could not read block 0: Attempt to read block from filesystem resulted in short read
Writing inode tables: done
ext2fs_mkdir: Attempt to read block from filesystem resulted in short read while creating root dir

Running mkfs -f vfat /dev/sda yeilds: "mkfs.ext2: bad fragment size - vfat"

This is a Belkin CF card reader which I've checked out and understand to be compatible with Linux. It works fine through Win98, and as far as I can tell the CF card is in working order (I use it for extra memory on my Zaurus.) I would really, really love to find a fix since Sharp cheated us Zaurus users out of a sync function with the Linux desktop (unless you use OpenZaurus/Opie) and I need to use the CF card reader to port files to and from my PDA!

I'm running Mandrake Linux 9.1, default kernel for that distro (ie, 2.4.21-0.13mdk).

Cheers,
Tim


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