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

Can't mount NTFS USB stick

Discussion in 'Peripheral Hardware' started by xiaweitang, Feb 23, 2010.

  1. xiaweitang

    xiaweitang New Member

    Messages:
    7
    Thanks Received:
    0
    I have a 16GB usb stick formated to one partition with NTFS. After I plug it in, dmesg shows fine but with one problem:
    Code:
    GEOM: media size does not match label

    The /dev folder contains da0 and da0a, and all the following commands
    Code:
    mount_ntfs /dev/da0 /mnt
    mount -t ntfs-3g /dev/da0 /mnt
    
    mount_ntfs /dev/da0a /mnt
    mount -t ntfs-3g /dev/da0a /mnt


    give the error "invalid argument"

    I also have a smartphone with usb port, the card in the phone is formated FAT, and the command
    Code:
    mount_msdosfs /dev/da0 /mnt

    works just fine.

    So I guess the problematic part is this
    Code:
    GEOM: media size does not match label

    I googled and find little information about that error message. I don't want to reformat the drive to FAT, because I need to store files over 4G in size.
     
  2. lme@

    lme@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    628
    Thanks Received:
    204
    I guess that you need to mount the right device.
    Do a # ls -l /dev/da* and see what's there.
    If there's a /dev/da0s1 try to mount this.
    If not, you can try to run # : > /dev/da0. Don't worry, it won't delete your USB stick, it just opens it for writing and sometimes its actual slices are recognized and added then.
     
    tom-pele thanks for this.
  3. xiaweitang

    xiaweitang New Member

    Messages:
    7
    Thanks Received:
    0
    ls -l /dev/da* only show da0 and da0a.
     
  4. xiaweitang

    xiaweitang New Member

    Messages:
    7
    Thanks Received:
    0
    I'll try the command # : > /dev/da0, but what does that command actually do?
     
  5. xiaweitang

    xiaweitang New Member

    Messages:
    7
    Thanks Received:
    0
    I tried that command, but still get the same error message, and dmesg show one more line of
    Code:
    GEOM: da0: media size does not match label.
     
  6. lme@

    lme@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    628
    Thanks Received:
    204
    The command opens the da0 device for writing and sometimes finds its partitions.
    Too bad it didn't work for you.
     
  7. xiaweitang

    xiaweitang New Member

    Messages:
    7
    Thanks Received:
    0
    So should I reformat my drive using the fdisk under freeBSD? And will that make sure it will be recognized?
     
  8. lme@

    lme@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    628
    Thanks Received:
    204
    Yeah, that would be worth a try. fdisk and then newfs_msdos.
     
  9. fbsd1

    fbsd1 New Member

    Messages:
    213
    Thanks Received:
    47
    When you plug in your USB stick to a all ready running FBSD system the root console will display a bunch of messages about your USB stick including the device name. With no other USB devices plugged in it will be auto assigned /dev/da0.

    Now the real question is how do you know this 16GB USB stick was formatted for NT file system? The manufacture sells them with ms/dos fat32 on them.

    To clean up things
    plug it into FBSD issue this command to zero out the MBR
    dd if=/dev/zero of=/dev/da0 count=1
    Then plug it into ms/xp open windows/explorer and try to open that drive. you will get box popup saying do you want to format this disk? answer yes. Now your USB stick is ms/dos fat32. go back to FBSD and mount_msdosfs /dev/da0 /mnt should work this time.
     
    pigling thanks for this.
  10. xiaweitang

    xiaweitang New Member

    Messages:
    7
    Thanks Received:
    0
    I know it's NTFS because I formatted it that way using gparted under ubuntu. The reason I want NTFS rather than FAT32 is because I need to put a file larger than 4GB in it.
     
  11. fabiokaminski

    fabiokaminski New Member

    Messages:
    7
    Thanks Received:
    0
    i went to the same problem... note that i created the w95 lba partition on linux and created msdos fs with mkfs.vfat...

    got the same issues, with freebsd not recognizing the partition just (da0a) ...
    then looking into the kernel modules.. i've tried:

    Code:
    kldload geom_mbr


    and everything works fine..

    hope it help others,

    cheers!
     
  12. sk8harddiefast

    sk8harddiefast Active Member

    Messages:
    2,024
    Thanks Received:
    158
    You should have something like /dev/da0s1 and mount it like this:
    Code:
    mount_msdosfs /dev/da0s1 /mnt/your folder
     
  13. pigling

    pigling New Member

    Messages:
    18
    Thanks Received:
    0
    This works for me. I use "sysintall" to partition and label the USB device. However, when attach/detach after writing change to disk it always prompts
    Code:
    GEOM: media size does not match label


    Then after attaching, run
    mount_msdosfs /dev/da0a /mnt/usb
    give the error
    Code:
    invalid argument


    I know dd if=/dev/zero of=/dev/da0 count=1 is to clear up the disk. But why does FreeBSD detect da0 but not da0a in /dev after formatting in winXP? Can someone give a suggestion? Thanks.

    regards,
    qichao
     
  14. Beastie

    Beastie Active Member

    Messages:
    1,925
    Thanks Received:
    339
    a is a BSD (UFS) partition label. FAT and UFS are two different filesystems.
    Depending on the way the drive was partitioned by Windows, replace da0a by da0s1 or simply by da0.
    When in doubt always do a % ls /dev/da*
     
  15. wblock@

    wblock@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    11,500
    Thanks Received:
    2,211
    More precisely, it's to clear the first block, where the MBR and partition table are stored. And that's probably where the problem is, because you aren't seeing da0s1. I think Windows will create a partition table on memory sticks by default, but don't know for sure and can't work up the enthusiasm to test it.

    To easily edit a partition table, I recommend Linux's cfdisk. I only wish we had something like it for FreeBSD. (sade(8) has problems like delayed commit and happily changing your /etc/fstab when it should not. And the user interface could be better.)
     
  16. Beastie

    Beastie Active Member

    Messages:
    1,925
    Thanks Received:
    339
    Anything wrong with fdisk's -u option? It lets you change every single field in there. I have never needed anything else.
     
  17. wblock@

    wblock@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    11,500
    Thanks Received:
    2,211
    It's... I don't know the right way to describe it. The question/answer interactive thing is like a phone menu system. Maybe it's great if you use it often.

    To me, the visual nature of cfdisk is easier to use.
     
  18. peetaur

    peetaur New Member

    Messages:
    167
    Thanks Received:
    14
    Problem and Solution

    My disk was also formatted (a year ago) using mkfs.ntfs on Ubuntu Linux. I had the same problem with the "Invalid argument" error message. Also in dmesg, you see some errors such as:

    Code:
    g_vfs_done():ntfs/disklabelgoeshere[READ(offset=0, length=1024)]error = 22
    g_vfs_done():da29s1[READ(offset=0, length=1024)]error = 22


    The problem was that I didn't realize the command I was using (mount -t ... or mount_ntfs) were not the fuse package I installed a month ago.

    To realize this, I saw in the man page:

    Code:
    CAVEATS
         This utility is primarily used for read access to an NTFS volume.  See
         the WRITING section for details about writing to an NTFS volume.
    
         For a full read-write NTFS support consider sysutils/fusefs-ntfs
         port/package.
    


    So the solution was to simply use the fuse command instead:
    # ntfs-3g /dev/ntfs/disklabelgoeshere /mnt/mountpoint

    And now it works... but seems to read from the disk while writing, halving the write performance (12.5 MB/s over USB 2.0).