Thanks for bringing these up, currently at work all machines are systemd based and we use chef as CM tool. We use chef templates to create these mount unit files. It was a little easy to add one file (unit configuration) than fiddle with fstab from chef.
As a dev I didn’t knew about feature of mounting volumes with systemd, so wanted to share it.
Been using UNIX since the late 80s; Linux since the mid-90s; virtualization since the early 2000s and spent the past few years working in the cloud space.
Location
Alexandria, VA, USA
Education
B.S. Psychology from Pennsylvania State University
Yeah. It's kind of cool ...just know that I ended up with a complaint-storm at my desk when I started offering up systems that had empty fstabs. =)
Dunno if you've had occasion to deal with layered-mounts (e.g., /opt/oracle, /opt/oracle/data, /opt/oracle/logs), or not. With systemd being a parallelized system (part of why systemd-enabled systems boot faster that upstart-enabled or older init-type systems), you typically want to take extra care with your unit-files. Specifically, you'll want to make sure that your layered mounts' unit-files use appropriate dependency-directives — Requires and/or Before/After directives. Absent their use, you can end up in a situation where a lower-level mount happens after a higher-level mount (e.g., /opt/oracle/data mounts before /opt/oracle creating a situation where /opt/oracle effectively hides the content of /opt/oracle/data)
Been using UNIX since the late 80s; Linux since the mid-90s; virtualization since the early 2000s and spent the past few years working in the cloud space.
Location
Alexandria, VA, USA
Education
B.S. Psychology from Pennsylvania State University
Sort of. Bot only in as much as you get from alphabetical ordering. E.g., if you have the layered-mounts /var (var.mount), /var/log (var-log.mount), and /var/log/auditvar-log-audit.mount systemd should initiate them a few msec apart and — in that order — simply because of the service-directory's scan-order. That said, you open yourself to unexpected results and race-conditions by not over-specifying the dependencies. Which is to say, 99.999% of the time, things will work as expected, but there can be times where they don't and then you'll be pulling your hair out wondering why. ;)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for bringing these up, currently at work all machines are systemd based and we use chef as CM tool. We use chef templates to create these mount unit files. It was a little easy to add one file (unit configuration) than fiddle with fstab from chef.
As a dev I didn’t knew about feature of mounting volumes with systemd, so wanted to share it.
Yeah. It's kind of cool ...just know that I ended up with a complaint-storm at my desk when I started offering up systems that had empty
fstab
s. =)Dunno if you've had occasion to deal with layered-mounts (e.g.,
/opt/oracle
,/opt/oracle/data
,/opt/oracle/logs
), or not. With systemd being a parallelized system (part of why systemd-enabled systems boot faster that upstart-enabled or older init-type systems), you typically want to take extra care with your unit-files. Specifically, you'll want to make sure that your layered mounts' unit-files use appropriate dependency-directives —Requires
and/orBefore
/After
directives. Absent their use, you can end up in a situation where a lower-level mount happens after a higher-level mount (e.g.,/opt/oracle/data
mounts before/opt/oracle
creating a situation where/opt/oracle
effectively hides the content of/opt/oracle/data
)Wouldn't systemd provide an implicit dependencies in this case ?
Sort of. Bot only in as much as you get from alphabetical ordering. E.g., if you have the layered-mounts
/var
(var.mount
),/var/log
(var-log.mount
), and/var/log/audit
var-log-audit.mount
systemd should initiate them a few msec apart and — in that order — simply because of the service-directory's scan-order. That said, you open yourself to unexpected results and race-conditions by not over-specifying the dependencies. Which is to say, 99.999% of the time, things will work as expected, but there can be times where they don't and then you'll be pulling your hair out wondering why. ;)