Can't mount NTFS USB stick

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

Can't mount NTFS USB stick

Postby xiaweitang » 23 Feb 2010, 06:37

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: Select all
GEOM: media size does not match label

The /dev folder contains da0 and da0a, and all the following commands
Code: Select all
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: Select all
mount_msdosfs /dev/da0 /mnt

works just fine.

So I guess the problematic part is this
Code: Select all
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.
xiaweitang
Junior Member
 
Posts: 7
Joined: 23 Feb 2010, 06:27

Postby lme@ » 23 Feb 2010, 07:33

I guess that you need to mount the right device.
Do a [CMD="#"]ls -l /dev/da*[/CMD] and see what's there.
If there's a [FILE]/dev/da0s1[/FILE] try to mount this.
If not, you can try to run [cmd="#"]: > /dev/da0[/cmd]. 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.
User avatar
lme@
 
Posts: 611
Joined: 08 Oct 2007, 19:42
Location: Düsseldorf, Germany

Postby xiaweitang » 23 Feb 2010, 20:56

lme@ wrote:I guess that you need to mount the right device.
Do a [CMD="#"]ls -l /dev/da*[/CMD] and see what's there.
If there's a [FILE]/dev/da0s1[/FILE] try to mount this.
If not, you can try to run [cmd="#"]: > /dev/da0[/cmd]. 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.
xiaweitang
Junior Member
 
Posts: 7
Joined: 23 Feb 2010, 06:27

Postby xiaweitang » 23 Feb 2010, 20:58

lme@ wrote:I guess that you need to mount the right device.
Do a [CMD="#"]ls -l /dev/da*[/CMD] and see what's there.
If there's a [FILE]/dev/da0s1[/FILE] try to mount this.
If not, you can try to run [cmd="#"]: > /dev/da0[/cmd]. 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 [cmd="#"]: > /dev/da0[/cmd], but what does that command actually do?
xiaweitang
Junior Member
 
Posts: 7
Joined: 23 Feb 2010, 06:27

Postby xiaweitang » 24 Feb 2010, 00:15

xiaweitang wrote:I'll try the command [cmd="#"]: > /dev/da0[/cmd], 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: Select all
GEOM: da0: media size does not match label.
xiaweitang
Junior Member
 
Posts: 7
Joined: 23 Feb 2010, 06:27

Postby lme@ » 24 Feb 2010, 10:26

The command opens the da0 device for writing and sometimes finds its partitions.
Too bad it didn't work for you.
User avatar
lme@
 
Posts: 611
Joined: 08 Oct 2007, 19:42
Location: Düsseldorf, Germany

Postby xiaweitang » 24 Feb 2010, 16:40

lme@ wrote: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?
xiaweitang
Junior Member
 
Posts: 7
Joined: 23 Feb 2010, 06:27

Postby lme@ » 25 Feb 2010, 09:46

Yeah, that would be worth a try. fdisk and then newfs_msdos.
User avatar
lme@
 
Posts: 611
Joined: 08 Oct 2007, 19:42
Location: Düsseldorf, Germany

Postby fbsd1 » 01 Mar 2010, 10:45

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
[CMD=" "]dd if=/dev/zero of=/dev/da0 count=1[/CMD]
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 [CMD=" "]mount_msdosfs /dev/da0 /mnt[/CMD] should work this time.
FreeBSD Install Guide www.a1poweruser.com
fbsd1
Member
 
Posts: 213
Joined: 26 Feb 2010, 09:43
Location: Angeles City, Philippines

Postby xiaweitang » 02 Mar 2010, 21:59

fbsd1 wrote: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
[CMD=" "]dd if=/dev/zero of=/dev/da0 count=1[/CMD]
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 [CMD=" "]mount_msdosfs /dev/da0 /mnt[/CMD] 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.
xiaweitang
Junior Member
 
Posts: 7
Joined: 23 Feb 2010, 06:27

Postby fabiokaminski » 09 Jul 2010, 03:40

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: Select all
kldload geom_mbr


and everything works fine..

hope it help others,

cheers!
fabiokaminski
Junior Member
 
Posts: 7
Joined: 08 Jul 2010, 04:06

Postby sk8harddiefast » 09 Jul 2010, 04:06

You should have something like /dev/da0s1 and mount it like this:
Code: Select all
mount_msdosfs /dev/da0s1 /mnt/your folder
====================================
| -------> [color="Blue"]UNIX[/color]. Live Free Or Die! <-------- |
====================================
[color="RoyalBlue"]You can say:[/color] I can't do something because is difficult.
[color="RoyalBlue"]You must say:[/color] I tried a lot before say that I can't.
Never Give up.
[color="Green"]http://unixsystems.dyndns.org/[/color]
[color="Sienna"]I am not an BSD expert. But I really want to help.
Don't afraid to ask me anything. If I can I will help!
[/color]
Nice wallpapers to make your desktop more hardcore :) ---> [color="DarkOliveGreen"]http://forums.freebsd.org/showthread.php?t=13416[/color]
User avatar
sk8harddiefast
Senior Member
 
Posts: 1982
Joined: 01 Mar 2010, 00:47
Location: Athens, Greece

Postby pigling » 01 Sep 2010, 06:15

fbsd1 wrote: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
[CMD=" "]dd if=/dev/zero of=/dev/da0 count=1[/CMD]
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 [CMD=" "]mount_msdosfs /dev/da0 /mnt[/CMD] 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: Select all
GEOM: media size does not match label


Then after attaching, run
[cmd=]mount_msdosfs /dev/da0a /mnt/usb[/CMD]
give the error
Code: Select all
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 [FILE]/dev[/FILE] after formatting in winXP? Can someone give a suggestion? Thanks.

regards,
qichao
pigling
Junior Member
 
Posts: 18
Joined: 25 May 2010, 09:55

Postby Beastie » 01 Sep 2010, 11:35

pigling wrote:
Code: Select all
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 [cmd="%"]ls /dev/da*[/cmd]
May the source be with you!
Beastie
Senior Member
 
Posts: 1862
Joined: 28 Mar 2009, 11:27
Location: /dev/earth0

Postby wblock@ » 01 Sep 2010, 14:21

pigling wrote: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 [file]cfdisk[/file]. I only wish we had something like it for FreeBSD. ([man=8]sade[/man] has problems like delayed commit and happily changing your /etc/fstab when it should not. And the user interface could be better.)
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby Beastie » 01 Sep 2010, 15:41

wblock wrote:To easily edit a partition table, I recommend Linux's [file]cfdisk[/file]. 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.
May the source be with you!
Beastie
Senior Member
 
Posts: 1862
Joined: 28 Mar 2009, 11:27
Location: /dev/earth0

Postby wblock@ » 01 Sep 2010, 16:45

Beastie wrote: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.
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby peetaur » 10 Apr 2012, 13:44

Problem and Solution

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

Code: Select all
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 ([FILE]mount -t[/FILE] ... or [FILE]mount_ntfs[/FILE]) were not the fuse package I installed a month ago.

To realize this, I saw in the man page:

Code: Select all
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:
[CMD="#"]ntfs-3g /dev/ntfs/disklabelgoeshere /mnt/mountpoint[/CMD]

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).
Criticism is always welcome.
peetaur
Member
 
Posts: 167
Joined: 02 Sep 2011, 11:02
Location: Geesthacht, Germany


Return to Peripheral Hardware

Who is online

Users browsing this forum: No registered users and 0 guests