[systemd-devel] Mount units don't create their mount points at boot-time

Mathieu Bridon bochecha at fedoraproject.org
Thu Jan 5 02:08:50 PST 2012


Hi,

I'm playing with mount units as a replacement of traditional fstab
declaration as I'd like to use some systemd facilities, for example
requirements between services and their underlying storage.

The systemd.mount(5) manual says:
  If the mount point is not existing at time of mounting, it
  is created.

That seems to work fine when I run manually:
  [root at localhost ~]# ls -d /foo/bar/
  ls: cannot access /foo/bar/: No such file or directory
  [root at localhost ~]# systemctl start foo-bar.mount 
  [root at localhost ~]# ls -d /foo/bar/
  /foo/bar/

However, when the unit is run at boot-time (because it has been
enabled), I get the following when the mount point doesn't exist:
  [root at localhost ~]# systemctl status foo-bar.mount
  foo-bar.mount - /foo/bar
  	  Loaded: loaded (/lib/systemd/system/foo-bar.mount; enabled)
  	  Active: failed since Thu, 05 Jan 2012 18:01:05 +0800; 3min 57s ago
  	   Where: /foo/bar
  	    What: tmpfs
  	 Process: 427 ExecMount=/bin/mount tmpfs /foo/bar -t tmpfs
(code=exited, status=32)
  	  CGroup: name=systemd:/system/foo-bar.mount
  [root at localhost ~]# dmesg | grep -F [427]
  [    9.450625] mount[427]: mount: mount point /foo/bar does not exist


Here is the content of my unit:
  [root at localhost ~]# cat /lib/systemd/system/foo-bar.mount
  [Unit]
  Description=/foo/bar
  
  [Mount]
  What=tmpfs
  Where=/foo/bar
  Type=tmpfs
  
  [Install]
  WantedBy=local-fs.target


Did I miss something?

This is on Fedora 16 with systemd-37-3.fc16.x86_64


-- 
Mathieu




More information about the systemd-devel mailing list