1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mounting USB Flash Drive

Discussion in 'Peripheral Hardware' started by kind, Jul 16, 2011.

  1. kind

    kind New Member

    Messages:
    2
    Thanks Received:
    0
    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:
    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.
     
  2. jb_fvwm2

    jb_fvwm2 Active Member

    Messages:
    1,617
    Thanks Received:
    161
    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.
     
  3. ikreos

    ikreos New Member

    Messages:
    80
    Thanks Received:
    11
    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.
     
  4. kind

    kind New Member

    Messages:
    2
    Thanks Received:
    0
    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.
     
  5. sverreh

    sverreh New Member

    Messages:
    124
    Thanks Received:
    15
    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
     
  6. wblock@

    wblock@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    11,556
    Thanks Received:
    2,223
    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:
    Code:
    # 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    "
    
     
  7. matoatlantis

    matoatlantis Member

    Messages:
    534
    Thanks Received:
    76
    You can also use fdisk to determine the disk layout:

    # fdisk /dev/da0

    or even better with gpart:

    # gpart show /dev/da0
     
  8. ikreos

    ikreos New Member

    Messages:
    80
    Thanks Received:
    11
    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.
     
  9. jwmollman

    jwmollman New Member

    Messages:
    3
    Thanks Received:
    0
    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:
    mkdir /media/flash
    mount_msdosfs /dev/da0s1 /media/flash
    


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

    SNK Member

    Messages:
    130
    Thanks Received:
    32