systemd: autofs contendo autofs não desmonta

2

Estou tentando configurar dois diretórios, cada um montado automaticamente:

  • /mnt/dir
  • /mnt/dir/subdir

No meu caso, estas são:

  • /mnt/btrfs-vol/rootfs (somente leitura)
  • /mnt/btrfs-vol/rootfs/btrbk-snap (RW para tirar instantâneos com btrbk )

Meu /etc/fstab contém:

LABEL=rootfs    /mnt/btrfs-vol/rootfs               btrfs   ro,subvol=/,lazytime,compress=lzo,ssd,discard,noauto,x-systemd.automount,x-systemd.idle-timeout=2
LABEL=rootfs    /mnt/btrfs-vol/rootfs/btrbk-snap    btrfs   rw,subvol=/btrbk-snap,lazytime,compress=lzo,ssd,discard,noauto,x-systemd.automount,x-systemd.idle-timeout=2,x-systemd.requires-mounts-for=/mnt/btrfs-vol/rootfs

Eu faço:

svelte ~# systemctl daemon-reload && systemctl restart local-fs.target
svelte ~# mount | grep btrfs-vol/rootfs
systemd-1 on /mnt/btrfs-vol/rootfs type autofs (rw,relatime,fd=32,pgrp=1,timeout=2,minproto=5,maxproto=5,direct)

Estranhamente, /mnt/btrfs-vol/rootfs já está montado.

Se eu desmontar /mnt/btrfs-vol/rootfs , ele será imediatamente remontado:

svelte ~# umount /mnt/btrfs-vol/rootfs
svelte ~# mount | grep btrfs-vol/rootfs
systemd-1 on /mnt/btrfs-vol/rootfs type autofs (rw,relatime,fd=32,pgrp=1,timeout=2,minproto=5,maxproto=5,direct)

Agora, se eu fizer o ping no subdiretório, ele será montado automaticamente:

svelte ~# (cd /mnt/btrfs-vol/rootfs/btrbk-snap/ && mount | grep btrfs-vol/rootfs)
systemd-1 on /mnt/btrfs-vol/rootfs type autofs (rw,relatime,fd=32,pgrp=1,timeout=2,minproto=5,maxproto=5,direct)
/dev/mapper/vg_svelte-rootfs on /mnt/btrfs-vol/rootfs type btrfs (ro,relatime,lazytime,compress=lzo,ssd,discard,space_cache,subvolid=5,subvol=/)

Observe que fstype de /dev/mapper/vg_svelte-rootfs foi alterado de autofs para btrfs .

Alguns segundos depois (tenho timeout=2 para testes '):

svelte ~# mount | grep btrfs-vol/rootfssystemd-1 on /mnt/btrfs-vol/rootfs type autofs (rw,relatime,fd=32,pgrp=1,timeout=2,minproto=5,maxproto=5,direct)

O subdiretório é desmontado e o fstype de /dev/mapper/vg_svelte-rootfs é revertido para autofs , mas permanece montado .

Como faço para desmontar automaticamente?

Informações possivelmente úteis:

journal output:

Feb 21 17:16:07 svelte systemd[1]: Reloading.
Feb 21 17:16:23 svelte systemd[1]: Mounting /mnt/btrfs-vol/rootfs...
Feb 21 17:16:23 svelte systemd[1]: Set up automount mnt-btrfs\x2dvol-home-btrbk\x2dsnap.automount.
Feb 21 17:16:23 svelte systemd[1]: Mounted /mnt/btrfs-vol/rootfs.
Feb 21 17:16:23 svelte systemd[1]: mnt-btrfs\x2dvol-rootfs-btrbk\x2dsnap.automount: Directory /mnt/btrfs-vol/rootfs/btrbk-snap to mount over is not empty, mounting anyway.
Feb 21 17:16:23 svelte systemd[1]: Set up automount mnt-btrfs\x2dvol-rootfs-btrbk\x2dsnap.automount.
Feb 21 17:16:23 svelte systemd[1]: Reached target Local File Systems.
Feb 21 17:16:25 svelte systemd[1]: Stopped target Local File Systems.
Feb 21 17:16:25 svelte systemd[1]: Unset automount mnt-btrfs\x2dvol-rootfs-btrbk\x2dsnap.automount.
Feb 21 17:16:25 svelte systemd[1]: Unmounting /mnt/btrfs-vol/rootfs...
Feb 21 17:16:25 svelte systemd[1]: Unmounted /mnt/btrfs-vol/rootfs.
Feb 21 17:17:44 svelte systemd[1]: Unset automount mnt-btrfs\x2dvol-home-btrbk\x2dsnap.automount.

Verificando se nada tem o diretório aberto:

svelte ~# lsof /mnt/btrfs-vol/rootfs
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
svelte ~[2]# ls -l /run/user/1000 | grep gvfs
ls: cannot access '/run/user/1000/gvfs': Permission denied
d????????? ? ?    ?      ?            ? gvfs

Eu nunca vi ? onde esperaria que os rwx placehoders estivessem antes.

    
por Tom Hale 21.02.2017 / 11:04

1 resposta

0

"Dê "uma "olhada "no "fstab " "systemd " " "option " " "x-systemd.requires-mounts-for= " " ": "

" "

Configures "a "RequiresMountsFor= "dependency "between "the "created "mount "unit "and "other "mount "units. "The "argument "must "be "an "absolute "path. "This "option "may "be "specified "more "than "once. "See "RequiresMountsFor= "in "systemd.unit(5) "for "details.

    
por 08.08.2018 / 07:06