Thank you very much. It dose work.

Would you tell me that how the '--no-block' works,

I doesn't deeply understand the interpretation in

https://www.freedesktop.org/software/systemd/man/systemd-mount.html#SYSTEMD_MOUNT_OPTIONS=


And why systemd-mount can solve the problem brought by MountFlag=slave.


Best Regard,

Hongzhi


On 2018年02月28日 03:02, Andrei Borzenkov wrote:
27.02.2018 17:20, Hongzhi, Song пишет:
Hi,

thank for your help, but I still have some question.


My current linux system init uses systemd and udev, with
'automount.rules' and 'mount.sh' in /etc/udev/,

to manage device. But owning to MountFlags=slave, hotpluggable media
(e.g., /dev/sda1 )

can be mounted again in host, whereas can't be formatted by mkfs.ext4 in
host with error

message '/dev/sda1 is apparently in use by the system; will not make a
filesystem here!'.


In your reply, you told me to invoke "systemd-mount" from udev rules. Do
you mean that

I should replace /bin/mount with /usr/bin/systemd-mount in mount.sh, or add

"RUN+='/usr/bin/systemd-mount $env{DEVNAME}'" to automount.rules?

1)

I  replaced /bin/mount with /usr/bin/systemd-mount in mount.sh.

     /usr/bin/systemd-mount $DEVNAME "/run/media/$name"

it prompted that

     systemd[1]: dev-sda.device: Job dev-sda.device/start timed out.
     systemd[1]: Timed out waiting for device dev-sda.device.
     systemd[1]: Dependency failed for /run/media/sda.
     systemd[1]: run-media-sda.mount: Job run-media-sda.mount/start
failed with result 'dependency'.
     systemd[1]: Dependency failed for File System Check on /dev/sda.
     systemd[1]: systemd-fsck@dev-sda.service: Job
systemd-fsck@dev-sda.service/start failed with result 'dependency'.
     systemd[1]: Startup finished in 16.692s (kernel) + 1min 32.605s
(userspace) = 1min 49.298s.
     systemd[1]: dev-sda.device: Job dev-sda.device/start failed with
result 'timeout'.

     ...

in /var/log/syslog.

Try

systemd-mount --no-block ...
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to