On Mon, May 5, 2025 at 4:58 PM Kaizaad Bilimorya <kaiz...@sharcnet.ca> wrote: > > Hello Silvio, > Thank you for your response. > We're using Ansible to automate some tasks so it is easier (and more > reliable) to add/remove mount unit files than having to parse the fstab for > our specific mount options. > And as the Systemd documentation says "For tooling, writing mount units > should be preferred over editing /etc/fstab" which is something I agree with. > I need the > "x-initrd.mount" option since we are setting up some custom Dracut hooks > early in the boot process for the local disk and want this disk mounted > before switch-root. >
You do not need "x-initrd.mount". You need to add your unit to initrd. How did you expect to achieve it with a string in the unit definition? > thanks > -k > > On Mon, May 5, 2025 at 2:11 AM Silvio Knizek <killermoe...@gmx.net> wrote: >> >> Am Freitag, dem 02.05.2025 um 16:43 -0400 schrieb Kaizaad Bilimorya: >> >> Hello, >> >> $ systemctl --version >> systemd 252 (252-46.el9_5.3.alma.1) >> >> I was trying to use the "x-initrd.mount" option for some tooling in a mount >> unit file (instead of using it in fstab and having to parse for it) but it >> only seems to work in fstab. >> The documentation >> https://www.freedesktop.org/software/systemd/man/latest/systemd.mount.html#x-initrd.mount >> doesn't seem to include the line: >> "Note that this option can only be used in /etc/fstab, and will be ignored >> when part of the Options= setting in a unit file." >> as some other options do so I thought it should be able to work in a mount >> unit file. This is probably due to my lack of understanding of the way it >> works though it would be nice if the documentation stated this explicitly as >> it does for other options. >> >> Thanks >> -k >> >> Kaizaad Bilimorya >> Systems Administrator - SHARCNET | http://www.sharcnet.ca >> Digital Research Alliance of Canada >> >> Hi Kaizaad, >> >> if you need a mount in the initrd, than put a proper fstab in the initrd. >> >> But maybe you can elaborate what you actually want to achieve. Because >> >> (instead of using it in fstab and having to parse for it) >> >> sounds wrong. >> >> BR >> Silvio