How to set default options for mounted file systems?
Solution 1:
It turns out is is not possible at all, as explained in another answer in unix.SE. The reason is that mount options are hardcoded in udisk2 (see FSMountOptions
in udiskslinuxfilesystem.c
).
A patch has been proposed to make mount options user-configurables but it has not been integrated as of April 2016.
Solution 2:
You can set mount options when mounting from the command-line by using the -o
flag and specifying the options separated by commas exactly as you would with the mount command.
To mount /dev/sdb1
with the noatime
mount option, use the following command.
udisksctl mount -b /dev/sdb1 -o noatime
The ability to modify the allowed and default mount options is now available in udisks2 as of version 2.9.0. See the documentation here for how to configure default and allowed mount options. Since 2.9.0 isn't shipped with Ubuntu 18.04 or 20.04 I also wrote up a tutorial on how to install it from source on Ubuntu 18.04 here for anyone who is interested.