Hi everyone, I am working on a Banana Pi with Arch Linux andi am currently trying to accomplish the following:After someone mounted the encrypted keyfiles for my external storage systemd shall use them and mount the external storage  systemd shall start all services that operate on the external storageOn shutdown everything shall be stopped before unmounting the encrypted volumeAfter some hours it finally worked and I wonder if there is a smaller solution:/etc/systemd/systemluks.keys.path[Unit]Description=looks-keys found in /etc/luks-keys[Path]DirectoryNotEmpty=/etc/luks-keys/[Install]WantedBy=multi-user.targetluks.keys.service[Unit]Description=luks-keys availibleConflicts=umount.targetBefore=umount.target[Service]Type=simpleExecStart=/usr/local/bin/storageRemainAfterExit=yesstorage.target[Unit]Description=StorageRequires=basic.targetAfter=multi-user.targetRequisite=luks.keys.serviceAllowIsolate=yes./storage.target.wants/minidlna.service[Unit]Description=minidlna serverAfter=network.targetRequisite=luks.keys.service[Service]Type=forkingExecStart=/usr/bin/minidlnad -P /run/minidlna/minidlna.pidPIDFile=/run/minidlna/minidlna.pid[Install]WantedBy=storage.target/usr/local/bin/storage#!/bin/bashsystemclt isolate storage.targetcryptsetup --key-file /etc/luks-keys/storage1 luksOpen /dev/sda1 storage1mount /dev/mapper/storage1 /mnt/storage1Pi boots:systemd starts multi-user.target activates luks.keys.path witch waits for files in /etc/luks-keysfiles found luks.keys.service is activated and starts storage.target the other services are startingBefore unmount:systemctl trys to stop luks.keys.service storage.target and the other services are stopping because then need luks.keys.service luks.keys.service finally stops and the shutdown continuous withumount.targetIf its not possible to accomplish this with less work i am happy to present the Answer to the question:How to configure systemd for a later mounted encrypted volume with  services working on it
Systemd config for later mounted encrypted volume with services working on it
arch linux;systemd;raspberry pi;luks;dm crypt