title: How are kernel modules automatically inserted by systemd?
body: <p>I am trying to find out how kernel modules are automatically inserted. I am using Arch Linux, so basically I am working with <code>systemd</code>.</p>
  
  <p>After some research, I know there are at least 2 ways to insert kernel modules:</p>
  
  <ol>
  <li><p><code>systemd</code> has a unit called <code>systemd-modules-load.service</code>, which reads kernel module names in <code>/etc/modules-load.d/*.conf</code> (and the ones in <code>/run</code> and <code>/usr/lib</code>) (<a href="https://www.freedesktop.org/software/systemd/man/modules-load.d.html" rel="nofollow noreferrer">systemd documentation</a>).</p></li>
  <li><p><code>udev</code> can handle kernel module automatically when devices are detected (<a href="https://wiki.archlinux.org/index.php/kernel_modules#Automatic_module_handling" rel="nofollow noreferrer">Arch Linux wiki page</a>).</p></li>
  </ol>
  
  <p>However, I failed to see how those work:</p>
  
  <ol>
  <li><p>There are no config files in <code>/etc/modules-load.d/*.conf</code> (or the ones in <code>/run</code> or <code>/usr/lib</code>) on my system. Therefore it has nothing to load in <code>systemd-modules-load.service</code>.</p></li>
  <li><p>There are some <code>modprobe</code> commands in <code>/usr/lib/udev/rules.d</code>, but not all of the kernel modules I see in <code>lsmod</code>.</p></li>
  </ol>
  
  <p>For example, I have a <code>xfs</code> kernel module in the output of <code>lsmod</code>, but I can't find out the trigger point of inserting it. None of my filesystem are mounted with <code>xfs</code> (<code>cat /proc/mounts | grep xfs</code> shows nothing).</p>
  
  <p>Is there any introduction or tutorial of how all this works?</p>