Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature request] /media/username/ID/ instead of UUID #1337

Open
jebez1 opened this issue Dec 16, 2024 · 4 comments
Open

[Feature request] /media/username/ID/ instead of UUID #1337

jebez1 opened this issue Dec 16, 2024 · 4 comments

Comments

@jebez1
Copy link

jebez1 commented Dec 16, 2024

E.g. mount nvme0n1p3 via Dolphin or
udisksctl mount -b /dev/nvme0n1p3
: /media/a/DB49-54E7/ but is it possible to have /media/a/nvme-WDS250G3X0C-00SJG0_185250422455-part3/ instead?

Thanks.

@jebez1 jebez1 changed the title /media/username/ID/ instead of UUID [Request] /media/username/ID/ instead of UUID Dec 16, 2024
@tbzatek
Copy link
Member

tbzatek commented Dec 18, 2024

The name is created from several sources - first the filesystem label, then the filesystem UUID, falling back to plain disk, see

if (label != NULL && strlen (label) > 0)
{
mount_point = sanitize_mount_point (mount_dir, label);
}
else if (uuid != NULL && strlen (uuid) > 0)
{
mount_point = sanitize_mount_point (mount_dir, uuid);
}
else
{
mount_point = g_strdup_printf ("%s/disk", mount_dir);
}

In practice almost every filesystem has an UUID. I think there's currently no other way to specify custom mountpoint name, other than putting it in /etc/fstab.

@jebez1
Copy link
Author

jebez1 commented Dec 18, 2024

Impossible? Why?

Although it's possible to have 2 partitions with the same UUID, on a PC, e.g. if I plug an USB flash drive from a friend (then we play the lottery).

On the contrary an ID depends on the unique hardware serial number, then the number of the partition https://wiki.archlinux.org/title/Persistent_block_device_naming.

It would be nice to have the setting, why not the path etc too.

@tbzatek
Copy link
Member

tbzatek commented Dec 19, 2024

I didn't say it's impossible, just currently not possible. Generally dynamically created mountpoints are not stable and never were. If there's a directory with the same name, UDisks will choose a new name, typically with -1, -2, etc. suffix. If you need stable names for your further operations, having a /etc/fstab record is the preferred way. Or just take a reference to the UDisksBlockObject and fetch actual mountpoint path from the org.freedesktop.UDisks2.Filesystem.MountPoints interface property.

@jebez1 jebez1 changed the title [Request] /media/username/ID/ instead of UUID [Feature request] /media/username/ID/ instead of UUID Dec 19, 2024
@jebez1
Copy link
Author

jebez1 commented Dec 19, 2024

Editing /etc/fstab is a bad patch for me, e.g. I don't wanna do it every time I plug a new drive.

I still don't understand why it's currently not possible:
ls -l /dev/disk/by-id|grep nvme0n1p3|head -n 1|awk '{print$9}'
nvme-WDS250G3X0C-00SJG0_185250422455-part3
...

Or just take a reference to the UDisksBlockObject and fetch actual mountpoint path from the org.freedesktop.UDisks2.Filesystem.MountPoints interface property.

How? I edit the code of udisks myself?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants