1

The default name is /run/media/$USER/<UUID>. Instead of UUID, I want it to use the partlabel (if it exists), which means I want to change the mountpoint's name to /run/media/$USER/<partlabel>.

I was hoping that it is possible by adding a rule (file) in the directory /etc/udev/rules.d. Can you tell me what to put in the file?

Edit -
This is what is in my rules file. As far as I know, this is the default configuration and there is no effect if it is removed.

# UDISKS_FILESYSTEM_SHARED
# ==1: mount filesystem to a shared directory (/media/VolumeName)
# ==0: mount filesystem to a private directory (/run/media/$USER/VolumeName)
# See udisks(8)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="0"
1

Assuming that I've understood the udisks(8) man page, the default udisks rules and my Debian 10 system is comparable to yours, the essential part should be this:

SUBSYSTEM=="block", ENV{PARTNAME}!="", ENV{UDISKS_NAME}="$env{PARTNAME}" 

The PARTLABEL of e.g. blkid output seems to be known as ENV{PARTNAME} in udev, or you can use ENV{ID_PART_ENTRY_NAME} if you want spaces escaped (i.e. a single space character will become \x20).

1
  • I've checked if it was working using udevadm info, the variable UDISKS_NAME DOES get set to the expected value. However, the mountpoint still stays the same, i.e. /run/media/$USER/<UUID> (or /run/media/$USER/VolumeName as they call it).
    – nomad
    Oct 1 '20 at 5:12
1

It is currently not possible to choose custom name for the mountpoint. UDISKS_NAME mentioned by @telcoM is used only as a hint for the UDisks API users when displaying name of the device -- for example Nautilus/GVFS in GNOME will use it when displaying the mounted devices -- but not for the mountpoint itself. Name for the mountpoint is hardcoded and it will be either filesystem label or UUID. Feel free to report issue against UDisks, using partition label as a third option here sounds like a good idea.

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.