# Can't mount usb flash drive



## pigritia (Nov 21, 2008)

Hi all,

I'm having problems to mount my usb flash drive. I have read several man pages (FreeBSD handbook among them...) and I'm wondering in how to mount it!

When I plug it, I see an output like this from dmesg:

```
umass1: <vendor 0x10d6 USB 2.0(HS) Flash Disk, class 0/0, rev 2.00/1.00, addr 3> on uhub4
da4 at umass-sim1 bus 1 target 0 lun 0
da4: <USB 2.0 (HS) Flash Disk 1.00> Removable Direct Access SCSI-0 device
da4: 40.000MB/s transfers
da4: 973MB (1993649 512 byte sectors: 64H 32S/T 973C)
```

Apparently, the usb flash drive is mapped to device da4. However,  when I try to mount it, I have a message saying that the device was not found...

Does anyone know what's the problem?

Thanks in advance,
pigritia.


----------



## anomie (Nov 21, 2008)

How are you trying to mount it? 


```
# mount_msdosfs /dev/da4s1 /mnt/somewhere
```

... should do the trick. 

Read here (again?): http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/usb-disks.html


----------



## gelraen (Nov 22, 2008)

Device da4 itself starts with MBR, which contains partition table and cannot be mounted directly. Instead of this, kernel reads partition table and creates devices da4sX for found slices. And that slices contains some FS (except Extended partition), which can be mounted somewhere.


----------



## Mel_Flynn (Nov 22, 2008)

pigritia said:
			
		

> Apparently, the usb flash drive is mapped to device da4. However,  when I try to mount it, I have a message saying that the device was not found...



If the device was not found, you're in a jail and da* is hidden, or you modified devfs rules, to hide da*.
Otherwise, please post the *exact* error message.


----------



## pigritia (Nov 22, 2008)

&quot said:
			
		

> How are you trying to mount it?


I'm trying this:

```
mount_msdosfs /dev/da4 /mnt
```
and this:

```
mount_msdosfs /dev/da4s1 /mnt
```
But, both doesn't work.


			
				&quot said:
			
		

> If the device was not found, you're in a jail and da* is hidden, or you modified devfs rules, to hide da*.
> Otherwise, please post the exact error message.


I didn't modify my /etc/devfs.rules.

When I try to mount the usb flash drive I get this message:

```
mount: /dev/da4: File or directory not found.
```

I verified if the device was created when connected to the system:

```
ls /dev/da*
/dev/da0
/dev/da1
/dev/da2
/dev/da3
```
... da4 is not being created.

By the way, my FreeBSD version is 7.0. And I'm using a GENERIC kernel.

pigritia.


----------



## jb_fvwm2 (Nov 22, 2008)

camcontrol rescan all
mount_msdosfs /dev/da4s1 /mnt
mount_msdosfs /dev/da4  /mnt
mount_msdosfs /dev/da4s1 /mnt
...............
chances are more than slight that
those four would give results (even
as the 1st 2 of 3 mount commands
give errors).


----------



## Mel_Flynn (Nov 23, 2008)

Do you get any reset errors or timeouts for umass0 or da4? The device should be created, if it's not, it's a bug.


----------



## pigritia (Nov 24, 2008)

&quot said:
			
		

> camcontrol rescan all
> mount_msdosfs /dev/da4s1 /mnt
> mount_msdosfs /dev/da4 /mnt
> mount_msdosfs /dev/da4s1 /mnt
> ...


Doesn't work. My system hang out after showing a message saying that umass0 rescan was successful (either with a -t option).



			
				&quot said:
			
		

> Do you get any reset errors or timeouts for umass0 or da4? The device should be created, if it's not, it's a bug.


Yes, after a camcontrol rescan...

pigritia.


----------



## Mel_Flynn (Nov 24, 2008)

If you're willing to do debugging, you should file a PR (see send-pr(1)).

Otherwise, please attach dmesg and which controller the flash card is connected to. If it's an ehci controller, try to disable USB-1 support in the bios.


----------



## jb_fvwm2 (Nov 24, 2008)

are you sure the system became unresponsive?  if your
prompt is not showing after the error messages, it
is probably there but invisible.


----------



## pigritia (Nov 25, 2008)

&quot said:
			
		

> Otherwise, please attach dmesg and which controller the flash card is connected to.



Here is the output from *camcontrol devlist*:

```
<Generic USB SD Reader 1.00>       at scbus0 target 0 lun 0 (da0,pass0)
<Generic USB CF Reader 1.01>       at scbus0 target 0 lun 1 (da1,pass1)
<Generic USB SM Reader 1.02>       at scbus0 target 0 lun 2 (da2,pass2)
<Generic USB MS Reader 1.03>       at scbus0 target 0 lun 3 (da3,pass3)
<USB 2.0 (HS) Flash Disk 1.00>     at scbus1 target 0 lun 0 (pass4,da4)
```
Note that *(pass4,da4)* differs from the others (i.e. it is swapped out). Is this correct?

Output from *dmesg* (only USB stuff):

