0
0
I'm trying to mount virtual vfat drive to Raspberry Pi. This solution was working then we formatted the vritual vfat drive via USB OTG, now I cannot mount the drive back to pi but I can still mount it to another USB device.
Here is the configuration.
Run only once for configuration
dd if=/dev/zero of=/dir/to/data/data.bin bs=512 count=7680000
mkdosfs /dir/to/data/data.bin
kpartx -a /dir/to/data/data.bin
Run on every boot after initial configuration
kpartx -a /dir/to/data/data.bin
The rest commands are executed by a OTG USB management application
To mount to itself
mount -o rw,umask=0000 -t vfat /dev/mapper/loop0p1 /mnt/data
Unmount from itself
umount /mnt/data
Mount to USB
modprobe g_mass_storage file=/dir/to/data/data.bin stall=0
Unmount from USB
modprobe g_mass_storage file=/dir/to/data/data.bin stall=0
When the vfat virtual disk was mounted to USB OTG we formatted it from the device it was connected to it to see what would happen.
And now we can't mount the virtual drive back to itself. Even after deleting the Virtual drive and rebuilding it.
mount -o rw,umask=0000 -t vfat /dev/mapper/loop0p1 /mnt/data
mount: wrong fs type, bad option, bad superblock on /dev/mapper/loop0p1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
or
mount -o rw,umask=0000 -t vfat /dev/mapper/loop0p1 /mnt/data
mount: special device /dev/mapper/loop0p1 does not exist
What I have tried
modprobe -r g_mass_storage //Unmount from usb
umount /mnt/data //Unmount from itself
kpartx -dv /dir/to/data.bin //unmap virtual drive
rm /dir/to/data.bin //delete the virtual file system
dd if=/dev/zero of=/dir/to/data.bin bs=512 count=7680000 //Create a new virtual drive
mkdosfs /dir/to/data/data.bin //Format to vfat
kpartx -av /dir/to/data.bin //Map to dev
mount -o rw,umask=0000 -t vfat /dev/mapper/loop0p1 /mnt/data //Mount to itself
Still getting one of the two error messages but I can still Mount it to the USB and read it as a fat drive with Windows 10
We are running Raspbian(Debian based)
Thank you for reading.