[systemd-devel] Block device shutdown "hook"

Kay Sievers kay at vrfy.org
Fri Oct 16 03:25:04 PDT 2015


On Fri, Oct 16, 2015 at 1:55 AM, Ian Pilcher <arequipeno at gmail.com> wrote:
> Does systemd provide any sort of "hook" mechanism to call a script
> program when a block device is unmounted (or otherwise no longer being
> used) on shutdown?
>
> I'm toying with the idea of creating an alternative way of managing
> dm-cache devices -- something that will operate a bit more like bcache,
> rather than LVM cache.  It seems to be pretty straightforward, except
> for the need to properly shutdown the dm-cache once any filesystems,
> VGs, etc., on it are no longer in use.
>
> Is there a way to tell systemd how to "shut down" a block device?

There is no facility to watch individual block devices, and there will
probably never be such a thing in systemd.

Systemd, as the very last step at system reboot/shutdown tries to
stop/disassemle/unmount all active mounts/mapper/loop/... devices, but
that works only for simple storage setups and has no hooks for other
tools.

Kay


More information about the systemd-devel mailing list