3

I'm trying to have systemd mount a volume by symlink. Unfortunately when I try it times out waiting for the systemd device to show up.

# systemctl start mnt-ephemeral0.mount
A dependency job for mnt-ephemeral0.mount failed. See 'journalctl -xn' for details.

# journalctl -xn
Aug 04 17:02:09 i-c7a88499 systemd[1]: Expecting device dev-block-ec2-ephemeral0.device...
Aug 04 17:03:39 i-c7a88499 systemd[1]: Job dev-block-ec2-ephemeral0.device/start timed out.
Aug 04 17:03:39 i-c7a88499 systemd[1]: Timed out waiting for device dev-block-ec2-ephemeral0.device.
Aug 04 17:03:39 i-c7a88499 systemd[1]: Dependency failed for /mnt/ephemeral0.

The message says it's waiting for dev-block-ec2-ephemeral0.device. My unit file specifies What=/dev/block/ec2/ephemeral0, which is a symlink to /dev/xvdb.

man 5 systemd.device says:

systemd will dynamically create device units for all kernel devices that are marked with the "systemd" udev tag

However it appears to only create the device unit for the /sys path.

# systemctl list-units | grep 'xvdb\|ephemeral0'
sys-devices-vbd\x2d2064-block-xvdb.device                  loaded active plugged   /sys/devices/vbd-2064/block/xvdb

The ephemeral0 is a properly recognized udev symlink:

# udevadm info -q symlink -n /dev/xvdb 
block/ec2/ephemeral0 disk/by-uuid/d57e2dd9-0062-448c-a914-0b6df045dafb

# ls -l /dev/block/ec2/ephemeral0 
lrwxrwxrwx 1 root root 10 Aug  4 16:59 /dev/block/ec2/ephemeral0 -> ../../xvdb

 

Here is the current unit file:

[Unit]
After=ephemeral0-format.service
[Mount]
What=/dev/block/ec2/ephemeral0
Where=/mnt/ephemeral0

 

Is there any way to get this mounted through a systemd.mount unit?
Could I create a fake unit like systemd did for that sys-devices-vbd... one?

1 Answer 1

2

It turns out the issue is that systemd ignores everything inside /dev/block.

The /dev/block/ec2/ephemeral0 was a symlink created by a udev rule, so the solution is to simply adjust the udev rule and put the symlink somewhere else. I chose to place it at /dev/disk/ec2/ephemeral0 instead.

$ udevadm info -q symlink -n /dev/xvdb                                                                                                                  
disk/by-uuid/ae145d53-9501-419f-b9b1-7416e5c4fec9 disk/ec2/ephemeral0

$ systemctl list-units -a | grep 'xvdb\|ephemeral0'                                                                                                     
  dev-disk-ec2-ephemeral0.device                                                  loaded    active   plugged   /dev/disk/ec2/ephemeral0
  dev-xvdb.device                                                                 loaded    active   plugged   /dev/xvdb
  sys-devices-vbd\x2d2064-block-xvdb.device                                       loaded    active   plugged   /sys/devices/vbd-2064/block/xvdb

Source: http://lists.freedesktop.org/archives/systemd-devel/2014-August/021919.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .