[systemd-devel] Unmount NBD swap on shutdown
Alkis Georgopoulos
alkisg at gmail.com
Wed Aug 19 11:38:46 PDT 2015
Hi, systemd runs swapoff on shutdown, but unfortunately another step is
needed for NBD swap:
# nbd-client -d /dev/nbd1
This notifies the server that the client is shutting down, and thus the
nbd-server process is terminated, the swap file is erased etc.
In order to work around that issue, I'm trying to create a systemd
service that
1) Runs on shutdown:
WantedBy=shutdown.target
2) Runs before `swapoff` and before the network gets down:
After=swap.target network.target
3) And at that time, it calls a script that calls swapoff itself, and
then nbd-client -d:
ExecStart=/path/to/my-nbd-disconnect-script
It's not called at all though when I'm running `poweroff`. What am I
doing wrong?
How can I invoke `nbd-client -d` on shutdown, but before the swap gets
off and while the network is still up?
Thank you,
Alkis Georgopoulos
More information about the systemd-devel
mailing list