How to write data out of a snap onto a USB stick?

I’d like to write data from a snap onto a USB stick connected to an embedded board (RPi 3 Model B+). There is a core:raw-usb interface. However this is probably not the best way to get this job done :slight_smile: Seems like the udisk2 interface is the way to go: udisks2 documentation How does my snap has to interact with udisk2 to detect if an usb stick is mounted and write data onto it? udisk2 seems to allow interprocess communication via the dbus interface. Is there an exemplary snap somewhere which I could use as reference implementation?

Perhaps connecting that interface will just allow the udisksctl(1) command to work, as well as direct access to the underlying DBus API it uses? If so, maybe that manpage is a suitable example?

If you don’t get a full answer here, it might be worth asking on the Snapcraft Discourse - that’s where all the snap experts hang out. It’s different as snaps aren’t meant to be Ubuntu-specific.

here is an example snap for auto-mounting a disk (note that i havent made unmount work and it is a bit old already so it might need some changes):

https://github.com/ogra1/automount

if your snap additionally uses the removable-media interface you get write access to the auto-mounted device under /media …

Thanks a lot for the hint.