1

Some examples:

  • If I plug an external USB drive in, it will get mounted under /media/$USER/<device-id> and my file browsers will automatically list the mountpoint under devices.
  • The same will happen if I manually mount something into a regular folder in my home directory. However, my file browsers will not list the mountpoint if that folder is hidden.
  • The file browser also won't list mountpoints that are in /tmp, for example.

So what are the conditions for a mountpoint to automatically show up in file browsers under devices? Since PCManFM and Nautilus seemingly behave exactly the same, I believe there might be general rules for this? Can I "force" a mountpoint (which is a hidden folder or in /tmp, for example) to show up under devices?

2 Answers 2

1

Block devices have a flag to indicate whether they are removable. This can be seen in the output of lsblk --help. Although I did not check the kernel sources, the device module is the best place to set this flag.

The exclusion of file systems mounted under /tmp is probably a separate check by the file managers you tried, or the libraries they use. Dolphin, for instance, continues to show such mounts as removable drives.

Usage:
 lsblk [options] [<device> ...]

List information about block devices.

Options:
 ...
 -o, --output <list>  output columns
 ...

Available output columns:
 ...
           RM  removable device
 ...

PCManFM uses GLib and Gio libraries. Nautilus probably does as well. Dolphin does not. I don't know the exact rules they follow, but you can check their sources.

More at How to tell if a SCSI device is removable?

1
  • 1
    Thank you very much. With you help I was able to find the place in the source code. :) See my answer below if you're interested.
    – finefoot
    Apr 13, 2023 at 16:25
1

PCManFM uses GNOME GLib which has a function g_unix_mount_guess_should_display in gio/gunixmounts.c which defines the conditions for mountpoints to show up:

/* Never display internal mountpoints */

(...)
  
  /* Only display things in /media (which are generally user mountable)
     and home dir (fuse stuff) and /run/media/$USER */

(...)

      /* Hide mounts within a dot path, suppose it was a purpose to hide this mount */

(...)

      /* Check /run/media/$USER/. If running as root, display any mounts below
       * /run/media/. */

(...)

          /* Avoid displaying mounts that are not accessible to the user.

There's also an issue thread discussing changes to search in more places for mountpoints: https://gitlab.gnome.org/GNOME/glib/-/issues/1043

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .