You are not logged in.
This is a cross-post from http://unix.stackexchange.com/questions … cryptsetup
I have an ArchLinux installation with systemd. I am trying to run a hook immediately after my encrypted data device is mounted in order to put flashcache on top of it. The order in which boot happens is:
- cryptsetup prompt for password, and decrypts /dev/mapper/cdata
- LVM finds a volume group vg01 on /dev/maper/cdata and creates device /dev/vg01/data
what I am looking to do is:
- after device /dev/vg01/data is ready, to run flashcache on it and create device /dev/mapper/data_cached. --> I am aware of security concerns in this scenario, they are taken care of <---
I have scripts that work, however I cannot make them load in right order. Here's what I did:
file: /usr/lib/systemd/system/flashcache.service
[Unit]
Description=FlashCache
Requires=systemd-cryptsetup@cdata.service
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/local/bin/flashcache_startup_script
[Install]
WantedBy=dev-mapper-data_cached.device
After creating file, I ran systemctl enable flashcache.service.
However, on boot flashcache_startup_script does not start, the dev-mapper-data_cached times out, after which I can get into a root shell and run flashcache_startup_script manually.
I examined output of journalctl -b, and determined that FlashCache service does not load before timeout occurs.
Another option I tried without success is Requires=dev-mapper-vg1-data.device
What am I doing wrong?
Last edited by asg1448 (2014-07-05 17:57:27)
Offline
Have you tried ordering it with "After="?
Offline
Have you tried ordering it with "After="?
So, replace
Requires=systemd-cryptsetup@cdata.service
with
After=systemd-cryptsetup@cdata.service
and remove WantedBy line?
Offline
Why? Have a look, if you have seen http://www.freedesktop.org/software/sys … .unit.html
Offline
Following unit worked for me:
[Unit]
Description=FlashCache
BindsTo=dev-vg1-data.device
After=dev-vg1-data.device
DefaultDependencies=no
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/local/bin/flashcache_startup_script
[Install]
WantedBy=sysinit.target
Thanks to everyone who wrote
Offline