[systemd-devel] systemd and automount

Colin Guthrie gmane at colin.guthr.ie
Wed Nov 6 13:21:24 PST 2013


'Twas brillig, and John Davis at 06/11/13 17:19 did gyre and gimble:> Hello
>
> I am trying to use systemd on archlinux to mount a file system on
> demand.  Here is what Ihave done and here are my results.
>
> Creating a ramdisk image.
>
> # dd if=/dev/zero of=testyfs.raw bs=4096 count=1000
> # mkfs.ext4 -F testyfs.raw
>
> Making a mount point in /mnt
>
> # mkdir /mnt/testyfs
>
> Adding an etnry /etc/fstab with automount systemd params.
>
> # cat /etc/fstab | grep testyfs
> /root/testyfs.raw      /mnt/testyfs     ext4
> rw,relatime,data=ordered,noauto,x-systemd.automount 0 2
>
> Trying to get systemd to see the new change
>
> # ls /run/systemd/generator | grep testy
> <nothing>
>
> # systemctl daemon-reload
> # systemctl restart mnt-testyfs
> Failed to issue method call: Unit mnt-testyfs.service failed to load: No
> such file or directory.
                                               ^^^^^^^^

You missed off the .automount from the unit name and systemctl defaults
to .service.

> [root at t61p generator]#
> # ls /run/systemd/generator | grep testy
> mnt-testyfs.automount
> mnt-testyfs.mount
> # mount | grep testyfs
> <nothing>
>
> So far this looks good
> # ls /mnt/testyfs/
> <nothing, hmm, I thought it would automount the file system since I was
> referring to the directory?>
>
> Reboot to see if mounts the file system
>
> After reboot, ls /mnt/testyfs
> # ls /mnt/testyfs
> lost+found
>
> Yes, its mounted,  but was it mounted at boot or because I requested it?
> Based upon the time in journalctl it looks like it was mounted on boot.
>
> I'm confused.  I thought the systemd automount capability was supposed
> to mount on demand.  It appears it does not mount on demand but instead
> mounts on boot.  Have I reconfigured something or do I misunderstand
> what automount means?


You ls the folder so it mounts it. If you want to check if this
triggered the mount, do your mount| grep testyfs check before ls'ing the
folder.

Of course some other service might inspect the folder too (e.g. mlocate
or some other filesystem indexer) which might trigger the mount.

Or there could be a problem with the automount itself. But I think you
need a few more checks before coming to that conclusion.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list