Other USB storage

stream

Member

Reaction score: 1
Messages: 29

Hello,

I'm having difficulty trying to get USB thumb drive or WD storage to work in Freebsd. It works fine in windows.

Am using Freebsd 12. Here are some errors that I get:

I can see the device in camcontrol devlist:
<WD My Passport ...> at scbus7 target 0 lun 0 (da0,pass3)

When I do gpart show da0
gpart: No such geom: da0.

And this command file -s /dev/da0: show an error
/dev/da0: DOS/MBR boot sector MS-MBR Windows 7 english at offset 0x163 "Invalid partition table" at offset 0x17b "Error loading operating system" at offset 0x19a "Missing operating system", disk signature 0xe9857065; partition 1 : ID=0x7, start-CHS (0x0,32,33), end-CHS (0x3ff,254,63), startsector 2048, 4294965248 sector


Wold like your help to run diagnostic and resolve this please.
 

Phishfry

Son of Beastie

Reaction score: 1,402
Messages: 4,131

Are you trying to share files from these Windows disks or what are you doing?
For a thumbdrive wipe it with zeros and format it the FreeBSD way. UFS or ZFS.

You can also mount with msdosfs(5). But that looks like Win7 formatting and that may take more work.
 

balanga

Son of Beastie

Reaction score: 137
Messages: 3,059

Hello,

I'm having difficulty trying to get USB thumb drive or WD storage to work in Freebsd. It works fine in windows.

Am using Freebsd 12. Here are some errors that I get:

I can see the device in camcontrol devlist:
<WD My Passport ...> at scbus7 target 0 lun 0 (da0,pass3)

When I do gpart show da0
gpart: No such geom: da0.

And this command file -s /dev/da0: show an error
/dev/da0: DOS/MBR boot sector MS-MBR Windows 7 english at offset 0x163 "Invalid partition table" at offset 0x17b "Error loading operating system" at offset 0x19a "Missing operating system", disk signature 0xe9857065; partition 1 : ID=0x7, start-CHS (0x0,32,33), end-CHS (0x3ff,254,63), startsector 2048, 4294965248 sector


Wold like your help to run diagnostic and resolve this please.
There might not be a partition on the device. gpart(8)() is unable to read the filesystem if the device is not partitioned.

I've often wondered how Windows can access unpartitioned devices whereas FreeBSD (and Linux) can't...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,698
Messages: 30,639

I've often wondered how Windows can access unpartitioned devices whereas FreeBSD (and Linux) can't...
They can, it's just not recommended to not have a partition table.

newfs /dev/da0 works just fine and you can mount it without problems.
 

vermaden

Son of Beastie

Reaction score: 1,163
Messages: 2,755

Tr
Hello,

I'm having difficulty trying to get USB thumb drive or WD storage to work in Freebsd. It works fine in windows.

Am using Freebsd 12. Here are some errors that I get:

I can see the device in camcontrol devlist:
<WD My Passport ...> at scbus7 target 0 lun 0 (da0,pass3)

When I do gpart show da0
gpart: No such geom: da0.

And this command file -s /dev/da0: show an error
/dev/da0: DOS/MBR boot sector MS-MBR Windows 7 english at offset 0x163 "Invalid partition table" at offset 0x17b "Error loading operating system" at offset 0x19a "Missing operating system", disk signature 0xe9857065; partition 1 : ID=0x7, start-CHS (0x0,32,33), end-CHS (0x3ff,254,63), startsector 2048, 4294965248 sector


Wold like your help to run diagnostic and resolve this please.
Try to mount it with mount_msdosfs /dev/da0 /mnt command.
 
OP
OP
S

stream

Member

Reaction score: 1
Messages: 29

Thanks all for the help

Phishfry - yes, To clarify, I was trying to read a windows disk in Freebsd machine.

I had previously tried all the commands here- especially the standard ones from freebsd doc: , such as:
sudo mount -t msdosfs -o -m=644,-M=755 /dev/da0 /mnt/username

It doesnt work. mount_msdosfs: /dev/da0: Invalid argument

And as pointed out earlier, gpart shows no geom da0.

SirDice- sudo newfs /dev/da0 did run, and seemed to be displaying sectors. But in the end, when I attempted gpart show .. or mount -t.. I get the same error!
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,698
Messages: 30,639

@SirDice- sudo newfs /dev/da0 did run, and seemed to be displaying sectors. But in the end, when I attempted gpart show .. or mount -t.. I get the same error!
Yes, it was a response to balanga who claimed that FreeBSD and Linux aren't able to handle disks without a partition table. So the error is correct and expected, there's no partition table.
 

malavon

Active Member

Reaction score: 118
Messages: 198

Which file system does the drive use? If you're not sure, check on a Windows pc.
Especially the WD storage might very well be formatted with ntfs.

Install the sysutils/fusefs-ntfs and mount it with
ntfs-3g -o ro /dev/da0 /mnt (ro to mount as read-only)
 
OP
OP
S

stream

Member

Reaction score: 1
Messages: 29

I tried ntfs before, no luck unfortunately. The disk is not NTFS.

In windows, it is exFAT.
I even tried some of the suggestions to mount eFAT. None of them worked for this drive!
 
OP
OP
S

stream

Member

Reaction score: 1
Messages: 29

I'd like any suggestions to wipe off the usb and create proper partitions so I can mount.

I've tried wipe the disk with >>gdisk /dev/da0, and 'w' command .However get this error..
Unable to open device '/dev/da0' for writing! Errno is 13! Aborting write!
 

linux->bsd

Active Member

Reaction score: 63
Messages: 162

How about just wiping its contents?

dd if=/dev/urandom of=/dev/da0 conv=noerror bs=1M
 

k.jacker

Aspiring Daemon

Reaction score: 407
Messages: 693

I use plain FAT32 for my car stereo and my GoPro.
The limitations of FAT32 are max partition size of 2TB and max file size of 2GB.
If this is enough for you, then the following will create a MBR partition table with a single FAT32 partition (assuming your drive is /dev/da0):
THIS WILL WIPE ALL DATA ON THE DRIVE!
Code:
# gpart destroy -F da0
# gpart create -s mbr da0
# gpart add -t fat32 da0
# newfs_msdos -F32 -L usb-drive /dev/da0s1
You can replace usb-drive with a name you like, that will show up in Windows explorer.
To mount the drive (partition to be exact) in FreeBSD: mount -t msdosfs /dev/da0s1 /mnt
 
OP
OP
S

stream

Member

Reaction score: 1
Messages: 29

k.jacker the gpart commands just didn't work-- same error geom not found..

After much experimentation, here is what worked for me.

wipe the disk, partition, and create file system:


sudo dd if=/dev/urandom of=/dev/da0 conv=noerror bs=1M
sudo fdisk -i /dev/da0
sudo newfs_msdos -F32 /dev/da0s1

Now the geom is there, and gpart works as usual. (gpart show /dev/da0 )
And /media/da0s1 is the folder which gets auto-mounted in my case.

seems to work. problem now is that it is too slow. takes 20 seconds to run ls..

The same drive (using exFAT filesystem) when used in windows, I was able to read/write almost instantaneously!







 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,698
Messages: 30,639

Please stop using fdisk(8), use gpart(8) instead. The old fdisk(8) only supports MBR and doesn't understand GPT.

Code:
DESCRIPTION
     This command is obsolete.  Users are advised to use gpart(8) instead.
This error:
Code:
gpart: No such geom: da0.
Simply means da0 does not have a partition table. You create it with gpart create -s MBR da0, for a MBR partitioned disk or gpart create -s GPT da0 for a GPT partitioned disk.
 
OP
OP
S

stream

Member

Reaction score: 1
Messages: 29

SirDice Thanks. Your suggestion works on the freebsd formatted drive. But then, everything works if gpart shows geom da0.

The problem is nothing works if gpart fails.

Is there a way to cleanly mount an external drive formatted in windows, without reformatting in freebsd?

I purposely created an NTFS formatted drive in windows, with a single partition to fill up the whole drive. This is so I I have the whole drive available in windows.
But then Freebsd just cannot mount.

Same problem no geom da0!! And none of the mount commands work (ntfs specifc commands) .

Can anyone suggest a "recipe". Ideally I'd like the steps to make the compaitble partitions/formats in windows, so that when I plug the usb drive in my bsd machine- the drive should work out of the box.

I can get small FAT drives (< 16GB) to work fine. The problem seems to be large NTFS/exFAT drive formatted in windows.
 
Top