1

When I want to use a USB disk on my desktop, I insert the disk and mount it manually, for example:

mount /dev/sdb1 /mnt/usb

I know that I can specify mount options with -o, such as

mount -o nodev,noexec,nosuid /dev/sdb1 /mnt/usb

But is there a way to set default options for all USB disks? (so that I don't have to type it manually every time)

  • I am not sure if you would be interested in using udisks as discussed here – Ramesh Sep 14 '14 at 17:30
3

In attempting to ascertain whether this is a duplicate of the U&L Q&A asked by @Ramesh I came across this Ask Fedora Q&A titled: udisks default mount options. One of the answer to that Q&A said the following:

excerpt - https://ask.fedoraproject.org/en/question/9957/udisks-default-mount-options/?answer=23126#post-id-23126

I've had a similar discussion in bugzilla. Basically mount options are hard-coded in udisk but if you add a device in fstab, it will mount with the options and at the mount point specified in fstab.

Too bad there is no way to override in udisks2

So it would seem your options are to either setup entries in /etc/fstab for your removable media, or attempt to use udisks, which will make use of it's own unconfigurable default options, or make use of the ones that you'd have to define in /etc/fstab.

  • using /etc/fstab has two problems: 1) I don't know what filesystem the disk will have (it could be fat or ext4). I am not sure whether i can leave taht out in fstab. 2) I think, I cannot use wildcards in fstab, i.e. /dev/disk/by-path/pci-*-usb* – Martin Vegter Sep 14 '14 at 18:34
  • @MartinVegter - correct you'd have to know these things ahead of time in /etc/fstab. – slm Sep 14 '14 at 19:25
  • @MartinVegter - do you care if the devices are automatically mounted w/ those options when the device becomes present? – slm Sep 14 '14 at 19:33
  • not automatically. I am happy to mount them manually, I just don't want to have to type the long options every time. – Martin Vegter Sep 14 '14 at 19:49
  • @MartinVegter - what about these methods? unix.stackexchange.com/questions/134797/… – slm Sep 14 '14 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.