
I use tomb to store some files. I want to use a systemd .automount
unit so that whenever I try to access these files, the tomb is automatically mounted. However, tombs are not mounted with mount
, they are tomb open
does its own specialized setup (of which mount
ing is only one part).
Is there any way to specify a custom command for systemd .mount
/.automount
units? Failing that, is it possible to use other units for the same purpose?
Antwort1
You could try using a mount helper (see man 8 mount
). If you specify the fs type as, say, mytombfs
then when you or systemd mounts the filesystem it will run /sbin/mount.mytombfs
passing it most of the options needed. This script can then do whatever you need to, and eventually call /bin/mount "$@"
to really mount the device. For example, the .mount unit
[Mount]
What=/dev/sdc1
Where=/a/b
Type=mytombfs
Options=x-systemd.automount,auto,noatime,uid=meuh
will run
/sbin/mount.mytombfs /dev/sdc1 /a/b -o rw,noatime,uid=1000