I've been experimenting with the g_mass_storage kernel module.
I first tried loading it by putting it in /etc/modules and the options in
This worked, but when I connected the device to a computer the mass file storage was read only - not what I was looking for.
I reasoned that this was because when the module loads, the root filesystem is mounted as read-only - not read-write.
This is an issue, because the kernel driver tries to get a read-write file handle for its backing storage, and if it can't negotiate this rw handle, it falls back to read-only.
The only solution I can think of is moving the loading of the kernel module later in the boot sequence.
I moved the module initialisation to /etc/rc.local using modprobe, and this worked with both reading & writing - but it feels like a bit of a hack to load the module in there.
Is there a recommended place to load kernel modules that need rw access to a file?