[systemd-devel] Mounting a partition at the *right* time

Lennart Poettering lennart at poettering.net
Mon Jan 4 07:52:52 PST 2016


On Mon, 04.01.16 12:26, Rainer Dorsch (ml at bokomoko.de) wrote:

> Hi,
> 
> I am facing an issue with a .mount unit file. The task is simple: mount a partition at the 
> *right* time. 
> 
> The system is OpenElec 6.0, which is based on CoreOS. /etc/fstab is on a squashfs, i.e. 
> it cannot be easily modified and is empty:
> 
> OpenELEC:~/.config/system.d # cat /etc/fstab
> OpenELEC:~/.config/system.d # 
> 
> I would like to mount /storage/.kodi/.local/storage/sdcard after /storage is mounted 
> and before systemd-tmpfiles-setup.service starts executing:

Note that on systemd mounts automatically gain requirement and
ordering dependencies on all mounts that are prefixes of it. Thus, the
"after" dep you ask for above is automatically added anyway.

> 
> I created this .mount unit file:
> 
> OpenELEC:~/.config/system.d # cat storage-.kodi-.local-storage-sdcard.mount 
> [Unit]
> Description=sdcard mount script
> 
> #Requires=storage.mount
> #After=storage.mount
> ConditionPathExists=/storage/.kodi/.local/storage/sdcard

This appears unnecessary? Why would you condition on that?

> Conflicts=umount.target
> Before=umount.target systemd-tmpfiles-setup.service

These two lines are entirely unnecessary. Unless you set
"DefaultDependencies=no" all mount units will gain automatic deps on
umount.target anyway, and are ordered before local-fs.target. As
systemd-tmpfiles-setup.service is ordered after local-fs.target it
will thus run anyway after your mount.

> A start job is running for dev-mmcblk0p1.device (xys / 1min 30s)

This indicates that this block device is not actually noticed by
systemd. Make sure that the "systemd" tag is set on the block
device. Check it with "udevadm info" on it.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list