[systemd-devel] How to write two .mount units for the same directory?

Lennart Poettering lennart at poettering.net
Mon Dec 29 05:54:32 PST 2014


On Wed, 24.12.14 11:09, 崔灏 (CUI Hao) (cuihao.leo at gmail.com) wrote:

> Hi all,
> 
> I want to write 2 mount unit to mount the same directory. When the first
> failed to mount, then the second is called via OnFailure= setting. (Think
> of an NTFS partition after Windows' hiberation. I'd like to write a backup
> unit to mount it readonly.)
> 
> But there is a rule that "Where=" setting must match unit name in a
> ".mount" unit. This means only one unit can be created for one directory,
> right?

Correct. There can only be one name for each unit, and it must be
clear which unit is meant when a unit name is referenced.

> Is there any way to achieve my idea, or it's just impossible? And what's
> the necessity of this naming rule?

You can do this with your own script, but systemd alone will not do
this. 

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list