Whenever I attach a removable storage device like a USB memory stick to my computer running a Gnome desktop, it gets scanned for partitions and file systems, which are then mounted automatically. That’s very convenient, as file systems like exfat that do not have a notion of user or group identities are mounted with the proper uid= and gid= options for the user running the desktop. However, I have been unable so far to figure out a way of setting any mount options of my own. For example, I want to mount a USB flash memory stick with -o sync to avoid using the page cache.
Any hints, anyone? Of course, creating an entry in /etc/fstab is out of the question, because I want to keep the uid/gid part.
Mount options that udisks (system daemon used by GNOME for mounting) can be configured in /etc/udisks2/mount_options.conf (if the config file doesn’t exist, example config should be available in mount_options.conf.example). See the documentation for more details, but short version is that you can specify default mount options for your device like this:
You need to use some persistent path to your device so either /dev/disk/by-uuid or /dev/disk/by-id and then just add the mount options you want to be used with that specific device depending on the filesystem (the example is for FAT).