Systemd adds filesystem mount tool
Linux mount gets a systemd wrapper
The developers behind Systemd, the alternative to sysvinit, have added a mount tool to their user space bootstrapper.
The mount tool landed during the weekend in this merge.
It gives Systemd users a systemd-mount command, letting the mount command pull in dependencies and use auto-mounting logic.
Developer Lennart Poettering notes, scheduling the mount means there's time to check parent mounts, or run a file system checker.
Poettering gave a much longer explanation at Reddit, here.
A key point he makes is that systemd-mount isn't meant to replace the existing mount command. Rather, it runs systemd's dependency logic, and then calls mount under control of the scheduler.
As well as dependency-checking and scheduling, Poettering writes, using PID 1 (the init system) to run the mount command means it also gets sandboxing.
It's also an attempt to get around a perennial problem faced by *nix users: they can scramble removable media like USB keys if they remove them without unmounting.
“Consider a USB stick with a typical FAT file system on it,” he writes. The udisks utility expects users “to unmount it explicitly through the UI before unplugging it.”
Systemd-mount means “we can just automount it, thus establishing the mount point without actually having to mount the fs [file system – ed]”, he says. “the fs will be mounted on access, and a short idle timeout (of 1 second) will ensure that the fs is fully clean in most cases.”
To cover the case that someone scrambles the filesystem by unplugging a device during access, “through systemd's job scheduler, we can schedule an fsck invocation before the first access”, improving the chance that a devices that's been corrupted gets noticed and fixed. ®