Ask Your Question

How to start a systemd unit only after LVM is up?

asked 2012-01-06 02:42:00 -0500

How can I make sure that my unit is only started after the whole LVM stuff is available?

I guess this is pretty easy and I only have to add the appropriate After=something in my unit file, but I just can't find the right one.

I always thought that's what fedora-wait-storage.service was for, but it seems it's not.

Any idea?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-01-06 03:00:49 -0500

Ok, I figured it out.

The service responsible for activating the LVM is lvm2-monitor.service. As such, I only added the following in my unit file:


Now my unit is activated correctly (it's a mount unit trying to mount the LVs, and it was failing because it was activated before the devices had appeared).

If there's a cleaner solution, please feel free to suggest! :)

edit flag offensive delete link more

answered 2013-02-14 10:49:53 -0500

lennart gravatar image

Note that normal services are started only after all storage is set up anyway, hence you don't have to do anything special at all. All normal services will be implicitly ordered after LVM setup.

(Or to turn this around: only if you use DefaultDependencies=no you ever have to think about these things)

edit flag offensive delete link more


Well, I didn't specify it in the question, but it was a mount unit that I needed ordered after LVM was up.

bochecha gravatar imagebochecha ( 2013-06-03 00:55:12 -0500 )edit

Question Tools


Asked: 2012-01-06 02:42:00 -0500

Seen: 2,215 times

Last updated: Feb 14 '13