# Mounting USB Flash Drive



## kind (Jul 16, 2011)

I'm having problems mounting my USB flash drive, as I do not know what it is called under freeBSD.

In linux, I would use the command:

```
sudo mount /dev/sdb /media/usb
```
But from the information I have found, in unix it is /dev/da0.
..I can't mount /dev/da0 though.

Could anybody give some insight?
It would be much appreciated.


----------



## jb_fvwm2 (Jul 16, 2011)

I'd see the thread (Base > Peripheral Hardware > "how to mount panasonic... ) (2009) and others found by searching for "camcontrol"; more information in that thread than if I reposted an answer here.


----------



## ikreos (Jul 16, 2011)

Slices (partitions) are labeled as /dev/<device><device_number>s<slice_number><partition_letter>, unless it is dangerously dedicated. If you are using a flash drive most likely it will show up as /dev/da#s#. You will also need to tell mount(8) what type of filesystem is on the drive if it is not UFS2.

If you are coming from Linux I suggest you thoroughly read through the handbook.


----------



## kind (Jul 16, 2011)

ikreos said:
			
		

> Slices (partitions) are labeled as /dev/<device><device_number>s<slice_number><partition_letter>, unless it is dangerously dedicated. If you are using a flash drive most likely it will show up as /dev/da#s#. You will also need to tell mount(8) what type of filesystem is on the drive if it is not UFS2.
> 
> If you are coming from Linux I suggest you thoroughly read through the handbook.



I think this is where I am getting lost.
I had seen mention of this /dev/ notation before, but was confused by how I only had a /dev/da0.
My problem, it seems, would be that it is not formatted correctly; I'll do a quick search and see if I can figure out how to do that.


----------



## sverreh (Jul 16, 2011)

You can see your da-devices by 

`# ls /dev/da*`

If you see e.g. /dev/da0s1 listed, try mounting with

`# mount_msdosfs  /dev/da0s1 /media/usb`

If you have set up sudo correctly you can do it as an ordinary user

`% sudo mount_msdosfs  /dev/da0s1 /media/usb`


----------



## wblock@ (Jul 16, 2011)

kind said:
			
		

> I had seen mention of this /dev/ notation before, but was confused by how I only had a /dev/da0.
> My problem, it seems, would be that it is not formatted correctly; I'll do a quick search and see if I can figure out how to do that.



There are two common ways for flash drives to be formatted.

1. With an MBR/partition table.  There can be up to four partitions, but usually the first takes up the whole drive.  This would show up as /dev/da0s1.  The s1 means "slice 1".  FreeBSD calls MS-DOS partitions slices.

2. Without an MBR.  These are less common, but still found.  Because there aren't any partitions (slices), it shows up as /dev/da0.

file(1) can check what's on a drive.  As root:

```
# file -s /dev/da0
/dev/da0: x86 boot sector; partition 1: ID=0xc, active, starthead 1, startsector 
63, 19631367 sectors, code offset 0x31
# file -s /dev/da0s1
/dev/da0s1: x86 boot sector, code offset 0x58, OEM-ID "BSD4.4  ", sectors/cluste
r 64, heads 255, sectors 19631367 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 
2396, Backup boot sector 2, serial number 0xc4f21bf7, label: "NO_NAME    "
```


----------



## _martin (Jul 19, 2011)

You can also use fdisk to determine the disk layout: 

`# fdisk /dev/da0`

or even better with gpart:

`# gpart show /dev/da0`


----------



## ikreos (Jul 20, 2011)

One thing I just encountered today. If you don't have support for the target filesystem compiled into your kernel. You must load the appropriate kernel module for the filesystem. Otherwise mount will fail to mount the device.


----------



## jwmollman (Dec 18, 2011)

I'm sorry to revive this old thread, but I'd like to mention a method that worked for me when searching for how to mount a flash drive on a new FreeBSD install. This is what I did:


```
mkdir /media/flash
mount_msdosfs /dev/da0s1 /media/flash
```

And now I can browse /media/flash to see the contents of my flash drive.


----------



## SNK (Dec 19, 2011)

There is an interesting volume manager in the works: http://forums.freebsd.org/showthread.php?t=27233. It works quite well.


----------



## freq (Aug 17, 2019)

Chapter 3. FreeBSD Basics
					

Basic commands and functionality of the FreeBSD operating system




					www.freebsd.org
				




It makes sense and is familiar to me.


----------

