Lennart Poettering <lennart@xxxxxxxxxxxxxx> writes: > the BLKFLSBUF ioctl() works fine on block device fds open for read only. Oh, I might have to change that to use a read only open then. > I am not following anymore. As *long* *as* *the* lock is taken the > auto mounting doesn't happen. Once you release the lock then > everything will be reprobed and work as it always worked, including > auto-mounting. It is not about delaying the auto mounting, but *preventing it* entirely. I seem to remember at one point auto mounting was handled by udisksd and there was some hint environment variable a udev rule could set to tell it whether a given filesystem should be auto mounted or not, and there was a udev rule that set this hint only for USB disks. It seems this is no longer the case these days. After some additional testing, Mike Fleetwood has found that auto mounting does not happen on most recent distros, at least for sata disks, but it does still happen back on Rocky Linux 8. At first he said he saw two udev attributes set when not specifying the noauto option in /etc/fstab: RequiredBy=local-fs.target WantedBy=dev-sdb1.device In my testing, I only see the RequiredBy, not the WantedBy, and don't see any auto mounting being triggered. I would think that systemd auto mounting would be triggered by the WantedBy relationship. What causes that to be set? It also seems that you can not set this relationship manually. I think when I tried to add the wants relationship, I got an error that the device unit does not exist. I guess that is because there is no actual .device file in the filesystem? I suggested trying to add a runtime removal of the WantedBy relationship to temporarily disable auto mounting while gparted is running. Mike tried this but apparently you can't change most properties this way. See here for the discussion we've been having trying to figure out how to get rid of the old masking mounts workaround: https://gitlab.gnome.org/GNOME/gparted/-/issues/255#note_2263098