Can't mount NTFS USB stick

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.
 
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.
 
lme@ said:
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.

ls -l /dev/da* only show da0 and da0a.
 
lme@ said:
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.

I'll try the command # : > /dev/da0, but what does that command actually do?
 
xiaweitang said:
I'll try the command # : > /dev/da0, but what does that command actually do?

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.
 
The command opens the da0 device for writing and sometimes finds its partitions.
Too bad it didn't work for you.
 
lme@ said:
The command opens the da0 device for writing and sometimes finds its partitions.
Too bad it didn't work for you.

So should I reformat my drive using the fdisk under freeBSD? And will that make sure it will be recognized?
 
Yeah, that would be worth a try. fdisk and then newfs_msdos.
 
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.
 
fbsd1 said:
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.

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.
 
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!
 
fbsd1 said:
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.

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
[cmd=]mount_msdosfs /dev/da0a /mnt/usb[/CMD]
give the error
Code:
invalid argument

I know [cmd=]dd if=/dev/zero of=/dev/da0 count=1[/cmd] 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
 
pigling said:
Code:
mount_msdosfs /dev/da0a /mnt/usb
give the error "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?
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*
 
pigling said:
I know [cmd=]dd if=/dev/zero of=/dev/da0 count=1[/cmd] is to clear up the disk.

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.)
 
wblock said:
To easily edit a partition table, I recommend Linux's cfdisk. I only wish we had something like it for FreeBSD.
Anything wrong with fdisk's -u option? It lets you change every single field in there. I have never needed anything else.
 
Beastie said:
Anything wrong with fdisk's -u option? It lets you change every single field in there. I have never needed anything else.

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.
 
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 [FILE]sysutils/fusefs-ntfs[/FILE]
     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).
 
Back
Top