I am a relatively new Raspberry Pi user, following this tutorial, using a Raspberry Pi Zero W and Raspbian Stretch.
https://www.raspberrypi.org/magpi/pi-ze ... ash-drive/
It seems to be working fine. I didn't complete steps 13 and 14 because they don't apply to my project, but I do understand them. An important difference with my project is that the device that the Raspberry Pi is plugged into, is making changes to the files, instead of being read only. For this example, I have it plugged into my phone and then copy pictures on my phone to the "flash drive".
However, the Samba network share does not update with new changes unless I mount and and un-mount the "/mnt/usb_share" directory (using mount and umount). Rebooting also works, probably because everything is unmounted and mounted during the process.
Nothing else I have tried succeeds in getting the new changes to refresh in the network share. Originally I spent a lot of time thinking the problem was Samba, so I added options in the smb.conf file (such as oplocks=no, and csc policy=disable) to troubleshoot, as well as rebooting services related to Samba (smbd.service, nmbd.service, winbind.service) after making a change to the "flash drive" from my phone.
Code: Select all
sudo modprobe g_mass_storage file=/piusb.bin stall=0 ro=0 removable=1 sudo modprobe -r g_mass_storage
As I stated before, the only action that succeeded was mounting and un-mounting the directory in question, with "mount" and "umount". I looked into the documentation for these commands to figure out what they were doing that successfully made the changes appear, but all I could really determine was that some level of syncing was occurring before the un-mount took place. However, the actual "sync" command also failed to refresh the network share.
I don't really want to be constantly dismounting and mounting the directory in use, I would rather just figure out how exactly those two commands are succeeding in syncing the files I have changed. And that is the core of my question, why does "sync" not work in this scenario, and why do "umount" and "mount" work?
Thank you for your help. I've tried to be detailed in my post, but please let me know if you need any more information.