[systemd-devel] udev re-reading partition tables on inotify

Phillip Susi phill at thesusis.net
Wed May 7 18:29:15 UTC 2025


Lennart Poettering <lennart at poettering.net> writes:

> Is it? I do that all the time? It's news to me that this wasn't a good
> idea...

It is terribly slow because it copies all of the unused data.  It's also
pretty terrible for SSDs to write the entire drive.  Most people use
higher level tools like parted magic or gparted.  For ext4 filesystems,
I normally use e2image since it can copy only the actual data.

> It's an advisory lock, true. But systemd won't interfere while you
> take it. And it will only issue the ioctl once it successfully took it
> itself. Hence, at that point it's in exclusive possession of the
> device, hence will not interfere with any other owner, because there
> cannot be one.

After the other program drops the lock and closes the device after
carfully informing the kernel of the partition table, udev swoops in and
issues the ioctl, which may very well blow away the partition table.
Interference isn't limited to being at the same time.



More information about the systemd-devel mailing list