```
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <Generic USB SD Reader 1.00> Removable Direct Access SCSI-0 device
da0: 40.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
da1 at umass-sim0 bus 0 target 0 lun 1
da1: <Generic USB CF Reader 1.01> Removable Direct Access SCSI-0 device
da1: 40.000MB/s transfers
da1: Attempt to query device size failed: NOT READY, Medium not present
da2 at umass-sim0 bus 0 target 0 lun 2
da2: <Generic USB SM Reader 1.02> Removable Direct Access SCSI-0 device
da2: 40.000MB/s transfers
da2: Attempt to query device size failed: NOT READY, Medium not present
da3 at umass-sim0 bus 0 target 0 lun 3
da3: <Generic USB MS Reader 1.03> Removable Direct Access SCSI-0 device
da3: 40.000MB/s transfers
da3: Attempt to query device size failed: NOT READY, Medium not present
Trying to mount root from ufs:/dev/ad4s1a
umass1: <vendor 0x10d6 USB 2.0(HS) Flash Disk, class 0/0, rev 2.00/1.00, addr 3> on uhub4
da4 at umass-sim1 bus 1 target 0 lun 0
da4: <USB 2.0 (HS) Flash Disk 1.00> Removable Direct Access SCSI-0 device
da4: 40.000MB/s transfers
da4: 973MB (1993649 512 byte sectors: 64H 32S/T 973C)
```

Correcting my previous post... when I rescan all my USB devices I  got a message saying that *bus 0 rescan was successful* not umass0.

pigritia.


----------



## pigritia (Nov 26, 2008)

jb_fvwm2 said:
			
		

> are you sure the system became unresponsive?  if your
> prompt is not showing after the error messages, it
> is probably there but invisible.


Yes, I'm sure. Even if I log in another terminal and try to kill camcontrol...

Compile my GENERIC kernel is a must, to do this stuff working properly?

From the previous post, can a developer or FreeBSD guru tell me what is wrong?

pigritia.


----------



## anomie (Nov 27, 2008)

@pigritia: I don't want to marginalize your call for assistance, but you might also consider buying a new usb drive with better compatibility. (I have done the same from time to time when replacement hardware was inexpensive.)


----------



## pigritia (Nov 29, 2008)

@anomie: I installed FreeBSD onto another machine to test if this stuff would work fine with it... have the same results with a different usb drive.

But at this time I get some errors messages. It is as follows:

```
UMASS0: BBB reset failed, TIMEOUT
```
and

```
UMASS0: BBB bulk-in clear stall failed, TIMEOUT
```
and

```
da0: umass-sim0:0:0:0): syncrhonize cache failed, status == 0x4, scsi status == 0x0
```
Note: usb flash drive was mapped to device da0.

p.s. I also tried another *BSD flavor and I got usb stuff working properly.

pigritia.


----------



## softblur (Nov 29, 2008)

pigritia said:
			
		

> p.s. I also tried another *BSD flavor and I got usb stuff working properly.


May I ask which *BSD flavor that was?  I have a similar problem with a card reader in my HP printer.  If some other *BSD handles it better, there might be code somewhere that could be borrowed.

FWIW, I tried out the OpenSolaris live CD today, and it is able to read an SD card in that drive.  And needless to say it works on Windows...


----------



## pigritia (Nov 29, 2008)

&quot said:
			
		

> May I ask which *BSD flavor that was?


NetBSD.



			
				&quot said:
			
		

> If some other *BSD handles it better, there might be code somewhere that could be borrowed.


Of course. Maybe, I have do to that...

pigritia.


----------



## Trojan (Jun 7, 2009)

Guys, please help to clarify the issue with mounting USB flash drive. 

According to Handbook I added *usbd_enable="YES"* string in */etc/rc.conf* file. 
Also I created */mnt/flash* directory.

When I try to mount flash drive to created /mnt/flash I get the following:


```
shlus# mount -t msdosfs /dev/da0s1 /mnt/flash
mount: /dev/da0s1 : No such file or directory
```

BUT when I use *da0* as flash drive name and */mnt* as the mount point then it mounted successfully.

So the question is that why if I try *mount -t msdosfs /dev/da0s1 /mnt/flash* I haven't any luck but if I try *mount -t /dev/da0 /mnt* it mounted successfully?


----------



## gr1ml0ck (Jul 28, 2009)

Hi guys,

I had the same issue mounting a large fat32 partition shared between linux and bsd.... and also with mounting a usb flash drive from western digital.

here is what FINALY worked for me and solved my problem.

1. I created a directory for my device in /media and gave it uber permissions... all as root:


```
n00bB0x# mkdir /media/usbhd && chmod 777 /media/usbhd
```

2. Insert device and check dmesg for relevant mount info. My usb drive was found to da0s1.

3. Mount the device using the msdosfs file system and use the large option.


```
n00bB0x# mount -t msdosfs -o large /dev/da0s1 /media/usbhd
```


and that should be it. I tried most of the above to no avail on my systems.. both 7.2 and 8.0 current.. and this only worked with the above commands.

I dont know why? any feedback would be appreciated.


----------

