loading...

re: Mount a volume using systemd VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Worth noting that systemd-based distributions like Red Hat 7 already uses systemd for mount management. The fstab acts as a source-file that provid...
 

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 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)

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. ;)

Code of Conduct Report abuse