# Can't mount usb stick on FreeBSD



## zuttel (Aug 15, 2010)

Hi,

I'm trying to mount a usb-hd on FreeBSD 8.0, but it doesn't work.


```
uname -a
FreeBSD Tecra 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:48:17 UTC 2009     [email]root@almeida.cse.buffalo.edu[/email]:/usr/obj/usr/src/sys/GENERIC  i386
Tecra#
```

dmesg


```
ugen3.2: <vendor 0x04b4> at usbus3
umass0: <vendor 0x04b4 product 0x6830, class 0/0, rev 2.00/0.01, addr 2> on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0x4100
umass0:0:0:-1: Attached to scbus0
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <WDC WD12 00BEVE-00WZT0 0000> Fixed Direct Access SCSI-0 device
da0: 40.000MB/s transfers
da0: 114473MB (234441648 512 byte sectors: 255H 63S/T 14593C)
Tecra#
```


```
Tecra# cd /dev/
Tecra# ls
acd0            audit           da0s3           kbdmux0         pts             ttyv4           ugen0.1
acd0t01         bpf             dcons           klog            random          ttyv5           ugen0.2
acpi            bpf0            devctl          kmem            stderr          ttyv6           ugen1.1
ad0             bpsm0           devstat         log             stdin           ttyv7           ugen2.1
ad0s1           console         dgdb            mdctl           stdout          ttyv8           ugen3.1
ad0s1a          consolectl      dri             mem             sysmouse        ttyv9           ugen3.2
ad0s1b          ctty            fd              nfslock         ttyu0           ttyva           ums0
ad0s1d          cuau0           fido            null            ttyu0.init      ttyvb           urandom
ad0s1e          cuau0.init      geom.ctl        pass0           ttyu0.lock      ttyvc           usb
ad0s1f          cuau0.lock      io              pccard0.cis     ttyv0           ttyvd           usbctl
agpgart         da0             iso9660         pci             ttyv1           ttyve           xpt0
ata             da0s1           kbd0            psm0            ttyv2           ttyvf           zero
atkbd0          da0s2           kbd1            ptmx            ttyv3           ufsid
Tecra#
```

If I put the usb-hd on my win-xp device I can see 5 partitions on it. So I think it should ad0s1a-f.

If try to mount it, I get the message below:


```
Tecra# mount -t msdosfs /dev/da0s1 /media/
Tecra# cd /media/
Tecra# ls
Recycled                        System Volume Information
```

There is no data in it.


```
Tecra# mount -t msdosfs /dev/ad0s1a /media/
mount_msdosfs: /dev/ad0s1a: Operation not permitted
Tecra#
```

Another try:


```
Tecra# mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /media/
mount_msdosfs: /dev/da0s1: Operation not permitted
Tecra#
```

I have found some threats in the forum, but that didnÂ´t help.

Any hints ?

Regards,

zuttel


----------



## jb_fvwm2 (Aug 15, 2010)

Unsure if you unmounted it (your first "ls")
before mounting again the other way?  and
is it fat32, or ntfs, or... each
partition?


----------



## wblock@ (Aug 15, 2010)

DD will be along shortly to nicely ask you to use appropriate formatting, so I'll skip it.  That does make it easier for people to respond to your questions, though.



			
				zuttel said:
			
		

> ```
> ugen3.2: <vendor 0x04b4> at usbus3
> umass0: <vendor 0x04b4 product 0x6830, class 0/0, rev 2.00/0.01, addr 2> on usbus3
> umass0:  SCSI over Bulk-Only; quirks = 0x4100
> ...



That's fine, it's da0.


```
Tecra# cd /dev/
Tecra# ls
```

Don't do that, it produces way more output than you need.
`# ls /dev/da0*`

Your output shows da0, da0s1, da0s2, and da0s3.  These correspond to three MS-DOS partitions.



> If try to mount it, I get the message below:
> 
> ```
> Tecra# mount -t msdosfs /dev/da0s1 /media/
> ...



Well, no data other than the default Windows stuff.  So it's already been formatted by Windows, and works.



> ```
> Tecra# mount -t msdosfs /dev/ad0s1a /media/
> mount_msdosfs: /dev/ad0s1a: Operation not permitted
> Tecra#
> ```



ad0 is probably your FreeBSD drive.  da0 is the USB drive.



> Another try:
> 
> ```
> Tecra# mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /media/
> ...



Were you logged in as root at the time?


----------



## gcooper@ (Aug 16, 2010)

I'm guessing based purely on your shell prompt (which could be entirely wrong, but..), you were operating as root. One thing that I'm curious about (with jb_fvwm2) as well that you haven't identified is whether or not you're trying (by accident) to mount an NTFS based partition.

truss output of the mount command where it fails would be most helpful in trying to diagnose this.

FWIW, I have also see it return "Operation not permitted" (EPERM) when the filesystem is incorrect, despite what the mount(2) manpage says:


```
[EPERM]            The caller is neither the super-user nor the owner of
                        dir.
```


----------



## jem (Aug 16, 2010)

Paste the output from:
`# gpart show da0`
It should show exactly what partitions there are and their types.


If you can see 5 partitions in Windows, then you'll possibly have a mix of Primary and Logical MBR partitions.  These will show as slices in FreeBSD, so da0s[1-5] perhaps.  You won't see da0s1[a-f] as this refers to BSD partitions.

Alternatively, if your USB stick has been converted to a Dynamic Disk in Windows (if Windows allows that), then one big partition spanning the entire disk may show up, which has been subdivided into Logical Disk Manager volumes by Windows (see this for details).  BSD probably won't have visibility of these and won't be able to mount them due to the proprietary nature of LDM.

By the way, I didn't think Windows handled partitioned USB sticks properly.  It was my understanding that only the first partition would show up.  For best compatibility with many OS's, USB sticks are probably best set up with a single MBR partition formatted as FAT32.


----------



## SirDice (Aug 16, 2010)

zuttel said:
			
		

> If try to mount it, I get the message below:
> 
> 
> ```
> ...


Yes, there is. It mounted fine and it's showing the directories Recycled and System Volume Information with are both quintessential Windows folders.


----------



## zuttel (Aug 16, 2010)

Yes, the hd is formatted via NTFS. I mixed it up. But 1x partition is formatted with FAT32.


```
Tecra# gpart show da0
=>       63  234441585  da0  MBR  (112G)
         63    2040192    1  !6  (996M)
    2040255    2040255    2  !6  (996M)
    4080510  230356035    3  !15  (110G)
  234436545       5103       - free -  (2.5M)
```

I have tried to mount via


```
Tecra# mount_ntfs /dev/da0s2 /mnt/
mount_ntfs: /dev/da0s2: Operation not permitted
```


```
Tecra# mount_ntfs /dev/ad0s1b /mnt/
mount_ntfs: /dev/ad0s1b: Operation not permitted
```

Regards,

Alexander


----------



## wblock@ (Aug 16, 2010)

file(1) can help identify filesystems:

`# file -s /dev/da0s1`
`# file -s /dev/da0s2`
`# file -s /dev/da0s3`


----------

