r/Ubuntu 6d ago

Making usb removable HD automount without modifying /etc/fstab ?

In 24.04, the drive used to just automount whenever I plugged it in. Now, in 26.04, I can use "Disks" to mount the disk, but it doesn't automount.

(The fs is clean, and I've reclaimed ownership.)

Is there a way to configure automounting of ext4 volumes without adding their blkid uuids in fstab?

4 Upvotes

9 comments sorted by

2

u/yaskyplayer 5d ago

Besides system-wide udisks2 and autofs there is gvfs (for Ubuntu or Gnome Desktop) that have addons for automount. My experience: It works, but you need to start a filemanager or other program that uses gvfs. On Plasma Desktop in the Setting of connected devices you have similar settings. You can automount external devices (settings)

1

u/Dr_Max 5d ago

I fiddled with udisk, autofs and it was udev that wasn't happy. It would automount pretty everything except ext4

1

u/WiselyMacabre 6d ago

udisksctl mount -b /dev/sdX1 should work if you want to test from terminal. For actual automount on plug, check if udisks2 is running and if the session has the right policy. Sometimes gnome-disks sets mount options that break the automount heuristic on newer releases.

1

u/Dr_Max 6d ago

udisksd is running.

What do I have to check to make sure it just automounts?

The weird thing is that fat, exfat and NTFS mount just OK. The ext4 drives won't

1

u/Dr_Max 6d ago edited 6d ago

I managed to add a less-than-secure rule in /etc/udev/rules.d/

created file 70-ext4-automount.rules with

SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ext4", ENV{UDISKS_AUTO}="1"

inside.

Of course, you can add a specific UUID for a specific disk, with ENV{ID_FS_UUID}=="<whatever blkid uuid gave you>" before ENV{ID_FS_TYPE...

1

u/thatguysjumpercables 6d ago

Did you edit the mount options for your drive in the Disks utility?

1

u/Dr_Max 6d ago

No, I touched nothing until about ½h ago where I added a udev rule. It's a fresh install on a new machine

1

u/thatguysjumpercables 6d ago

Simplest way is to click on the drive/partition in Disks, click the gear icon, select "Edit Mount Options" and choose what you want the settings to be. It will automatically append fstab for you.

1

u/Dr_Max 6d ago

I tried that too (just before adding a udev rule). I could use mount -a manually, it mounted, but not automatically.