yrjc
yrjc

Reputation: 1

BeagleBone black USB_mass_storage connect to Windows not working

I have an annoying issue regarding getting USB_mass_storage on BBB to work when connected to Windows I have created an image : dd bs=1M if=/dev/zero of=/usb.bin count=64 Formatted it: mkdosfs /usb.bin -F 32 -I I have mounted it, copied files to and from it, no problem. Then I created a USB mass storage : modprobe g_mass_storage file=./usb.bin stall=0 ro=0 Connected it to a USB port on my Linux, nor problem, I can see and manipulate files On Windows I can see the drive, the size is correct, but filesystem is not recognized. With ro=0 I am able to create a partition from within Windows and format it. I can copy files to and from it but when I mount it on BBB I can not see the files copied using Windows. I can still though see the files I copied to the mountpoint on BBB.

Can someone tell me what I am doing wrong ?

I disabled everything regarding g_multi, including RNDIS, Serial, CDC. And it works perfectly under Linux.

Upvotes: 0

Views: 146

Answers (1)

TBR
TBR

Reputation: 2890

You have created a raw disk image without a partition table on the Linux side. Linux doesn't care if it's a file, if it has a partition table, etc.

Windows however gets confused by the lack of partition table. As you noticed.

Having a partition table is preferable. What you can do on the Linux side of things:

  • losetup --partscan - Have the file get processed as a disk with partition table and get devices for each partition
  • Mount the partition directly using an offset

In this particular case the latter is probably the quickest. There is only one partition and the offset is known.

fdisk -l ./usb.bin

Multiply the Start value by the Units size. Use it as the offset below:

mount -o loop,offset=12345 ./usb.bin /mnt

Make sure to never access from both sides at the same time as this will lead to filsystem damage and data loss.

See also e.g. https://askubuntu.com/a/69447

Upvotes: 1

Related Questions