Appreciate any thoughts on this conundrum!

To give some extra background - I've got the Pi configured to automatically overwrite the mass storage device filestore upon boot, so it is always presenting a fresh filesystem. Each system below (that I'm connecting it to) is made by a different manufacturer and is a closed system, so I have no ability to perform any diagnostics at that end.

System 1 - Always works System 2 - Shows no USB stick connected System 3 - Gives error when trying to save (memory error) System 4 - Says unidentified USB (Windows PC - Always works) (Linux PC - Always works)

At first I thought this was due to minor subtleties of how the g_mass_storage device was being presented as a standard Sandisk USB memory stick works fine in all systems.

However I then started to notice some unusual behaviour, if rather than doing a reboot (and wiping it fresh), I kept the power running and moved it between machines.

If I started with System 1 first, then systems 2, 3, 4 would all recognise/write to it OK.

I then copied a backup of the filesystem after it had been in System 1 - however that still didn't seem to solve the problem after a reboot. What I did then notice though was that if I powered the Pi up and then first connected it to a Windows system it then worked fine when plugged in to the others. To be clear I didn't read/write any files to the device, just started it up, then plugged it into Windows, saw the home directory on the USB open, then unplugged it and plugged it into one of the other systems - they all now recognised it.

I tried starting/stopping g_mass_storage but that in itself didn't seem to do it.

To be honest I'm now a bit flummoxed! It is clearly able to work with all 4 systems (I've been able to save files from them), but it seems to want to be plugged into either a PC or System 1 first before then working with the others. Can anyone think of anything that is happening when I do this? Unfortunately the idea of doing it this way is just not workable for what I'm wanting to do. Ideally I would have 1 Pi for each system, plugged into it just by the one USB data/power cable such that when the system powered on the Pi booted and then the USB was available to it to read/write.

Thanks in advance for any thoughts/suggestions!

  • Why are you doing this? Presumably, if you are writing something to disk it has some value beyond the next reboot. Jul 7, 2017 at 20:27
  • Sorry, yes - I've already written all the code to read the data that is written and upload it to a server. That bit of it is working fine at least! It checks for new files every 2 min and uploads them. Upon reboot it does a backup upload of all contents then puts in a fresh filesystem.
    – EDIflyer
    Jul 7, 2017 at 20:55
  • This may not be the cause but wouldn't simply deleting the uploaded items be easier and faster. Perhaps the root cause is that while you are formatting the drive other systems can't connect. Jul 7, 2017 at 21:07
  • Thanks for the reply, Steve. The issue with deleting uploaded items is that the Pi is still connected to the closed systems when doing so - as such they have exclusive use of the USB and don't like me interfering with it (it was what I tried to do initially!). I therefore instead just mount the filesystem as read-only within the Pi to keep them happy. I've coded to only upload new files that have appeared since the last upload. However to stop them building up I refresh the filesystem on each reboot.
    – EDIflyer
    Jul 7, 2017 at 21:15
  • (contd) I'm not formatting the drive, just replacing it with a known working version on reboot. The bit I don't get it how just plugging it into a PC for a second then unplugging and plugging in to these closed-unit systems then works, in a way that plugging it in to them first (apart from System 1) doesn't! I'm not sure if it's a filesystem issue as much as the Pi not initialising something until plugged in to a PC/Sys 1
    – EDIflyer
    Jul 7, 2017 at 21:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.