usb-mass-storage, data corruption, QtMoko v26

Alfa21 freerunner at
Sat Sep 11 03:31:58 CEST 2010

2010-09-10 at 18:13 Alfa21-mobile
> and now a question from me:
> when the usb mass storage mode is enabled, all the used partitions is
> in read only mode..
> I see qtmoko exports also the rootfs and imho it's not good because if
> I forget to switch off the usb storage ... it's bad for the whole
> system.
> the question is: how I can configure qtmoko to use only a specific
> partition? eg the one mounted on /media/card only?

about g_file_storage...
we have this DOGMA: an usb host will not expect to see any changes in the storage other than the ones it makes.

I found a critical (if the rootfs is on uSD) bug concerning the use of g_file_storage with the scripts in qtmokoV26!!

- the "# mount checking" if, in /opt/qtmoko/bin/ is too weak because:
1) by default /etc/fstab in qtmoko contains "rootfs" for / and any root partition on the uSD is not found by that grep
2) any swap partition is not found by that grep

so we could corrupt our storage if it remains mounted inside the freerunner and both exported with usb!

a fix could be:
- in storage-on script
1) modify the DEV_NAME with the name of the specific partition we want to export
2) umount it and really verify it's not mounted
3) modprobe g_file_storage (and we should add "removable=y" to the modprobe line)

btw I'm not sure if this is acceptable by OSes others than linux, because in this way we expose a storage without a partition table.
(I'll check this on a windows computer asap)
...else we could make a partition table inside the exported partition and use kpartx in the freerunner to read the storage (yes, it's like a matryoshka of partitions)

bye, a.

More information about the community mailing list