Possible to use partition for HDD storage?
One of the (minor) drawbacks is the speed at adding files to the device. Is it possible to have a partition be used in place of the iso.img file? That way you could put the sd card in a computer directly to transfer the files.
Is there a limit to the gadget module that prevents you from using a partition?
It appears it is possible. The documentation here says using a device is supported. https://linux-sunxi.org/USB_Gadget/Mass_storage
I will do some testing at some point and try to document the process/results here.
Here are my notes from testing:
- Backup all the img and isos you placed on the storage/HDD device
- Delete /iso.img (caution: this deletes all your files that were on HDD/Storage)
- Resize your root partition - I booted into a second system with gparted - mine has 15G, and I left the rest for storage/HDD)
- Create and format the leftover partition, I used NTFS
- Put the sd card back into the pi and boot
- Inside the gadget_cdrom directory: Replace all instances of /iso.img (or "$(losetup -PLf /iso.img --show)p1") with the new partition (mine is /dev/mmcblk0p3)
- Mode.sh
- Clean.sh
- Test by rebooting the Pi or restarting the gadget_cdrom service
- Test by shutting down the Pi, removing the sd card and putting in a PC, transfer your files, eject/unmount and put back in the Pi
I was able to get an improvement in speed from 10-20M/s (through the Pi) to 90M/s (direct to PC). I am not sure this is worth the extra effort yet. For reference the card I was using is this a SanDisk 256GB Extreme MicroSDXC Micro SD - SDSQXA1-256G-GN6MA.
I answered my own question.