1

I have a drive that I'd like to always automount at a convenient path, say /mnt/my_drive. However, how do I know some other program won't try to use this mountpoint in the future, either preventing my drive from mounting (and breaking programs that rely on it) or breaking itself when the drive is already mounted? Is there some list of "reserved mountpoints" in Linux?

Bagalaw
  • 945

1 Answers1

4

You might want to read the Filesystem Hierarchy Standard.

Generally, programs won't mount things on their own initiative, but only following sysadmin-specified configuration. A program that expects to be able to mount something into an arbitrary non-standard location without allowing the sysadmin to modify that choice would be open to ridicule as a stupid design.

Only root can mount filesystems to any mountpoint; all others will need the mount permissions explicitly granted to them by root.

For example, removable media mounting tools included in desktop environments usually place their mount points under a fixed location, normally /media/<media name or serial number> or /media/<username>/<media name or serial>. Some tools might allow users a greater freedom to mount some things at any location that is writeable to them; in that case, the user will have to be responsible for his/her own choices.

If you're configuring an actual automounter (an autofs/automount service or a systemd automount unit), then the configuration will also always specify not only what the automounter can mount, but also where each automounted filesystem is supposed to be mounted. The configuration for a traditional automounter can normally be found in /etc/auto.* files.

If you grant mount permission to regular users by using the user or owner options in /etc/fstab, it will only allow the specific mountpoint that the fstab line in question applies to.

At the end, the system administrator is responsible for choosing the mountpoints and making sure they don't conflict with each other. In a nutshell:

  • know the standard mount points listed in the Filesystem Hierarchy Standard
  • check /etc/fstab, /etc/auto.* and systemctl -t automount
  • know your own environment and its customizations, including any tools that can allow non-root users to mount things
telcoM
  • 96,466