Mounting USB Flash Drive

Stuff that plugs in via USB, FireWire, eSATA, PS/2, etc.

Mounting USB Flash Drive

Postby kind » 16 Jul 2011, 12:08

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:
Code: Select all
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.
kind
Junior Member
 
Posts: 2
Joined: 16 Jul 2011, 12:01

Postby jb_fvwm2 » 16 Jul 2011, 12:16

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.
jb_fvwm2
Senior Member
 
Posts: 1503
Joined: 16 Nov 2008, 19:19

Postby ikreos » 16 Jul 2011, 12:18

Slices (partitions) are labeled as [FILE]/dev/<device><device_number>s<slice_number><partition_letter>[/FILE], unless it is dangerously dedicated. If you are using a flash drive most likely it will show up as [FILE]/dev/da#s#[/FILE]. You will also need to tell [MAN=8]mount[/MAN] 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 reject your reality and substitute my own!" -- Adam Savage, Mythbusters
iBlast! I use vi so much I keep wanting to enter commands when I type in a forum!<ESC>:wAGah!
Proud user of the FreeBSD Operating System. http://www.FreeBSD.org/
User avatar
ikreos
Junior Member
 
Posts: 80
Joined: 12 Mar 2011, 03:40
Location: Stuck between subatomic particles in quantum space.

Postby kind » 16 Jul 2011, 12:34

ikreos wrote:Slices (partitions) are labeled as [FILE]/dev/<device><device_number>s<slice_number><partition_letter>[/FILE], unless it is dangerously dedicated. If you are using a flash drive most likely it will show up as [FILE]/dev/da#s#[/FILE]. You will also need to tell [MAN=8]mount[/MAN] 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.
kind
Junior Member
 
Posts: 2
Joined: 16 Jul 2011, 12:01

Postby sverreh » 16 Jul 2011, 15:37

You can see your da-devices by

[CMD="#"]ls /dev/da*[/CMD]

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

[CMD="#"]mount_msdosfs /dev/da0s1 /media/usb[/CMD]

If you have set up [file]sudo[/file] correctly you can do it as an ordinary user

[CMD="%"]sudo mount_msdosfs /dev/da0s1 /media/usb[/CMD]
User avatar
sverreh
Member
 
Posts: 124
Joined: 16 Nov 2008, 20:09
Location: Norway

Postby wblock@ » 16 Jul 2011, 17:06

kind wrote: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 [file]/dev/da0s1[/file]. The [file]s1[/file] 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 [file]/dev/da0[/file].

[man=1]file[/man] can check what's on a drive. As root:
Code: Select all
# 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    "
User avatar
wblock@
Old Fart
 
Posts: 10207
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby matoatlantis » 19 Jul 2011, 20:34

You can also use [FILE]fdisk[/FILE] to determine the disk layout:

[CMD="#"]fdisk /dev/da0[/CMD]

or even better with [FILE]gpart[/FILE]:

[CMD="#"]gpart show /dev/da0[/CMD]
[color="Gray"]..when you do things right, people won't be sure you've done anything at all..[/color]
User avatar
matoatlantis
Member
 
Posts: 510
Joined: 26 Mar 2009, 21:07
Location: bratislava, slovakia

Postby ikreos » 20 Jul 2011, 22:14

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.
"I reject your reality and substitute my own!" -- Adam Savage, Mythbusters
iBlast! I use vi so much I keep wanting to enter commands when I type in a forum!<ESC>:wAGah!
Proud user of the FreeBSD Operating System. http://www.FreeBSD.org/
User avatar
ikreos
Junior Member
 
Posts: 80
Joined: 12 Mar 2011, 03:40
Location: Stuck between subatomic particles in quantum space.

Postby jwmollman » 18 Dec 2011, 23:23

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:

Code: Select all
mkdir /media/flash
mount_msdosfs /dev/da0s1 /media/flash


And now I can browse /media/flash to see the contents of my flash drive.
jwmollman
Junior Member
 
Posts: 3
Joined: 24 Jun 2011, 04:44

Postby SNK » 19 Dec 2011, 00:14

There is an interesting volume manager in the works: http://forums.freebsd.org/showthread.php?t=27233. It works quite well.
SNK
Member
 
Posts: 130
Joined: 15 May 2011, 18:34
Location: The Netherlands


Return to Peripheral Hardware

Who is online

Users browsing this forum: No registered users and 0 guests