tqhien wrote: ↑
Thu Dec 06, 2018 2:20 pm
I found a link for what seems adequate :
I'll try it on a project where for now I mount a file, stops Pi's activity while connected as USB and dismount/remount after disconnection.
That appears to be using MTP not mass storage.
It's not recommended to have write access enabled on both sides of the g_mass_storage link at the same time and,, while it can be done, write access on one side and read only on the other is also not recommended. Unseen changes can lead to accessing the wrong data.
As you've seen changes do not propogate between sides so the only way to see them is to unmount and remount on the side the didn't make the changes. There are ways to force this on the host but the devil is in the timing. It has to be done at a time when the host has nothing open and there is no way for the Pi to know when that is. And without a secondary channel (and software mods on the host) there is no way for the host to trigger the Pi to unmount/remout.
To do things by hand:
- Unmount side that won't be changed
- Make changes
- Sync changes to file system
- Remount other side
Root cause: both sides expect exclusive low level access to the backing storage. Both sides use caching. Neither side can tell the other what it's doing.
Having both sides writing to the storage will lead to lost data and corruption.